Class: PersonaApi::TransactionsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/persona_api/resources/transactions.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#delete_request, #get_request, #handle_response, #initialize, #patch_request, #post_request, #put_request

Constructor Details

This class inherits a constructor from PersonaApi::Resource

Instance Method Details

#create(**attributes) ⇒ Object



3
4
5
# File 'lib/persona_api/resources/transactions.rb', line 3

def create(**attributes)
  Transaction.new post_request("transactions", body: attributes).body.dig("data")
end

#list(**params) ⇒ Object



7
8
9
# File 'lib/persona_api/resources/transactions.rb', line 7

def list(**params)
  Collection.from_response get_request("transactions", params: params), key: "data", type: Transaction
end

#retrieve(txn_id:) ⇒ Object



11
12
13
# File 'lib/persona_api/resources/transactions.rb', line 11

def retrieve(txn_id:)
  Transaction.new get_request("transactions/#{txn_id}").body.dig("data")
end