magento 0.24.0 → 0.25.0
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 +4 -4
- data/.gitignore +4 -2
- data/README.md +1 -1
- data/lib/magento/params/create_product_link.rb +30 -0
- data/lib/magento/product.rb +8 -1
- data/lib/magento/query.rb +3 -2
- data/lib/magento/sales_rule.rb +4 -0
- data/lib/magento/version.rb +1 -1
- metadata +2 -2
- data/.rspec_status +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39351f6f0160cca4294ba7f1eb49a9d45ad4928f23c1e16a119ea15a9d35de76
|
4
|
+
data.tar.gz: 0b57db15034198ca599d545966b63aaf535675a0ba122f0056f823617395e163
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaa7594c1b4d21fc2585552ce9187ce33a9b4605c6809d5d735c4ea82269f5acef51ae370e43688a16cf04faf826cf990f280dc005a010329d01be2214d86341
|
7
|
+
data.tar.gz: 0f07ba186842264c655e32637c48f8fdf557e8f6c97cbe5914cbb4ed5c3657308e41dc22e379de235ed97c38cd194fb27b8c613acccf0cbbb92d1a379e31f883
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Magento
|
4
|
+
module Params
|
5
|
+
class CreateProductLink < Dry::Struct
|
6
|
+
LinkType = Type::String.enum(
|
7
|
+
'related',
|
8
|
+
'upsell',
|
9
|
+
'crosssell',
|
10
|
+
'associated'
|
11
|
+
)
|
12
|
+
|
13
|
+
attribute :link_type, LinkType
|
14
|
+
attribute :linked_product_sku, Type::String
|
15
|
+
attribute :linked_product_type, Magento::Params::CreateProduct::ProductTypes
|
16
|
+
attribute :position, Type::Integer
|
17
|
+
attribute :sku, Type::String
|
18
|
+
|
19
|
+
def to_h
|
20
|
+
{
|
21
|
+
link_type: link_type,
|
22
|
+
linked_product_sku: linked_product_sku,
|
23
|
+
linked_product_type: linked_product_type,
|
24
|
+
position: position,
|
25
|
+
sku: sku
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/magento/product.rb
CHANGED
@@ -47,7 +47,6 @@ module Magento
|
|
47
47
|
self.class.remove_media(sku, media_id)
|
48
48
|
end
|
49
49
|
|
50
|
-
#
|
51
50
|
# Add {price} on product {sku} for specified {customer_group_id}
|
52
51
|
#
|
53
52
|
# Param {quantity} is the minimun amount to apply the price
|
@@ -134,6 +133,14 @@ module Magento
|
|
134
133
|
def update_stock(sku, id, attributes)
|
135
134
|
request.put("products/#{sku}/stockItems/#{id}", stockItem: attributes).parse
|
136
135
|
end
|
136
|
+
|
137
|
+
def create_links(sku, product_links)
|
138
|
+
request.post("products/#{sku}/links", { items: product_links })
|
139
|
+
end
|
140
|
+
|
141
|
+
def remove_link(sku, link_type:, linked_product_sku:)
|
142
|
+
request.delete("products/#{sku}/links/#{link_type}/#{linked_product_sku}")
|
143
|
+
end
|
137
144
|
end
|
138
145
|
end
|
139
146
|
end
|
data/lib/magento/query.rb
CHANGED
@@ -23,7 +23,7 @@ module Magento
|
|
23
23
|
'to' # The end of a range. Must be used with from
|
24
24
|
].freeze
|
25
25
|
|
26
|
-
def initialize(model, request: Request.new)
|
26
|
+
def initialize(model, request: Request.new, api_resource: nil)
|
27
27
|
@model = model
|
28
28
|
@request = request
|
29
29
|
@filter_groups = nil
|
@@ -31,6 +31,7 @@ module Magento
|
|
31
31
|
@page_size = 50
|
32
32
|
@sort_orders = nil
|
33
33
|
@fields = nil
|
34
|
+
@endpoint = api_resource || model.api_resource
|
34
35
|
end
|
35
36
|
|
36
37
|
def where(attributes)
|
@@ -131,7 +132,7 @@ module Magento
|
|
131
132
|
attr_accessor :current_page, :filter_groups, :request, :sort_orders, :model, :fields
|
132
133
|
|
133
134
|
def endpoint
|
134
|
-
|
135
|
+
@endpoint
|
135
136
|
end
|
136
137
|
|
137
138
|
def verify_id(field)
|
data/lib/magento/sales_rule.rb
CHANGED
data/lib/magento/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magento
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wallas Faria
|
@@ -89,7 +89,6 @@ files:
|
|
89
89
|
- ".github/workflows/gem-push.yml"
|
90
90
|
- ".gitignore"
|
91
91
|
- ".rspec"
|
92
|
-
- ".rspec_status"
|
93
92
|
- Gemfile
|
94
93
|
- README.md
|
95
94
|
- Rakefile
|
@@ -118,6 +117,7 @@ files:
|
|
118
117
|
- lib/magento/params/create_custom_attribute.rb
|
119
118
|
- lib/magento/params/create_image.rb
|
120
119
|
- lib/magento/params/create_product.rb
|
120
|
+
- lib/magento/params/create_product_link.rb
|
121
121
|
- lib/magento/polymorphic_model.rb
|
122
122
|
- lib/magento/product.rb
|
123
123
|
- lib/magento/query.rb
|
data/.rspec_status
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
example_id | status | run_time |
|
2
|
-
------------------------------- | ------ | --------------- |
|
3
|
-
./spec/magento_spec.rb[1:1] | passed | 0.00057 seconds |
|
4
|
-
./spec/product_spec.rb[1:1:1:1] | passed | 0.00102 seconds |
|
5
|
-
./spec/product_spec.rb[1:1:2:1] | passed | 0.00111 seconds |
|