magentwo 0.1.85 → 0.1.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c389ffd5dfd801c072750c3187115827d82b4a3ff72cd07dcd2dd54729e1d8d5
4
- data.tar.gz: 6a72bd03b8e4941e4acbafb446e2618166cbbc9b0e81dc3699f35f3ebfa1266c
3
+ metadata.gz: 5e51e4d4b67554b49a976fee18670db67323bdcf507a8558ea2cd95d1bc4cc49
4
+ data.tar.gz: bba71d4d4bba4e985c266b1271ccc56514abc5001a8a5fbca99d1b9be76410bf
5
5
  SHA512:
6
- metadata.gz: ba50d3ac4eb38a5058bcbd1dfdbedc540aea54bf125819347b1bdbfa56b97de8425eb1defa7f6a059e78d93498b9d155858bee0634e8ffab6ef399b08362e9f5
7
- data.tar.gz: 6b911f6f943d9dfb7eeee47a2fd7f9d51fc2262968dc7b92769e1e1e20d6fb50462428e14d902300f98de9ba9c8519ef12ee859b2509a7650d9bcfb021f5067b
6
+ metadata.gz: 69c50939de4b66c4fa9795fda777e22a5952388d89187e8009e6dedda81346a07f81084d751c9cfd9f0185ef30800a107bd29e90596f24c79dc174afcf25b676
7
+ data.tar.gz: beed6c14fb9b09a9ca8e68dff160bbec457a6c18c85dd0021c236930b456b8e809ac40738f9f06bfe01400fc4c34d926d87e253e36ae3341c7bb7707544b1aff
@@ -5,7 +5,7 @@ require 'time'
5
5
  require 'logger'
6
6
 
7
7
  module Magentwo
8
- Models = %w(base product customer order coupon sales_rule category cart)
8
+ Models = %w(base product customer order coupon sales_rule category cart stock_item)
9
9
  @@mutex = Mutex.new
10
10
  def self.connect host=nil, user_name=nil, password=nil
11
11
  raise ArgumentError, "no host specified" unless host
@@ -3,6 +3,10 @@ module Magentwo
3
3
  Attributes = %i(id sku name attribute_set_id price status visibility type_id created_at updated_at extension_attributes product_links options media_gallery_entries tier_prices custom_attributes)
4
4
  Attributes.each do |attr| attr_accessor attr end
5
5
 
6
+ def stocks
7
+ Magentwo::StockItem[self.sku]
8
+ end
9
+
6
10
  class << self
7
11
  def types
8
12
  Magentwo::Base.get nil, path:"#{base_path}/types"
@@ -0,0 +1,12 @@
1
+ # Usage:
2
+ # Magentwo::StockItems['sku']
3
+
4
+ module Magentwo
5
+ class StockItem < Base
6
+ Attributes = %i(item_id product_id stock_id qty is_in_stock is_qty_decimal show_default_notification_message use_config_min_qty min_qty use_config_min_sale_qty min_sale_qty use_config_max_sale_qty max_sale_qty use_config_backorders backorders use_config_notify_stock_qty notify_stock_qty use_config_qty_increments qty_increments use_config_enable_qty_inc enable_qty_increments use_config_manage_stock manage_stock low_stock_date is_decimal_divided stock_status_changed_auto)
7
+ Attributes.each do |attr| attr_accessor attr end
8
+
9
+ class << self
10
+ end
11
+ end
12
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'magentwo'
3
- s.version = '0.1.85'
3
+ s.version = '0.1.86'
4
4
  s.date = '2019-01-17'
5
5
  s.summary = "Magento 2 API Wrapper"
6
6
  s.description = "Provides a simple Ruby Interface to interact with the Magento 2 API"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magentwo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.85
4
+ version: 0.1.86
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Mueß
@@ -34,6 +34,7 @@ files:
34
34
  - lib/model/order.rb
35
35
  - lib/model/product.rb
36
36
  - lib/model/sales_rule.rb
37
+ - lib/model/stock_item.rb
37
38
  - lib/util/validator.rb
38
39
  - magentwo.gemspec
39
40
  - spec/base_model_spec.rb