Class: Io::Flow::V0::Models::ShopifyCartItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyCartItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#gift_card ⇒ Object
readonly
Returns the value of attribute gift_card.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#line_price ⇒ Object
readonly
Returns the value of attribute line_price.
-
#local ⇒ Object
readonly
Returns the value of attribute local.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#product_description ⇒ Object
readonly
Returns the value of attribute product_description.
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
-
#product_title ⇒ Object
readonly
Returns the value of attribute product_title.
-
#product_type ⇒ Object
readonly
Returns the value of attribute product_type.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#requires_shipping ⇒ Object
readonly
Returns the value of attribute requires_shipping.
-
#sku ⇒ Object
readonly
Returns the value of attribute sku.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#variant_id ⇒ Object
readonly
Returns the value of attribute variant_id.
-
#variant_options ⇒ Object
readonly
Returns the value of attribute variant_options.
-
#variant_title ⇒ Object
readonly
Returns the value of attribute variant_title.
-
#vendor ⇒ Object
readonly
Returns the value of attribute vendor.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifyCartItem
constructor
A new instance of ShopifyCartItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyCartItem
Returns a new instance of ShopifyCartItem.
37051 37052 37053 37054 37055 37056 37057 37058 37059 37060 37061 37062 37063 37064 37065 37066 37067 37068 37069 37070 37071 37072 37073 37074 37075 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37051 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :handle, :line_price, :price, :product_id, :product_title, :quantity, :title, :url, :variant_id, :local], 'ShopifyCartItem') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @handle = HttpClient::Preconditions.assert_class('handle', opts.delete(:handle), String) @line_price = HttpClient::Preconditions.assert_class('line_price', opts.delete(:line_price), Numeric) @price = HttpClient::Preconditions.assert_class('price', opts.delete(:price), Integer) @product_id = HttpClient::Preconditions.assert_class('product_id', opts.delete(:product_id), Integer) @product_title = HttpClient::Preconditions.assert_class('product_title', opts.delete(:product_title), String) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @title = HttpClient::Preconditions.assert_class('title', opts.delete(:title), String) @url = HttpClient::Preconditions.assert_class('url', opts.delete(:url), String) @variant_id = HttpClient::Preconditions.assert_class('variant_id', opts.delete(:variant_id), Integer) @local = (x = opts.delete(:local); x.is_a?(::Io::Flow::V0::Models::ShopifyLocalCartItemMetadata) ? x : ::Io::Flow::V0::Models::ShopifyLocalCartItemMetadata.new(x)) @gift_card = HttpClient::Preconditions.assert_boolean('gift_card', (x = opts.delete(:gift_card); x.nil? ? false : x)) @image = (x = opts.delete(:image); x.nil? ? nil : HttpClient::Preconditions.assert_class('image', x, String)) @product_description = (x = opts.delete(:product_description); x.nil? ? nil : HttpClient::Preconditions.assert_class('product_description', x, String)) @product_type = (x = opts.delete(:product_type); x.nil? ? nil : HttpClient::Preconditions.assert_class('product_type', x, String)) @properties = (x = opts.delete(:properties); x.nil? ? nil : HttpClient::Preconditions.assert_class('properties', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('properties', d[1], String); h }) @requires_shipping = HttpClient::Preconditions.assert_boolean('requires_shipping', (x = opts.delete(:requires_shipping); x.nil? ? true : x)) @sku = (x = opts.delete(:sku); x.nil? ? nil : HttpClient::Preconditions.assert_class('sku', x, String)) @variant_title = (x = opts.delete(:variant_title); x.nil? ? nil : HttpClient::Preconditions.assert_class('variant_title', x, String)) = (x = opts.delete(:variant_options); x.nil? ? nil : HttpClient::Preconditions.assert_class('variant_options', x, Array).map { |v| HttpClient::Preconditions.assert_class('variant_options', v, String) }) @vendor = (x = opts.delete(:vendor); x.nil? ? nil : HttpClient::Preconditions.assert_class('vendor', x, String)) end |
Instance Attribute Details
#gift_card ⇒ Object (readonly)
Returns the value of attribute gift_card.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def gift_card @gift_card end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def handle @handle end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def id @id end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def image @image end |
#line_price ⇒ Object (readonly)
Returns the value of attribute line_price.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def line_price @line_price end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def local @local end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def price @price end |
#product_description ⇒ Object (readonly)
Returns the value of attribute product_description.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def product_description @product_description end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def product_id @product_id end |
#product_title ⇒ Object (readonly)
Returns the value of attribute product_title.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def product_title @product_title end |
#product_type ⇒ Object (readonly)
Returns the value of attribute product_type.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def product_type @product_type end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def properties @properties end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def quantity @quantity end |
#requires_shipping ⇒ Object (readonly)
Returns the value of attribute requires_shipping.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def requires_shipping @requires_shipping end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def sku @sku end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def url @url end |
#variant_id ⇒ Object (readonly)
Returns the value of attribute variant_id.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def variant_id @variant_id end |
#variant_options ⇒ Object (readonly)
Returns the value of attribute variant_options.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def end |
#variant_title ⇒ Object (readonly)
Returns the value of attribute variant_title.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def variant_title @variant_title end |
#vendor ⇒ Object (readonly)
Returns the value of attribute vendor.
37049 37050 37051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37049 def vendor @vendor end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
37081 37082 37083 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37081 def copy(incoming={}) ShopifyCartItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
37085 37086 37087 37088 37089 37090 37091 37092 37093 37094 37095 37096 37097 37098 37099 37100 37101 37102 37103 37104 37105 37106 37107 37108 37109 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37085 def to_hash { :id => id, :handle => handle, :line_price => line_price, :price => price, :product_id => product_id, :product_title => product_title, :quantity => quantity, :title => title, :url => url, :variant_id => variant_id, :local => local.to_hash, :gift_card => gift_card, :image => image, :product_description => product_description, :product_type => product_type, :properties => properties.nil? ? nil : properties, :requires_shipping => requires_shipping, :sku => sku, :variant_title => variant_title, :variant_options => .nil? ? nil : , :vendor => vendor } end |
#to_json ⇒ Object
37077 37078 37079 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37077 def to_json JSON.dump(to_hash) end |