lib/transaction.rb in soofapay-0.1.1 vs lib/transaction.rb in soofapay-0.1.2

- old
+ new

@@ -1,9 +1,8 @@ +require "json" #transaction class for soofa requests class Transaction - attr_reader :status, :sender_currency, :receiver_currency, :tid, :reference, :sender, :receiver, - :receipt_no, :timestamp, :gross_amount, :net_amount, :transacted_via, :is_money_in def initialize(data) @sender = data['sender'] @sender_currency = data['sender_currency'] @status = data['status'] @receiver_currency = data['receiver_currency'] @@ -14,11 +13,53 @@ @timestamp = data['timestamp'] @gross_amount = data['gross_amount'] @net_amount = data['net_amount'] @transacted_via = data['transacted_via'] @is_money_in=data['is_money_in'] - @as_json = data + @as_string= data.to_json end - def json - return @as_json + def as_json + return JSON.parse(@as_string) + end + def as_string + return @as_string + end + def status + return @status + end + def sender_currency + return @sender_currency + end + def receiver_currency + return @receiver_currency + end + def tid + return @tid + end + def reference + return @reference + end + def sender + return @sender + end + def receiver + return @receiver + end + def receipt_no + return @receipt_no + end + def timestamp + return @timestamp + end + def gross_amount + return @gross_amount + end + def net_amount + return @net_amount + end + def transacted_via + return @transacted_via + end + def is_money_in + return @is_money_in end end