Class: Io::Flow::V0::Models::ShopifySession
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#cart ⇒ Object
readonly
Returns the value of attribute cart.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#local ⇒ Object
readonly
Returns the value of attribute local.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#shop ⇒ Object
readonly
Returns the value of attribute shop.
Attributes inherited from Session
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifySession
constructor
A new instance of ShopifySession.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Session
Constructor Details
#initialize(incoming = {}) ⇒ ShopifySession
Returns a new instance of ShopifySession.
20378 20379 20380 20381 20382 20383 20384 20385 20386 20387 20388 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20378 def initialize(incoming={}) super(:discriminator => Session::Types::SHOPIFY_SESSION) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :organization, :attributes, :shop, :cart], 'ShopifySession') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String) @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 } @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))) @shop = HttpClient::Preconditions.assert_class('shop', opts.delete(:shop), String) @cart = (x = opts.delete(:cart); x.is_a?(::Io::Flow::V0::Models::CartReference) ? x : ::Io::Flow::V0::Models::CartReference.new(x)) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
20376 20377 20378 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20376 def attributes @attributes end |
#cart ⇒ Object (readonly)
Returns the value of attribute cart.
20376 20377 20378 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20376 def cart @cart end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20376 20377 20378 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20376 def id @id end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
20376 20377 20378 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20376 def local @local end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
20376 20377 20378 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20376 def organization @organization end |
#shop ⇒ Object (readonly)
Returns the value of attribute shop.
20376 20377 20378 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20376 def shop @shop end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20394 20395 20396 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20394 def copy(incoming={}) ShopifySession.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
20398 20399 20400 20401 20402 20403 20404 20405 20406 20407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20398 def subtype_to_hash { :id => id, :organization => organization, :attributes => attributes, :local => local.nil? ? nil : local.to_hash, :shop => shop, :cart => cart.to_hash } end |
#to_json ⇒ Object
20390 20391 20392 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20390 def to_json JSON.dump(to_hash) end |