class Mpayer::Client
Public Class Methods
new(user_no, token)
click to toggle source
# File lib/mpayer/client.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_clients()
click to toggle source
# File lib/mpayer/client.rb, line 16 def all_clients @all_url = "#{@@base_uri}/clients/all_clients.json?" HTTParty.get(@all_url.to_str, headers: @header) end
client_accounts(client_id)
click to toggle source
# File lib/mpayer/client.rb, line 26 def client_accounts(client_id) @client_accounts_url = "#{@@base_uri}/clients/#{client_id}/accounts.json" HTTParty.get(@client_accounts_url.to_str, headers: @header) end
client_payables(client_id)
click to toggle source
# File lib/mpayer/client.rb, line 41 def client_payables(client_id) @client_payables_url ="#{@@base_uri}/clients/#{client_id}/payables" HTTParty.get(@client_payables_url.to_str, headers: @header) end
client_transactions(ac_id, client_id)
click to toggle source
# File lib/mpayer/client.rb, line 36 def client_transactions(ac_id, client_id) @transactions_url ="#{@@base_uri}/clients/#{client_id}/accounts/#{ac_id}/transactions" HTTParty.get(@transactions_url.to_str, headers: @header) end
find_account(client_id, account_id)
click to toggle source
# File lib/mpayer/client.rb, line 31 def find_account(client_id, account_id) @find_account_url ="#{@@base_uri}/clients/#{client_id}/accounts/#{account_id}" HTTParty.get(@find_account_url.to_str, headers: @header) end
new_account(json_msg, client_id)
click to toggle source
# File lib/mpayer/client.rb, line 46 def new_account(json_msg, client_id) @new_account_url ="#{@@base_uri}/clients/#{client_id}/accounts/new.json" HTTParty.post(@new_account_url.to_str, body: json_msg.to_json, headers: @header) end
new_client(json_msg)
click to toggle source
# File lib/mpayer/client.rb, line 21 def new_client(json_msg) @new_client_url = "#{@@base_uri}/clients.json" HTTParty.post(@new_client_url.to_str, body: json_msg.to_json, headers: @header) end