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.
20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20528 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.
20526 20527 20528 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20526 def attributes @attributes end |
#cart ⇒ Object (readonly)
Returns the value of attribute cart.
20526 20527 20528 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20526 def cart @cart end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20526 20527 20528 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20526 def id @id end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
20526 20527 20528 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20526 def local @local end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
20526 20527 20528 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20526 def organization @organization end |
#shop ⇒ Object (readonly)
Returns the value of attribute shop.
20526 20527 20528 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20526 def shop @shop end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20544 20545 20546 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20544 def copy(incoming={}) ShopifySession.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20548 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
20540 20541 20542 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20540 def to_json JSON.dump(to_hash) end |