Class: Musoni::Loan
- Defined in:
- lib/musoni_ruby/endpoints/loan.rb
Instance Attribute Summary collapse
-
#payable_items ⇒ Object
writeonly
Sets the attribute payable_items.
-
#transactions ⇒ Object
writeonly
Sets the attribute transactions.
Attributes inherited from Endpoint
#attributes, #config, #endpoint, #id, #pagination, #response
Class Method Summary collapse
-
.all(offset: 1, limit: 100) ⇒ Object
Musoni::Loan.all().
-
.create(options = {}) ⇒ Object
account_attributes = :clientId=>“1”,:productId=>“1”,:submittedOnDate=>“13-05-2015”,:fieldOfficerId=>“1”,:charges=>[],:allowOverdraft=>false Musoni::Loan.create(account_attributes).
-
.find(loan_id, fetch: true) ⇒ Object
Musoni::Loan.find(loan_id).
Instance Method Summary collapse
-
#allocate(options = {}) ⇒ Object
loan.allocate(account: account, amount:100) loan.allocate(client_id: clientId, account_id: savingsId, amount:100).
-
#update(options) ⇒ Object
loan_options = :interestCalculationPeriodType=>“1”,:interestRatePerPeriod=>“7”,:interestType=>“1”,:loanTermFrequency=>“1”,:loanTermFrequencyType=>“2”,:numberOfRepayments=>“1”,:principal=>“1000”,:productId=>1,:repaymentEvery=>“1”,:repaymentFrequencyType=>“2” loan.update(loan_options).
Methods inherited from Endpoint
#fail?, #initialize, #success?
Constructor Details
This class inherits a constructor from Musoni::Endpoint
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Musoni::Endpoint
Instance Attribute Details
#payable_items=(value) ⇒ Object (writeonly)
Sets the attribute payable_items
3 4 5 |
# File 'lib/musoni_ruby/endpoints/loan.rb', line 3 def payable_items=(value) @payable_items = value end |
#transactions=(value) ⇒ Object (writeonly)
Sets the attribute transactions
3 4 5 |
# File 'lib/musoni_ruby/endpoints/loan.rb', line 3 def transactions=(value) @transactions = value end |
Class Method Details
.all(offset: 1, limit: 100) ⇒ Object
Musoni::Loan.all()
8 9 10 11 |
# File 'lib/musoni_ruby/endpoints/loan.rb', line 8 def all(offset:1,limit:100) url = "/loans" Musoni::Fetch.get(url,query:{offset:offset,limit:limit}).pageItems end |
.create(options = {}) ⇒ Object
account_attributes = :clientId=>“1”,:productId=>“1”,:submittedOnDate=>“13-05-2015”,:fieldOfficerId=>“1”,:charges=>[],:allowOverdraft=>false Musoni::Loan.create(account_attributes)
22 23 24 25 26 |
# File 'lib/musoni_ruby/endpoints/loan.rb', line 22 def create(={}) url = "/loans" response = Musoni::Fetch.post(url,) new(.merge!(id:response.loanId ,response:response)) rescue response end |
Instance Method Details
#allocate(options = {}) ⇒ Object
loan.allocate(account: account, amount:100) loan.allocate(client_id: clientId, account_id: savingsId, amount:100)
62 63 64 65 66 67 |
# File 'lib/musoni_ruby/endpoints/loan.rb', line 62 def allocate(={}) = {guarantorTypeId: 1, entityId: [:client_id], savingsId: [:account_id], amount: [:amount], locale: "en_GB"} url = "/loans/#{self.id}/guarantors" response = Musoni::Fetch.post(url,) self.response = response end |
#update(options) ⇒ Object
loan_options = :interestCalculationPeriodType=>“1”,:interestRatePerPeriod=>“7”,:interestType=>“1”,:loanTermFrequency=>“1”,:loanTermFrequencyType=>“2”,:numberOfRepayments=>“1”,:principal=>“1000”,:productId=>1,:repaymentEvery=>“1”,:repaymentFrequencyType=>“2” loan.update(loan_options)
54 55 56 57 58 |
# File 'lib/musoni_ruby/endpoints/loan.rb', line 54 def update() url = "/loans/#{self.id}" response = Musoni::Fetch.put(url,) self.response = response end |