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.



15598
15599
15600
15601
15602
15603
15604
15605
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15598

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::SessionExperienceReference) ? x : ::Io::Flow::V0::Models::SessionExperienceReference.new(x))
end

Instance Attribute Details

#country ⇒ Object (readonly)

Returns the value of attribute country.



15596
15597
15598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15596

def country
  @country
end

#currency ⇒ Object (readonly)

Returns the value of attribute currency.



15596
15597
15598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15596

def currency
  @currency
end

#experience ⇒ Object (readonly)

Returns the value of attribute experience.



15596
15597
15598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15596

def experience
  @experience
end

#language ⇒ Object (readonly)

Returns the value of attribute language.



15596
15597
15598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15596

def language
  @language
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15611
15612
15613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15611

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

#to_hash ⇒ Object



15615
15616
15617
15618
15619
15620
15621
15622
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15615

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

#to_json ⇒ Object



15607
15608
15609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15607

def to_json
  JSON.dump(to_hash)
end