Class: Kount::Response
- Inherits:
-
AbstractResponse
- Object
- AbstractResponse
- Kount::Response
- Defined in:
- lib/kount/response.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#creation_date_time ⇒ Object
Returns the value of attribute creation_date_time.
-
#device_session_id ⇒ Object
Returns the value of attribute device_session_id.
-
#fulfillment ⇒ Object
Returns the value of attribute fulfillment.
-
#merchant_order_id ⇒ Object
Returns the value of attribute merchant_order_id.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#risk_inquiry ⇒ Object
Returns the value of attribute risk_inquiry.
-
#transactions ⇒ Object
Returns the value of attribute transactions.
Instance Method Summary collapse
- #approved? ⇒ Boolean
-
#initialize(data) ⇒ Response
constructor
A new instance of Response.
- #ok? ⇒ Boolean
- #to_hash ⇒ Object
Constructor Details
#initialize(data) ⇒ Response
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kount/response.rb', line 9 def initialize(data) @data = data if (order = @data["order"]) @order_id = order["order_id"] @merchant_order_id = order["merchant_order_id"] @channel = order["channel"] @device_session_id = order["device_session_id"] @creation_date_time = order["creation_date_time"] @risk_inquiry = RiskInquiry.new(order["risk_inquiry"] || {}) @transactions = (order["transactions"] || []).map { |t| Transaction.new(t) } else @data end end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
5 6 7 |
# File 'lib/kount/response.rb', line 5 def channel @channel end |
#creation_date_time ⇒ Object
Returns the value of attribute creation_date_time.
5 6 7 |
# File 'lib/kount/response.rb', line 5 def creation_date_time @creation_date_time end |
#device_session_id ⇒ Object
Returns the value of attribute device_session_id.
5 6 7 |
# File 'lib/kount/response.rb', line 5 def device_session_id @device_session_id end |
#fulfillment ⇒ Object
Returns the value of attribute fulfillment.
5 6 7 |
# File 'lib/kount/response.rb', line 5 def fulfillment @fulfillment end |
#merchant_order_id ⇒ Object
Returns the value of attribute merchant_order_id.
5 6 7 |
# File 'lib/kount/response.rb', line 5 def merchant_order_id @merchant_order_id end |
#order_id ⇒ Object
Returns the value of attribute order_id.
5 6 7 |
# File 'lib/kount/response.rb', line 5 def order_id @order_id end |
#risk_inquiry ⇒ Object
Returns the value of attribute risk_inquiry.
5 6 7 |
# File 'lib/kount/response.rb', line 5 def risk_inquiry @risk_inquiry end |
#transactions ⇒ Object
Returns the value of attribute transactions.
5 6 7 |
# File 'lib/kount/response.rb', line 5 def transactions @transactions end |
Instance Method Details
#approved? ⇒ Boolean
33 34 35 |
# File 'lib/kount/response.rb', line 33 def approved? !!@risk_inquiry&.approved? end |
#ok? ⇒ Boolean
29 30 31 |
# File 'lib/kount/response.rb', line 29 def ok? true end |
#to_hash ⇒ Object
25 26 27 |
# File 'lib/kount/response.rb', line 25 def to_hash @data end |