Class: CardConnect::Service::BinResponse
- Inherits:
-
Object
- Object
- CardConnect::Service::BinResponse
- Includes:
- Utils
- Defined in:
- lib/cardconnect/services/bin/bin_response.rb
Constant Summary collapse
- FIELDS =
[ :country, :cardusestring, :gsa, :product, :corporate, :fsa, :subtype, :purchase, :prepaid, :binlo, :issuer, :binhi ].freeze
- BIN_INFO_NOT_FOUND =
Error messages
'No bin information found'
- TOKEN_NOT_FOUND =
'Token not found'
- BIN_NOT_ENABLED =
'Bin feature not enabled for merchant'
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(response) ⇒ BinResponse
constructor
A new instance of BinResponse.
- #success? ⇒ Boolean
Methods included from Utils
#set_attributes, #symbolize_keys
Constructor Details
#initialize(response) ⇒ BinResponse
Returns a new instance of BinResponse.
20 21 22 23 24 25 |
# File 'lib/cardconnect/services/bin/bin_response.rb', line 20 def initialize(response) set_attributes(response, FIELDS) # raise [response, self].inspect @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
18 19 20 |
# File 'lib/cardconnect/services/bin/bin_response.rb', line 18 def errors @errors end |
Instance Method Details
#body ⇒ Object
31 32 33 |
# File 'lib/cardconnect/services/bin/bin_response.rb', line 31 def body FIELDS.collect{|attr| {attr => send(attr)} }.reduce({}, :merge) end |
#success? ⇒ Boolean
27 28 29 |
# File 'lib/cardconnect/services/bin/bin_response.rb', line 27 def success? @errors.empty? end |