Class: AlphaCard::AlphaCardResponse
- Defined in:
- lib/alpha_card/alpha_card_response.rb
Constant Summary collapse
- APPROVED =
'1'- DECLINED =
'2'- ERROR =
'3'
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #code ⇒ Object
- #declined? ⇒ Boolean
- #error? ⇒ Boolean
-
#initialize(request_body) ⇒ AlphaCardResponse
constructor
A new instance of AlphaCardResponse.
- #success? ⇒ Boolean
- #text ⇒ Object
- #transaction_id ⇒ Object
Constructor Details
#initialize(request_body) ⇒ AlphaCardResponse
Returns a new instance of AlphaCardResponse.
9 10 11 |
# File 'lib/alpha_card/alpha_card_response.rb', line 9 def initialize(request_body) @data = Rack::Utils.parse_nested_query(request_body) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/alpha_card/alpha_card_response.rb', line 3 def data @data end |
Instance Method Details
#code ⇒ Object
21 22 23 |
# File 'lib/alpha_card/alpha_card_response.rb', line 21 def code @data['response_code'] end |
#declined? ⇒ Boolean
29 30 31 |
# File 'lib/alpha_card/alpha_card_response.rb', line 29 def declined? @data['response'] == DECLINED end |
#error? ⇒ Boolean
33 34 35 |
# File 'lib/alpha_card/alpha_card_response.rb', line 33 def error? @data['response'] == ERROR end |
#success? ⇒ Boolean
25 26 27 |
# File 'lib/alpha_card/alpha_card_response.rb', line 25 def success? @data['response'] == APPROVED end |
#text ⇒ Object
13 14 15 |
# File 'lib/alpha_card/alpha_card_response.rb', line 13 def text @data['responsetext'] end |
#transaction_id ⇒ Object
17 18 19 |
# File 'lib/alpha_card/alpha_card_response.rb', line 17 def transaction_id @data['transactionid'] end |