Class: Reggora::Loan
- Inherits:
-
Object
- Object
- Reggora::Loan
- Defined in:
- lib/reggora/Entity/Lender/loan.rb
Instance Method Summary collapse
-
#all(offset = 0, limit = 0, ordering = '-created', loan_officer = []) ⇒ Object
retrieves all loans, and can take a number of query parameters.
-
#create(loan_params) ⇒ Object
creates a loan and returns the ID of the created loan.
-
#delete(id) ⇒ Object
deletes a specific loan.
-
#edit(id, loan_params) ⇒ Object
edits a loan and returns the ID of the edited loan.
-
#find(id) ⇒ Object
retrieves a specific loan by id.
-
#initialize(client) ⇒ Loan
constructor
A new instance of Loan.
- #sample_data ⇒ Object
Constructor Details
#initialize(client) ⇒ Loan
Returns a new instance of Loan.
3 4 5 6 |
# File 'lib/reggora/Entity/Lender/loan.rb', line 3 def initialize(client) @model = 'loan' @client = client end |
Instance Method Details
#all(offset = 0, limit = 0, ordering = '-created', loan_officer = []) ⇒ Object
retrieves all loans, and can take a number of query parameters
8 9 10 |
# File 'lib/reggora/Entity/Lender/loan.rb', line 8 def all(offset = 0, limit = 0, ordering = '-created', loan_officer = []) @client.get("/#{@model}s", {offset: offset, limit: limit, ordering: ordering, loan_officer: loan_officer}) end |
#create(loan_params) ⇒ Object
creates a loan and returns the ID of the created loan
18 19 20 |
# File 'lib/reggora/Entity/Lender/loan.rb', line 18 def create(loan_params) @client.post("/#{@model}", loan_params) end |
#delete(id) ⇒ Object
deletes a specific loan
27 28 29 |
# File 'lib/reggora/Entity/Lender/loan.rb', line 27 def delete(id) @client.delete("/#{@model}/#{id}") end |
#edit(id, loan_params) ⇒ Object
edits a loan and returns the ID of the edited loan. Only the provided fields will be updated
23 24 25 |
# File 'lib/reggora/Entity/Lender/loan.rb', line 23 def edit(id, loan_params) @client.put("/#{@model}/#{id}", loan_params) end |
#find(id) ⇒ Object
retrieves a specific loan by id
13 14 15 |
# File 'lib/reggora/Entity/Lender/loan.rb', line 13 def find(id) @client.get("/#{@model}/#{id}") end |
#sample_data ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/reggora/Entity/Lender/loan.rb', line 31 def sample_data n = rand(10...100) s = (0...50).map { ('a'..'z').to_a[rand(26)] }.join { "loan_number": "#{3 * n}#{s[1...5]}#{n}", "loan_officer": "5d4c4afdcfd7ff000a515085", "appraisal_type": "Refinance", "due_date": (Time.now + 60*60*24*30).strftime("%Y-%m-%dT%H:%M:%SZ"), "subject_property_address": "100 Mass Ave", "subject_property_city": "Boston", "subject_property_state": "MA", "subject_property_zip": "02192", "case_number": "10029MA", "loan_type": "FHA" } end |