class Mpayer::MpayerAccount

Public Class Methods

new(user_no, token) click to toggle source
# File lib/mpayer/mpayer_account.rb, line 9
def initialize(user_no, token)
  @user_no = user_no
  @token   = token
  @auth    = WSSE::header(@user_no, @token)
  @header  = {'Content-Type'=> 'application/json', 'Accept' => 'application/json', 'X-WSSE' => "#{@auth}" }
end

Public Instance Methods

all() click to toggle source
# File lib/mpayer/mpayer_account.rb, line 16
def all
  @accounts_url = "#{@@base_uri}/accounts/all_accounts.json"
  HTTParty.get(@accounts_url.to_str, headers: @header)
end
batch_accounts(*args) click to toggle source
# File lib/mpayer/mpayer_account.rb, line 26
def batch_accounts(*args)
  @batch_accounts_url = "#{@@base_uri}/accounts/all_accounts?accounts_array=#{args.join(',')}"
  HTTParty.get(@batch_accounts_url.to_str, headers: @header)
end
enroll(json_msg, id) click to toggle source
# File lib/mpayer/mpayer_account.rb, line 36
def enroll(json_msg, id)
  @enroll_member_url = "#{@@base_uri}/accounts/#{id}/enroll"
  HTTParty.post(@enroll_member_url.to_str, body: json_msg.to_json, headers: @header)
end
find(id) click to toggle source
# File lib/mpayer/mpayer_account.rb, line 21
def find(id)
  @account_url ="#{@@base_uri}/accounts/#{id}"
  HTTParty.get(@account_url.to_str, headers: @header)
end
members(id) click to toggle source
# File lib/mpayer/mpayer_account.rb, line 31
def members(id)
  @members_of_account_url = "#{@@base_uri}/accounts/#{id}/members?per_page=100"
  HTTParty.get(@members_of_account_url.to_str, headers: @header)
end