Class: Unit::Resource::TransactionResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Unit::Resource::TransactionResource
- Defined in:
- lib/unit/api_resources/transaction_resource.rb
Class Method Summary collapse
-
.get_transaction(params) ⇒ UnitResponse, UnitError
Get a transaction by id by calling Unit’s API.
-
.list_transactions(params = nil) ⇒ UnitResponse, UnitError
Get transactions by calling Unit’s API.
-
.update_tags(request) ⇒ UnitResponse, UnitError
Update a transaction by calling Unit’s API.
-
.update_transaction(request) ⇒ UnitResponse, UnitError
Update a transaction by calling Unit’s API.
Methods inherited from BaseResource
file_response_handler, response_handler
Class Method Details
.get_transaction(params) ⇒ UnitResponse, UnitError
Get a transaction by id by calling Unit’s API
16 17 18 19 |
# File 'lib/unit/api_resources/transaction_resource.rb', line 16 def get_transaction(params) response = HttpHelper.get("#{api_url}/accounts/#{params.account_id}/transactions/#{params.transaction_id}", params: params.to_hash, headers: headers) response_handler(response) end |
.list_transactions(params = nil) ⇒ UnitResponse, UnitError
Get transactions by calling Unit’s API
24 25 26 27 |
# File 'lib/unit/api_resources/transaction_resource.rb', line 24 def list_transactions(params = nil) response = HttpHelper.get("#{api_url}/transactions", params: params.to_hash, headers: headers) response_handler(response) end |
.update_tags(request) ⇒ UnitResponse, UnitError
Update a transaction by calling Unit’s API
32 33 34 35 36 |
# File 'lib/unit/api_resources/transaction_resource.rb', line 32 def (request) payload = request.to_json_api response = HttpHelper.patch("#{api_url}/accounts/#{request.account_id}/transactions/#{request.transaction_id}", body: payload, headers: headers) response_handler(response) end |
.update_transaction(request) ⇒ UnitResponse, UnitError
Update a transaction by calling Unit’s API
41 42 43 44 45 |
# File 'lib/unit/api_resources/transaction_resource.rb', line 41 def update_transaction(request) payload = request.to_json_api response = HttpHelper.patch("#{api_url}/transactions/#{request.transaction_id}", body: payload, headers: headers) response_handler(response) end |