Class: Io::Flow::V0::Models::ExperienceGeo

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

Overview

Experience Geo summarizes an experience along with geographic info

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExperienceGeo

Returns a new instance of ExperienceGeo.



32065
32066
32067
32068
32069
32070
32071
32072
32073
32074
32075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32065

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key, :name, :region, :country, :currency, :language, :measurement_system], 'ExperienceGeo')
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @region = (x = opts.delete(:region); x.is_a?(::Io::Flow::V0::Models::RegionReference) ? x : ::Io::Flow::V0::Models::RegionReference.new(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.



32063
32064
32065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32063

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



32063
32064
32065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32063

def currency
  @currency
end

#keyObject (readonly)

Returns the value of attribute key.



32063
32064
32065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32063

def key
  @key
end

#languageObject (readonly)

Returns the value of attribute language.



32063
32064
32065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32063

def language
  @language
end

#measurement_systemObject (readonly)

Returns the value of attribute measurement_system.



32063
32064
32065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32063

def measurement_system
  @measurement_system
end

#nameObject (readonly)

Returns the value of attribute name.



32063
32064
32065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32063

def name
  @name
end

#regionObject (readonly)

Returns the value of attribute region.



32063
32064
32065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32063

def region
  @region
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32081
32082
32083
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32081

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

#to_hashObject



32085
32086
32087
32088
32089
32090
32091
32092
32093
32094
32095
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32085

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

#to_jsonObject



32077
32078
32079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32077

def to_json
  JSON.dump(to_hash)
end