Class: Io::Flow::V0::Models::LocalSession

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

Overview

If we found an experience for the given session, the localized information will be presented here

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LocalSession

Returns a new instance of LocalSession.



15677
15678
15679
15680
15681
15682
15683
15684
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15677

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:country, :currency, :language, :experience], 'LocalSession')
  @country = (x = opts.delete(:country); x.is_a?(::Io::Flow::V0::Models::Country) ? x : ::Io::Flow::V0::Models::Country.new(x))
  @currency = (x = opts.delete(:currency); x.is_a?(::Io::Flow::V0::Models::Currency) ? x : ::Io::Flow::V0::Models::Currency.new(x))
  @language = (x = opts.delete(:language); x.is_a?(::Io::Flow::V0::Models::Language) ? x : ::Io::Flow::V0::Models::Language.new(x))
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceKeyReference) ? x : ::Io::Flow::V0::Models::ExperienceKeyReference.new(x))
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



15675
15676
15677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15675

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



15675
15676
15677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15675

def currency
  @currency
end

#experienceObject (readonly)

Returns the value of attribute experience.



15675
15676
15677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15675

def experience
  @experience
end

#languageObject (readonly)

Returns the value of attribute language.



15675
15676
15677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15675

def language
  @language
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15690
15691
15692
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15690

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

#to_hashObject



15694
15695
15696
15697
15698
15699
15700
15701
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15694

def to_hash
  {
    :country => country.to_hash,
    :currency => currency.to_hash,
    :language => language.to_hash,
    :experience => experience.to_hash
  }
end

#to_jsonObject



15686
15687
15688
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15686

def to_json
  JSON.dump(to_hash)
end