Class: Mpayer::Account
Instance Attribute Summary
Attributes inherited from Base
#base_url, #mpayer_token, #user_no
Instance Method Summary collapse
-
#all ⇒ Object
GET /accounts/all_accounts.json.
-
#balance(id) ⇒ Object
GET /accounts/:id.
-
#enroll(account_id, json_body) ⇒ Object
POST /accounts/:account_id/enroll.
-
#fetch_account(id) ⇒ Object
GET /accounts/:id.
-
#fetch_by_ids(*ids) ⇒ Object
GET /accounts/all_accounts?accounts_array=#idsids.join(‘,’).
-
#subscribers(account_id) ⇒ Object
GET /accounts/:account_id/members?per_page=100.
Methods inherited from Base
#auth, #delete, #get, #initialize, #parse_api_response, #post, #put
Constructor Details
This class inherits a constructor from Mpayer::Base
Instance Method Details
#all ⇒ Object
GET /accounts/all_accounts.json
5 6 7 |
# File 'lib/mpayer/account.rb', line 5 def all get('/accounts/all_accounts.json') end |
#balance(id) ⇒ Object
GET /accounts/:id
23 24 25 |
# File 'lib/mpayer/account.rb', line 23 def balance(id) fetch_account(id)['balance'].to_f end |
#enroll(account_id, json_body) ⇒ Object
POST /accounts/:account_id/enroll
35 36 37 |
# File 'lib/mpayer/account.rb', line 35 def enroll(account_id, json_body) post("/accounts/#{account_id}/enroll", json_body) end |
#fetch_account(id) ⇒ Object
GET /accounts/:id
17 18 19 |
# File 'lib/mpayer/account.rb', line 17 def fetch_account(id) get("/accounts/#{id}.json") end |
#fetch_by_ids(*ids) ⇒ Object
GET /accounts/all_accounts?accounts_array=#Mpayer::Account.idsids.join(‘,’)
11 12 13 |
# File 'lib/mpayer/account.rb', line 11 def fetch_by_ids(*ids) get("/accounts/all_accounts?accounts_array=#{ids.join(',')}") end |
#subscribers(account_id) ⇒ Object
GET /accounts/:account_id/members?per_page=100
29 30 31 |
# File 'lib/mpayer/account.rb', line 29 def subscribers(account_id) get("/accounts/#{account_id}/members?") end |