Class: SpreeCmCommissioner::CachedInventoryItem
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::CachedInventoryItem
- Defined in:
- lib/spree_cm_commissioner/cached_inventory_item.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#inventory_item_id ⇒ Object
readonly
Returns the value of attribute inventory_item_id.
-
#inventory_key ⇒ Object
readonly
Returns the value of attribute inventory_key.
-
#quantity_available ⇒ Object
readonly
Returns the value of attribute quantity_available.
-
#variant_id ⇒ Object
readonly
Returns the value of attribute variant_id.
Instance Method Summary collapse
- #active? ⇒ Boolean
-
#initialize(inventory_key:, active:, quantity_available:, inventory_item_id:, variant_id:) ⇒ CachedInventoryItem
constructor
A new instance of CachedInventoryItem.
- #to_h ⇒ Object
Constructor Details
#initialize(inventory_key:, active:, quantity_available:, inventory_item_id:, variant_id:) ⇒ CachedInventoryItem
Returns a new instance of CachedInventoryItem.
5 6 7 8 9 10 11 |
# File 'lib/spree_cm_commissioner/cached_inventory_item.rb', line 5 def initialize(inventory_key:, active:, quantity_available:, inventory_item_id:, variant_id:) @inventory_key = inventory_key @active = active @quantity_available = quantity_available @inventory_item_id = inventory_item_id @variant_id = variant_id end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
3 4 5 |
# File 'lib/spree_cm_commissioner/cached_inventory_item.rb', line 3 def active @active end |
#inventory_item_id ⇒ Object (readonly)
Returns the value of attribute inventory_item_id.
3 4 5 |
# File 'lib/spree_cm_commissioner/cached_inventory_item.rb', line 3 def inventory_item_id @inventory_item_id end |
#inventory_key ⇒ Object (readonly)
Returns the value of attribute inventory_key.
3 4 5 |
# File 'lib/spree_cm_commissioner/cached_inventory_item.rb', line 3 def inventory_key @inventory_key end |
#quantity_available ⇒ Object (readonly)
Returns the value of attribute quantity_available.
3 4 5 |
# File 'lib/spree_cm_commissioner/cached_inventory_item.rb', line 3 def quantity_available @quantity_available end |
#variant_id ⇒ Object (readonly)
Returns the value of attribute variant_id.
3 4 5 |
# File 'lib/spree_cm_commissioner/cached_inventory_item.rb', line 3 def variant_id @variant_id end |
Instance Method Details
#active? ⇒ Boolean
13 14 15 |
# File 'lib/spree_cm_commissioner/cached_inventory_item.rb', line 13 def active? active end |
#to_h ⇒ Object
17 18 19 20 21 |
# File 'lib/spree_cm_commissioner/cached_inventory_item.rb', line 17 def to_h instance_variables.each_with_object({}) do |var, hash| hash[var.to_s.delete('@').to_sym] = instance_variable_get(var) end end |