Class: Io::Flow::V0::Models::OrganizationSession
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a session created for an organization. Primary method to select an experience for a given user session and ensure that experience does not change throughout the user’s activity. Provides authentication to objects created during this session (e.g. order).
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#experience ⇒ Object
readonly
Returns the value of attribute experience.
-
#experiment ⇒ Object
readonly
Returns the value of attribute experiment.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#geo ⇒ Object
readonly
Returns the value of attribute geo.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#local ⇒ Object
readonly
Returns the value of attribute local.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#visit ⇒ Object
readonly
Returns the value of attribute visit.
-
#visitor ⇒ Object
readonly
Returns the value of attribute visitor.
Attributes inherited from Session
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrganizationSession
constructor
A new instance of OrganizationSession.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Session
Constructor Details
#initialize(incoming = {}) ⇒ OrganizationSession
Returns a new instance of OrganizationSession.
33383 33384 33385 33386 33387 33388 33389 33390 33391 33392 33393 33394 33395 33396 33397 33398 33399 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33383 def initialize(incoming={}) super(:discriminator => Session::Types::ORGANIZATION_SESSION) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :organization, :visitor, :visit, :environment, :attributes], 'OrganizationSession') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String) @visitor = (x = opts.delete(:visitor); x.is_a?(::Io::Flow::V0::Models::SessionVisitor) ? x : ::Io::Flow::V0::Models::SessionVisitor.new(x)) @visit = (x = opts.delete(:visit); x.is_a?(::Io::Flow::V0::Models::SessionVisit) ? x : ::Io::Flow::V0::Models::SessionVisit.new(x)) @environment = (x = opts.delete(:environment); x.is_a?(::Io::Flow::V0::Models::Environment) ? x : ::Io::Flow::V0::Models::Environment.apply(x)) @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)) @local = (x = opts.delete(:local); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LocalSession) ? x : ::Io::Flow::V0::Models::LocalSession.new(x))) @geo = (x = opts.delete(:geo); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::SessionGeo) ? x : ::Io::Flow::V0::Models::SessionGeo.new(x))) @experience = (x = opts.delete(:experience); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExperienceGeo) ? x : ::Io::Flow::V0::Models::ExperienceGeo.new(x))) @format = (x = opts.delete(:format); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::SessionFormat) ? x : ::Io::Flow::V0::Models::SessionFormat.new(x))) @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
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def attributes @attributes end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def environment @environment end |
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def experience @experience end |
#experiment ⇒ Object (readonly)
Returns the value of attribute experiment.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def experiment @experiment end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def format @format end |
#geo ⇒ Object (readonly)
Returns the value of attribute geo.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def geo @geo end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def id @id end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def ip @ip end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def local @local end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def organization @organization end |
#visit ⇒ Object (readonly)
Returns the value of attribute visit.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def visit @visit end |
#visitor ⇒ Object (readonly)
Returns the value of attribute visitor.
33381 33382 33383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33381 def visitor @visitor end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
33405 33406 33407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33405 def copy(incoming={}) OrganizationSession.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
33409 33410 33411 33412 33413 33414 33415 33416 33417 33418 33419 33420 33421 33422 33423 33424 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33409 def subtype_to_hash { :id => id, :organization => organization, :visitor => visitor.to_hash, :visit => visit.to_hash, :environment => environment.value, :attributes => attributes, :ip => ip, :local => local.nil? ? nil : local.to_hash, :geo => geo.nil? ? nil : geo.to_hash, :experience => experience.nil? ? nil : experience.to_hash, :format => format.nil? ? nil : format.to_hash, :experiment => experiment.nil? ? nil : experiment.to_hash } end |
#to_json ⇒ Object
33401 33402 33403 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33401 def to_json JSON.dump(to_hash) end |