Class: Io::Flow::V0::Models::OrganizationSession
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#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.
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.
20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20740 def initialize(incoming={}) super(:discriminator => Session::Types::ORGANIZATION_SESSION) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :organization, :environment, :attributes], 'OrganizationSession') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String) @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))) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
20738 20739 20740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20738 def attributes @attributes end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
20738 20739 20740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20738 def environment @environment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20738 20739 20740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20738 def id @id end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
20738 20739 20740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20738 def ip @ip end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
20738 20739 20740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20738 def local @local end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
20738 20739 20740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20738 def organization @organization end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20756 20757 20758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20756 def copy(incoming={}) OrganizationSession.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
20760 20761 20762 20763 20764 20765 20766 20767 20768 20769 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20760 def subtype_to_hash { :id => id, :organization => organization, :environment => environment.value, :attributes => attributes, :ip => ip, :local => local.nil? ? nil : local.to_hash } end |
#to_json ⇒ Object
20752 20753 20754 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20752 def to_json JSON.dump(to_hash) end |