class Mpayer::Transaction

Public Class Methods

new(user_no, token) click to toggle source
# File lib/mpayer/transaction.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/transaction.rb, line 16
def all
  @all_url ="#{@@base_uri}/transactions/all"
  HTTParty.get(@all_url.to_str, headers: @header)
end
deposit(json_msg) click to toggle source
# File lib/mpayer/transaction.rb, line 21
def deposit(json_msg)
        @deposit_url = "#{@@base_uri}/transactions/deposit"
        HTTParty.put(@deposit_url.to_str, body: json_msg.to_json, headers: @header)
end
transfer(json_msg) click to toggle source
# File lib/mpayer/transaction.rb, line 31
def transfer(json_msg)
        @transfer_url = "#{@@base_uri}/transactions/transfer"
  HTTParty.post(@transfer_url.to_str, body: json_msg.to_json, headers: @header)
end
withdraw(json_msg) click to toggle source
# File lib/mpayer/transaction.rb, line 26
def withdraw(json_msg)
        @withdraw_url = "#{@@base_uri}/transactions/withdraw"
  HTTParty.post(@withdraw_url.to_str, body: json_msg.to_json, headers: @header)
end