Class: Io::Flow::V0::Models::InventoryStrategy

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

Overview

Types of rules used to apply on inventory to calculate available quantity

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ InventoryStrategy

Returns a new instance of InventoryStrategy.



5021
5022
5023
5024
5025
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5021

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:discriminator], 'InventoryStrategy')
  @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
end

Instance Attribute Details

#discriminator ⇒ Object (readonly)

Returns the value of attribute discriminator.



5019
5020
5021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5019

def discriminator
  @discriminator
end

Instance Method Details

#subtype_to_hash ⇒ Object



5027
5028
5029
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5027

def subtype_to_hash
  raise 'Cannot serialize an instance of inventory_strategy directly - must use one of the specific types: inventory_backorder, inventory_stock, inventory_unlimited'
end

#to_hash ⇒ Object



5031
5032
5033
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5031

def to_hash
  subtype_to_hash.merge(:discriminator => @discriminator)
end