Class: Dinie::Resources::Loans
- Inherits:
-
Object
- Object
- Dinie::Resources::Loans
- Defined in:
- lib/dinie/generated/resources/loans.rb
Overview
Operations on the loans resource.
Defined Under Namespace
Classes: Transactions
Instance Method Summary collapse
-
#create(request_options: {}, **fields) ⇒ Object
Create a loan.
-
#initialize(http) ⇒ Loans
constructor
A new instance of Loans.
-
#retrieve(id, request_options: {}) ⇒ Object
Retrieve a loan.
- #transactions ⇒ Object
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) ⇒ Object
Create a loan
Create a loan from a credit offer and accepted simulation; the CCB contract is generated synchronously and the loan starts in ‘awaiting_signatures` status
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: {}) ⇒ Object
Retrieve a loan
Return the full loan object with lifecycle details
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 ⇒ Object
40 41 42 |
# File 'lib/dinie/generated/resources/loans.rb', line 40 def transactions @transactions ||= Transactions.new(@http) end |