Class: EposNowClient::Resources::Transactions

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/epos_now_client/resources/transactions.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#connection

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from EposNowClient::Resources::BaseResource

Instance Method Details

#all(params = {}) ⇒ Object



6
7
8
# File 'lib/epos_now_client/resources/transactions.rb', line 6

def all(params = {})
  fetch_all_pages(params)
end

#by_date(start_date:, end_date:, params: {}) ⇒ Object



22
23
24
25
26
27
# File 'lib/epos_now_client/resources/transactions.rb', line 22

def by_date(start_date:, end_date:, params: {})
  connection.get(
    "#{resource_name}/GetByDate",
    params: params.merge(startDate: start_date, endDate: end_date)
  )
end

#create_transaction(attributes) ⇒ Object



14
15
16
# File 'lib/epos_now_client/resources/transactions.rb', line 14

def create_transaction(attributes)
  create(attributes)
end

#delete_transaction(id) ⇒ Object



18
19
20
# File 'lib/epos_now_client/resources/transactions.rb', line 18

def delete_transaction(id)
  destroy(id)
end

#find(id) ⇒ Object



10
11
12
# File 'lib/epos_now_client/resources/transactions.rb', line 10

def find(id)
  fetch(id)
end

#latest(params = {}) ⇒ Object



29
30
31
# File 'lib/epos_now_client/resources/transactions.rb', line 29

def latest(params = {})
  connection.get("#{resource_name}/GetLatest", params: params)
end

#validate(payload) ⇒ Object



33
34
35
# File 'lib/epos_now_client/resources/transactions.rb', line 33

def validate(payload)
  connection.post("#{resource_name}/Validate", body: payload)
end