Class: ReactiveShipping::AddressValidationResponse
- Defined in:
- lib/reactive_shipping/address_validation_response.rb
Overview
Response object class for calls to Carrier#validate_address.
Instance Attribute Summary collapse
-
#candidate_addresses ⇒ Object
readonly
Returns the value of attribute candidate_addresses.
-
#classification ⇒ Object
readonly
Returns the value of attribute classification.
-
#location ⇒ String
The Location to be validated.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#validity ⇒ Object
readonly
Returns the value of attribute validity.
Attributes inherited from Response
#message, #request, #test, #xml
Instance Method Summary collapse
- #address_match? ⇒ Boolean
- #commercial? ⇒ Boolean
-
#initialize(success, message, params = {}, options = {}) ⇒ AddressValidationResponse
constructor
A new instance of AddressValidationResponse.
- #residential? ⇒ Boolean
Methods inherited from Response
Constructor Details
#initialize(success, message, params = {}, options = {}) ⇒ AddressValidationResponse
Returns a new instance of AddressValidationResponse.
11 12 13 14 15 16 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 11 def initialize(success, , params = {}, = {}) @validity = [:validity] @candidate_addresses = [:candidate_addresses] @classification = [:classification] super end |
Instance Attribute Details
#candidate_addresses ⇒ Object (readonly)
Returns the value of attribute candidate_addresses.
9 10 11 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 9 def candidate_addresses @candidate_addresses end |
#classification ⇒ Object (readonly)
Returns the value of attribute classification.
9 10 11 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 9 def classification @classification end |
#location ⇒ String
The Location to be validated
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 8 class AddressValidationResponse < Response attr_reader :validity, :classification, :candidate_addresses, :options, :params def initialize(success, , params = {}, = {}) @validity = [:validity] @candidate_addresses = [:candidate_addresses] @classification = [:classification] super end def address_match? @validity == :valid end def residential? @classification == :residential end def commercial? @classification == :commercial end end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 9 def @options end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
9 10 11 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 9 def params @params end |
#validity ⇒ Object (readonly)
Returns the value of attribute validity.
9 10 11 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 9 def validity @validity end |
Instance Method Details
#address_match? ⇒ Boolean
18 19 20 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 18 def address_match? @validity == :valid end |
#commercial? ⇒ Boolean
26 27 28 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 26 def commercial? @classification == :commercial end |
#residential? ⇒ Boolean
22 23 24 |
# File 'lib/reactive_shipping/address_validation_response.rb', line 22 def residential? @classification == :residential end |