Class: Io::Flow::V0::Models::AddressConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AddressConfiguration



20752
20753
20754
20755
20756
20757
20758
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20752

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)) }
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



20750
20751
20752
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20750

def country
  @country
end

#field_validationObject (readonly)

Returns the value of attribute field_validation.



20750
20751
20752
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20750

def field_validation
  @field_validation
end

#provincesObject (readonly)

Returns the value of attribute provinces.



20750
20751
20752
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20750

def provinces
  @provinces
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



20764
20765
20766
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20764

def copy(incoming={})
  AddressConfiguration.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



20768
20769
20770
20771
20772
20773
20774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20768

def to_hash
  {
    :country => country,
    :field_validation => field_validation.to_hash,
    :provinces => provinces.map { |o| o.to_hash }
  }
end

#to_jsonObject



20760
20761
20762
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20760

def to_json
  JSON.dump(to_hash)
end