Class: Io::Flow::V0::Models::AddressConfiguration
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AddressConfiguration
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#field_validation ⇒ Object
readonly
Returns the value of attribute field_validation.
-
#formats ⇒ Object
readonly
Returns the value of attribute formats.
-
#postal_type ⇒ Object
readonly
Returns the value of attribute postal_type.
-
#province_type ⇒ Object
readonly
Returns the value of attribute province_type.
-
#provinces ⇒ Object
readonly
Returns the value of attribute provinces.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AddressConfiguration
constructor
A new instance of AddressConfiguration.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AddressConfiguration
Returns a new instance of AddressConfiguration.
27365 27366 27367 27368 27369 27370 27371 27372 27373 27374 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27365 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:country, :field_validation], 'AddressConfiguration') @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String) @field_validation = (x = opts.delete(:field_validation); x.is_a?(::Io::Flow::V0::Models::AddressFieldValidation) ? x : ::Io::Flow::V0::Models::AddressFieldValidation.new(x)) @provinces = HttpClient::Preconditions.assert_class('provinces', (x = opts.delete(:provinces); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AddressConfigurationProvince) ? x : ::Io::Flow::V0::Models::AddressConfigurationProvince.new(x)) } @formats = HttpClient::Preconditions.assert_class('formats', (x = opts.delete(:formats); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AddressConfigurationFormat) ? x : ::Io::Flow::V0::Models::AddressConfigurationFormat.new(x)) } @province_type = (x = opts.delete(:province_type); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ProvinceType) ? x : ::Io::Flow::V0::Models::ProvinceType.apply(x))) @postal_type = (x = opts.delete(:postal_type); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PostalType) ? x : ::Io::Flow::V0::Models::PostalType.apply(x))) end |
Instance Attribute Details
#country ⇒ Object (readonly)
Returns the value of attribute country.
27363 27364 27365 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27363 def country @country end |
#field_validation ⇒ Object (readonly)
Returns the value of attribute field_validation.
27363 27364 27365 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27363 def field_validation @field_validation end |
#formats ⇒ Object (readonly)
Returns the value of attribute formats.
27363 27364 27365 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27363 def formats @formats end |
#postal_type ⇒ Object (readonly)
Returns the value of attribute postal_type.
27363 27364 27365 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27363 def postal_type @postal_type end |
#province_type ⇒ Object (readonly)
Returns the value of attribute province_type.
27363 27364 27365 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27363 def province_type @province_type end |
#provinces ⇒ Object (readonly)
Returns the value of attribute provinces.
27363 27364 27365 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27363 def provinces @provinces end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
27380 27381 27382 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27380 def copy(incoming={}) AddressConfiguration.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
27384 27385 27386 27387 27388 27389 27390 27391 27392 27393 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27384 def to_hash { :country => country, :field_validation => field_validation.to_hash, :provinces => provinces.map { |o| o.to_hash }, :formats => formats.map { |o| o.to_hash }, :province_type => province_type.nil? ? nil : province_type.value, :postal_type => postal_type.nil? ? nil : postal_type.value } end |
#to_json ⇒ Object
27376 27377 27378 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27376 def to_json JSON.dump(to_hash) end |