Class: Io::Flow::V0::Models::ExperienceDefaults

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

Overview

Defines a set of defaults for a given organization and region

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExperienceDefaults

Returns a new instance of ExperienceDefaults.



38455
38456
38457
38458
38459
38460
38461
38462
38463
38464
38465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38455

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key, :name, :delivered_duty, :country, :currency, :language, :measurement_system], 'ExperienceDefaults')
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @delivered_duty = (x = opts.delete(:delivered_duty); x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x))
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @language = HttpClient::Preconditions.assert_class('language', opts.delete(:language), String)
  @measurement_system = (x = opts.delete(:measurement_system); x.is_a?(::Io::Flow::V0::Models::MeasurementSystem) ? x : ::Io::Flow::V0::Models::MeasurementSystem.apply(x))
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



38453
38454
38455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38453

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



38453
38454
38455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38453

def currency
  @currency
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



38453
38454
38455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38453

def delivered_duty
  @delivered_duty
end

#keyObject (readonly)

Returns the value of attribute key.



38453
38454
38455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38453

def key
  @key
end

#languageObject (readonly)

Returns the value of attribute language.



38453
38454
38455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38453

def language
  @language
end

#measurement_systemObject (readonly)

Returns the value of attribute measurement_system.



38453
38454
38455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38453

def measurement_system
  @measurement_system
end

#nameObject (readonly)

Returns the value of attribute name.



38453
38454
38455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38453

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38471
38472
38473
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38471

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

#to_hashObject



38475
38476
38477
38478
38479
38480
38481
38482
38483
38484
38485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38475

def to_hash
  {
    :key => key,
    :name => name,
    :delivered_duty => delivered_duty.value,
    :country => country,
    :currency => currency,
    :language => language,
    :measurement_system => measurement_system.value
  }
end

#to_jsonObject



38467
38468
38469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38467

def to_json
  JSON.dump(to_hash)
end