Class: Mpayer::Account

Inherits:
Endpoint show all
Defined in:
lib/mpayer_ruby/endpoints/account.rb

Instance Attribute Summary collapse

Attributes inherited from Endpoint

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Endpoint

#initialize, #success?

Constructor Details

This class inherits a constructor from Mpayer::Endpoint

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mpayer::Endpoint

Instance Attribute Details

#members(page: 1, per_page: 100) ⇒ Object

Mpayer::Account.find(26, fetch:false).members(page:1,per_page:100)



41
42
43
# File 'lib/mpayer_ruby/endpoints/account.rb', line 41

def members(page:1,per_page:100)
	find_all(page:page,per_page:per_page)
end

#payable_items(page: 1, per_page: 100) ⇒ Object

Mpayer::Account.find(26, fetch:false).payable_items(page:1,per_page:100)



46
47
48
# File 'lib/mpayer_ruby/endpoints/account.rb', line 46

def payable_items(page:1,per_page:100)
	find_all(page:page,per_page:per_page)
end

Class Method Details

.aggregates(page: 1, per_page: 100, **options) ⇒ Object

options = dr_cr:nil, ac_type:nil, category:nil Mpayer::Account.aggregate(options)



15
16
17
18
# File 'lib/mpayer_ruby/endpoints/account.rb', line 15

def aggregates(page:1,per_page:100, **options)
	url = "/accounts/aggregates"
	Mpayer::Fetch.get(url,query:{page:page,per_page:per_page}.merge!(options))
end

.all(page: 1, per_page: 100) ⇒ Object

Mpayer::Account.all()



8
9
10
11
# File 'lib/mpayer_ruby/endpoints/account.rb', line 8

def all(page:1,per_page:100)
	url = "/accounts/all_accounts"
	Mpayer::Fetch.get(url,query:{page:page,per_page:per_page})
end

.find(account_id, fetch: true) ⇒ Object

Mpayer::Account.find(account_id)



21
22
23
24
25
# File 'lib/mpayer_ruby/endpoints/account.rb', line 21

def find(,fetch:true)
	url = "/accounts/#{}"
	response = Mpayer::Fetch.get(url) if fetch
	 = new(id:,response:response)
end

Instance Method Details

#enrollObject



36
37
38
# File 'lib/mpayer_ruby/endpoints/account.rb', line 36

def enroll
	
end

#update(options) ⇒ Object

account.update(name:new_name)



30
31
32
33
34
# File 'lib/mpayer_ruby/endpoints/account.rb', line 30

def update(options)
	url = "/accounts/#{self.id}"
	response = Mpayer::Fetch.put(url,options)
	self.response = response
end