Class: CardConnect::Service::VoidResponse
- Inherits:
-
Object
- Object
- CardConnect::Service::VoidResponse
- Includes:
- Utils
- Defined in:
- lib/cardconnect/services/void/void_response.rb
Constant Summary collapse
- FIELDS =
[:merchid, :amount, :currency, :retref, :authcode, :respcode, :respproc, :respstat, :resptext].freeze
- STATUS_APPROVED =
'A'.freeze
- STATUS_RETRY =
'B'.freeze
- STATUS_DECLINED =
'C'.freeze
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(response) ⇒ VoidResponse
constructor
A new instance of VoidResponse.
- #success? ⇒ Boolean
Methods included from Utils
#set_attributes, #symbolize_keys
Constructor Details
#initialize(response) ⇒ VoidResponse
Returns a new instance of VoidResponse.
16 17 18 19 20 |
# File 'lib/cardconnect/services/void/void_response.rb', line 16 def initialize(response) set_attributes(response, FIELDS) @errors = [] process_errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
10 11 12 |
# File 'lib/cardconnect/services/void/void_response.rb', line 10 def errors @errors end |
Instance Method Details
#body ⇒ Object
26 27 28 |
# File 'lib/cardconnect/services/void/void_response.rb', line 26 def body FIELDS.collect{|attr| {attr => send(attr)} }.reduce({}, :merge) end |
#success? ⇒ Boolean
22 23 24 |
# File 'lib/cardconnect/services/void/void_response.rb', line 22 def success? errors.empty? end |