Class: Io::Flow::V0::Models::ExperienceForm

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

Overview

Experiences define a local experience for a given geographic region

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExperienceForm

Returns a new instance of ExperienceForm.



32022
32023
32024
32025
32026
32027
32028
32029
32030
32031
32032
32033
32034
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32022

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

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def currency
  @currency
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def delivered_duty
  @delivered_duty
end

#keyObject (readonly)

Returns the value of attribute key.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def key
  @key
end

#languageObject (readonly)

Returns the value of attribute language.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def language
  @language
end

#measurement_systemObject (readonly)

Returns the value of attribute measurement_system.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def measurement_system
  @measurement_system
end

#nameObject (readonly)

Returns the value of attribute name.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def name
  @name
end

#region_idObject (readonly)

Returns the value of attribute region_id.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def region_id
  @region_id
end

#subcatalog_idObject (readonly)

Returns the value of attribute subcatalog_id.



32020
32021
32022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32020

def subcatalog_id
  @subcatalog_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32040
32041
32042
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32040

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

#to_hashObject



32044
32045
32046
32047
32048
32049
32050
32051
32052
32053
32054
32055
32056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32044

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

#to_jsonObject



32036
32037
32038
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32036

def to_json
  JSON.dump(to_hash)
end