Class: Io::Flow::V0::Models::CatalogItemCountryStates

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 = {}) ⇒ CatalogItemCountryStates

Returns a new instance of CatalogItemCountryStates.



14338
14339
14340
14341
14342
14343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14338

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:country, :statuses], 'CatalogItemCountryStates')
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
  @statuses = HttpClient::Preconditions.assert_class('statuses', opts.delete(:statuses), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x)) }
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



14336
14337
14338
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14336

def country
  @country
end

#statusesObject (readonly)

Returns the value of attribute statuses.



14336
14337
14338
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14336

def statuses
  @statuses
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14349
14350
14351
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14349

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

#to_hashObject



14353
14354
14355
14356
14357
14358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14353

def to_hash
  {
    :country => country,
    :statuses => statuses.map { |o| o.value }
  }
end

#to_jsonObject



14345
14346
14347
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14345

def to_json
  JSON.dump(to_hash)
end