Class: Redex::Response::QueryResponse

Inherits:
BaseResponse show all
Defined in:
lib/redex/response/query_response.rb

Instance Attribute Summary collapse

Attributes inherited from BaseResponse

#raw

Instance Method Summary collapse

Methods inherited from BaseResponse

#datetime_sanitize

Constructor Details

#initialize(httpi_response) ⇒ QueryResponse

Returns a new instance of QueryResponse.



8
9
10
# File 'lib/redex/response/query_response.rb', line 8

def initialize(httpi_response)
	super(httpi_response["REGISTRO"])
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def amount
  @amount
end

#canceled_atObject (readonly)

Returns the value of attribute canceled_at.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def canceled_at
  @canceled_at
end

#card_expiration_monthObject (readonly)

Returns the value of attribute card_expiration_month.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def card_expiration_month
  @card_expiration_month
end

#card_holder_nameObject (readonly)

Returns the value of attribute card_holder_name.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def card_holder_name
  @card_holder_name
end

#card_numberObject (readonly)

Returns the value of attribute card_number.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def card_number
  @card_number
end

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def code
  @code
end

#credit_card_authorization_idObject (readonly)

Returns the value of attribute credit_card_authorization_id.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def credit_card_authorization_id
  @credit_card_authorization_id
end

#installmentsObject (readonly)

Returns the value of attribute installments.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def installments
  @installments
end

#invoice_noteObject (readonly)

Returns the value of attribute invoice_note.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def invoice_note
  @invoice_note
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def message
  @message
end

#order_idObject (readonly)

Returns the value of attribute order_id.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def order_id
  @order_id
end

#originObject (readonly)

Returns the value of attribute origin.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def origin
  @origin
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def status
  @status
end

#transaction_created_atObject (readonly)

Returns the value of attribute transaction_created_at.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def transaction_created_at
  @transaction_created_at
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def transaction_id
  @transaction_id
end

#transaction_typeObject (readonly)

Returns the value of attribute transaction_type.



4
5
6
# File 'lib/redex/response/query_response.rb', line 4

def transaction_type
  @transaction_type
end

Instance Method Details

#clear(httpi_result) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/redex/response/query_response.rb', line 77

def clear(httpi_result)
	httpi_result = httpi_result.first
	httpi_result.delete("AVS")
	httpi_result = Hash[httpi_result.map { |k, v| [k.to_sym, v] }]
	httpi_result.select! {|k,v| v != [{}] && v!= [{"i:nil"=>"true"}]}
	httpi_result.each { |k, v| httpi_result[k] = v.first }
end

#sequential_idObject



32
33
34
# File 'lib/redex/response/query_response.rb', line 32

def sequential_id
	@sequential_id ||= @raw[:NUMSQN].to_i
end

#transaction_canceled_atObject



72
73
74
# File 'lib/redex/response/query_response.rb', line 72

def transaction_canceled_at
	@transaction_canceled_at ||= datetime_sanitize(@raw[:DATA], "00:00:00")
end