Class: Io::Flow::V0::Models::SessionForm

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ SessionForm

Returns a new instance of SessionForm.



30307
30308
30309
30310
30311
30312
30313
30314
30315
30316
30317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30307

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
  @experience = (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String))
  @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))
  @locale = (x = opts.delete(:locale); x.nil? ? nil : HttpClient::Preconditions.assert_class('locale', x, String))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
  @experiment = (x = opts.delete(:experiment); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::SessionExperiment) ? x : ::Io::Flow::V0::Models::SessionExperiment.new(x)))
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



30305
30306
30307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30305

def attributes
  @attributes
end

#countryObject (readonly)

Returns the value of attribute country.



30305
30306
30307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30305

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



30305
30306
30307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30305

def currency
  @currency
end

#experienceObject (readonly)

Returns the value of attribute experience.



30305
30306
30307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30305

def experience
  @experience
end

#experimentObject (readonly)

Returns the value of attribute experiment.



30305
30306
30307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30305

def experiment
  @experiment
end

#ipObject (readonly)

Returns the value of attribute ip.



30305
30306
30307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30305

def ip
  @ip
end

#languageObject (readonly)

Returns the value of attribute language.



30305
30306
30307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30305

def language
  @language
end

#localeObject (readonly)

Returns the value of attribute locale.



30305
30306
30307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30305

def locale
  @locale
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30323
30324
30325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30323

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

#to_hashObject



30327
30328
30329
30330
30331
30332
30333
30334
30335
30336
30337
30338
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30327

def to_hash
  {
    :ip => ip,
    :experience => experience,
    :country => country,
    :currency => currency,
    :language => language,
    :locale => locale,
    :attributes => attributes.nil? ? nil : attributes,
    :experiment => experiment.nil? ? nil : experiment.to_hash
  }
end

#to_jsonObject



30319
30320
30321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30319

def to_json
  JSON.dump(to_hash)
end