Class: Bcash::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/bcash/transaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email = nil, token = nil, id_transaction = nil, id_order = nil) ⇒ Transaction

Returns a new instance of Transaction.



8
9
10
11
12
13
# File 'lib/bcash/transaction.rb', line 8

def initialize(email = nil, token = nil, id_transaction = nil, id_order = nil)
  @email = email
  @token = token
  @id_transaction = id_transaction
  @id_order = id_order
end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/bcash/transaction.rb', line 5

def email
  @email
end

#id_orderObject

Returns the value of attribute id_order.



5
6
7
# File 'lib/bcash/transaction.rb', line 5

def id_order
  @id_order
end

#id_transactionObject

Returns the value of attribute id_transaction.



5
6
7
# File 'lib/bcash/transaction.rb', line 5

def id_transaction
  @id_transaction
end

#itemsObject (readonly)

Returns the value of attribute items.



6
7
8
# File 'lib/bcash/transaction.rb', line 6

def items
  @items
end

#tokenObject

Returns the value of attribute token.



5
6
7
# File 'lib/bcash/transaction.rb', line 5

def token
  @token
end

Instance Method Details

#getObject



16
17
18
19
20
21
# File 'lib/bcash/transaction.rb', line 16

def get
  transaction = Nokogiri::XML(get_transaction_url)
  self.instance_variables.each{|variable| raise Bcash::Errors::EmptyAttributes.new if self.instance_variable_get(variable).nil?}

  create_transaction_attrs(transaction) 
end