Class: AddressValidate::API::Response
- Inherits:
-
Object
- Object
- AddressValidate::API::Response
- Defined in:
- lib/address_validate/api/response.rb
Instance Attribute Summary collapse
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
Instance Method Summary collapse
- #data ⇒ Object
- #error ⇒ Object
-
#initialize(response_body) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
- #warning ⇒ Object
Constructor Details
#initialize(response_body) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/address_validate/api/response.rb', line 6 def initialize(response_body) @response_body = Ox.parse(response_body) end |
Instance Attribute Details
#response_body ⇒ Object (readonly)
Returns the value of attribute response_body.
4 5 6 |
# File 'lib/address_validate/api/response.rb', line 4 def response_body @response_body end |
Instance Method Details
#data ⇒ Object
18 19 20 |
# File 'lib/address_validate/api/response.rb', line 18 def data @data ||= errors ? {} : parse_data end |
#error ⇒ Object
14 15 16 |
# File 'lib/address_validate/api/response.rb', line 14 def error AddressValidate::API::Error.new(errors) if errors end |
#success? ⇒ Boolean
10 11 12 |
# File 'lib/address_validate/api/response.rb', line 10 def success? errors.nil? end |
#warning ⇒ Object
22 23 24 |
# File 'lib/address_validate/api/response.rb', line 22 def warning get_field('ReturnText') end |