Class: Musoni::SavingsAccount

Inherits:
Endpoint
  • Object
show all
Defined in:
lib/musoni_ruby/endpoints/savings_account.rb

Instance Attribute Summary collapse

Attributes inherited from Endpoint

#attributes, #config, #endpoint, #id, #pagination, #response

Class Method Summary collapse

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

#onholdtransactions(offset: 1, limit: 100) ⇒ Object

Musoni::SavingsAccount.find(26, fetch:false).onholdtransactions(offset:1,limit:100)



62
63
64
# File 'lib/musoni_ruby/endpoints/savings_account.rb', line 62

def onholdtransactions(offset:1,limit:100)
	find_all(offset:offset,limit:limit)
end

#transactions=(value) ⇒ Object (writeonly)

Sets the attribute transactions

Parameters:

  • value

    the value to set the attribute transactions to.



3
4
5
# File 'lib/musoni_ruby/endpoints/savings_account.rb', line 3

def transactions=(value)
  @transactions = value
end

Class Method Details

.all(offset: 1, limit: 100) ⇒ Object

Musoni::SavingsAccount.all()



8
9
10
11
# File 'lib/musoni_ruby/endpoints/savings_account.rb', line 8

def all(offset:1,limit:100)
	url = "/savingsaccounts"
	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::SavingsAccount.create(account_attributes)



22
23
24
25
26
# File 'lib/musoni_ruby/endpoints/savings_account.rb', line 22

def create(options={})
	url = "/savingsaccounts"
	response = Musoni::Fetch.post(url,options)
	new(options.merge!(id:response.savingsId ,response:response)) rescue response
end

.find(savingsaccount_id, fetch: true) ⇒ Object

Musoni::SavingsAccount.find(savingsaccount_id)



14
15
16
17
18
# File 'lib/musoni_ruby/endpoints/savings_account.rb', line 14

def find(savingsaccount_id,fetch:true)
	url = "/savingsaccounts/#{savingsaccount_id}?associations=all"
	response = Musoni::Fetch.get(url) if fetch
	savingsaccount = new(id:savingsaccount_id,response:response)
end