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

Returns a new instance of AddressConfiguration.



21137
21138
21139
21140
21141
21142
21143
21144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21137

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

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



21135
21136
21137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21135

def country
  @country
end

#field_validationObject (readonly)

Returns the value of attribute field_validation.



21135
21136
21137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21135

def field_validation
  @field_validation
end

#formatsObject (readonly)

Returns the value of attribute formats.



21135
21136
21137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21135

def formats
  @formats
end

#provincesObject (readonly)

Returns the value of attribute provinces.



21135
21136
21137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21135

def provinces
  @provinces
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21150
21151
21152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21150

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

#to_hashObject



21154
21155
21156
21157
21158
21159
21160
21161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21154

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

#to_jsonObject



21146
21147
21148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21146

def to_json
  JSON.dump(to_hash)
end