Class: Dinie::Resources::Loans
- Inherits:
-
Object
- Object
- Dinie::Resources::Loans
- Defined in:
- lib/dinie/generated/resources/loans.rb,
sig/dinie/generated/resources/loans.rbs
Overview
Operations on the loans resource.
Defined Under Namespace
Classes: Transactions
Instance Method Summary collapse
-
#create(request_options: {}, **fields) ⇒ Dinie::Loan
Create a loan from an accepted credit-offer simulation (
POST /loans). -
#initialize(http) ⇒ Loans
constructor
A new instance of Loans.
-
#retrieve(id, request_options: {}) ⇒ Dinie::Loan
Retrieve a single loan (
GET /loans/{id}). -
#transactions ⇒ Dinie::Resources::Loans::Transactions
The loan transactions subresource (
loans.transactions).
Constructor Details
#initialize(http) ⇒ Loans
Returns a new instance of Loans.
11 12 13 |
# File 'lib/dinie/generated/resources/loans.rb', line 11 def initialize(http) @http = http end |
Instance Method Details
#create(request_options: {}, **fields) ⇒ Dinie::Loan
Create a loan from an accepted credit-offer simulation (POST /loans).
22 23 24 25 26 |
# File 'lib/dinie/generated/resources/loans.rb', line 22 def create(request_options: {}, **fields) body = Loan.serialize_create(**fields) raw = @http.request(method: :post, path: "/loans", body:, request_options:) Loan.deserialize(raw) end |
#retrieve(id, request_options: {}) ⇒ Dinie::Loan
Retrieve a single loan (GET /loans/{id}).
35 36 37 38 |
# File 'lib/dinie/generated/resources/loans.rb', line 35 def retrieve(id, request_options: {}) raw = @http.request(method: :get, path: "/loans/#{id}", request_options:) Loan.deserialize(raw) end |
#transactions ⇒ Dinie::Resources::Loans::Transactions
The loan transactions subresource (loans.transactions).
16 17 18 |
# File 'sig/dinie/generated/resources/loans.rbs', line 16 def transactions @transactions ||= Transactions.new(@http) end |