Class: Firekassa::Transaction

Inherits:
Client
  • Object
show all
Defined in:
lib/firekassa/transaction.rb

Overview

Transactions API

Instance Method Summary collapse

Methods inherited from Client

#handle_error, #interpret_response, #send_request

Instance Method Details

#cancel(id) ⇒ Object



14
15
16
17
# File 'lib/firekassa/transaction.rb', line 14

def cancel(id)
  path = "/api/v2/transactions/#{id}/cancel"
  send_request(method: :post, path: path)
end

#download_receipt(id) ⇒ Object



26
27
28
29
# File 'lib/firekassa/transaction.rb', line 26

def download_receipt(id)
  path = "/api/v2/transactions/#{id}/receipt"
  send_request(method: :get, path: path)
end

#listObject



19
20
21
22
23
24
# File 'lib/firekassa/transaction.rb', line 19

def list
  # TODO: add proper URI encode
  # filter: nil, page: nil, sort: nil
  path = "/api/v2/transactions"
  send_request(method: :get, path: path)
end

#send_to_email(id:, email:, format:) ⇒ Object



31
32
33
34
35
# File 'lib/firekassa/transaction.rb', line 31

def send_to_email(id:, email:, format:)
  data = { email: email, format: format }
  path = "/api/v2/transactions/#{id}/send-receipt"
  send_request(method: :post, path: path, body: data)
end

#show(id) ⇒ Object



9
10
11
12
# File 'lib/firekassa/transaction.rb', line 9

def show(id)
  path = "/api/v2/transactions/#{id}"
  send_request(method: :get, path: path)
end