Class: Mambu::LoanSchedule

Inherits:
ApiModel show all
Extended by:
Helpers
Defined in:
lib/mambu/loan_schedule.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

camelize_hash, handle_error

Methods inherited from ApiModel

#convert_decimal, endpoint, #initialize

Constructor Details

This class inherits a constructor from Mambu::ApiModel

Instance Attribute Details

#repaymentsObject

Returns the value of attribute repayments.



3
4
5
# File 'lib/mambu/loan_schedule.rb', line 3

def repayments
  @repayments
end

Class Method Details

.api_uriObject



19
20
21
# File 'lib/mambu/loan_schedule.rb', line 19

def self.api_uri
  Mambu::LoanProduct.api_uri
end

.find(loan_product, options, connection) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/mambu/loan_schedule.rb', line 10

def self.find(loan_product, options, connection)
  response = connection.get(
    "#{endpoint(connection)}/#{loan_product.id}/schedule",
    camelize_hash(options)
  )
  handle_error(response)
  new(response.body)
end

Instance Method Details

#total(property) ⇒ Object



23
24
25
# File 'lib/mambu/loan_schedule.rb', line 23

def total(property)
  @repayments.map(&property).inject(0, &:+)
end