Class: Io::Flow::V0::Models::InventoryFollowEcommercePlatform

Inherits:
InventoryStrategy show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Items affected with rules pursuing an ecommerce platform strategy will always follow the ecommerce platform inventory

Instance Attribute Summary collapse

Attributes inherited from InventoryStrategy

#discriminator

Instance Method Summary collapse

Methods inherited from InventoryStrategy

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ InventoryFollowEcommercePlatform

Returns a new instance of InventoryFollowEcommercePlatform.



46194
46195
46196
46197
46198
46199
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46194

def initialize(incoming={})
  super(:discriminator => InventoryStrategy::Types::INVENTORY_FOLLOW_ECOMMERCE_PLATFORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:quantity], 'InventoryFollowEcommercePlatform')
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
end

Instance Attribute Details

#quantityObject (readonly)

Returns the value of attribute quantity.



46192
46193
46194
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46192

def quantity
  @quantity
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46205
46206
46207
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46205

def copy(incoming={})
  InventoryFollowEcommercePlatform.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



46209
46210
46211
46212
46213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46209

def subtype_to_hash
  {
    :quantity => quantity
  }
end

#to_jsonObject



46201
46202
46203
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46201

def to_json
  JSON.dump(to_hash)
end