Class: Unit::Resource::RepaymentResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Unit::Resource::RepaymentResource
- Defined in:
- lib/unit/api_resources/repayment_resource.rb
Class Method Summary collapse
-
.create(request) ⇒ UnitResponse, UnitError
Create a repayment by calling Unit’s API.
-
.get(repayment_id) ⇒ UnitResponse, UnitError
Get a repayment by calling Unit’s API.
-
.list(params = nil) ⇒ UnitResponse, UnitError
List repayments by calling Unit’s API.
Methods inherited from BaseResource
file_response_handler, response_handler
Class Method Details
.create(request) ⇒ UnitResponse, UnitError
Create a repayment by calling Unit’s API
33 34 35 36 37 |
# File 'lib/unit/api_resources/repayment_resource.rb', line 33 def create(request) payload = request.to_json_api response = HttpHelper.post("#{api_url}/repayments", body: payload, headers: headers) response_handler(response) end |
.get(repayment_id) ⇒ UnitResponse, UnitError
Get a repayment by calling Unit’s API
17 18 19 20 |
# File 'lib/unit/api_resources/repayment_resource.rb', line 17 def get(repayment_id) response = HttpHelper.get("#{api_url}/repayments/#{repayment_id}", headers: headers) response_handler(response) end |
.list(params = nil) ⇒ UnitResponse, UnitError
List repayments by calling Unit’s API
25 26 27 28 |
# File 'lib/unit/api_resources/repayment_resource.rb', line 25 def list(params = nil) response = HttpHelper.get("#{api_url}/repayments", params: params&.to_hash, headers: headers) response_handler(response) end |