beyond_api 0.3.0.pre → 0.4.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -1
- data/Gemfile.lock +1 -1
- data/lib/beyond_api/resources/product_attribute_definitions.rb +22 -5
- data/lib/beyond_api/resources/products.rb +4 -0
- data/lib/beyond_api/resources/products/custom_attributes.rb +1 -1
- data/lib/beyond_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3795859a890e583f269eb293d62e8e05eb37b03d64c6a0c3b50015c519ae3ef
|
4
|
+
data.tar.gz: 7e20846e047c5f9cdce44bfe8960ee58c712690f6ac08ffcc13a15165ce4e6d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd8ad25f6dc6e0026172bd64ba6e952cfb44183aea2547c5bd5ba94a3a1b23b1c358d9f551f1d35ca49fdffdd9e921f3cc13e9fa3189b1fe79e8fa7a3da1a7a3
|
7
|
+
data.tar.gz: 5ee088be3e778a21cc2db512e7d85b93585cc9b5463731aa29e6a2feca0fc82421cbcd136377c06cfb482d012f136485883c5e38490a1ab74d63d671bf72ce0f
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,37 @@
|
|
1
|
-
###
|
1
|
+
### v0.4.0.pre
|
2
|
+
|
3
|
+
* bug-fixes
|
4
|
+
* Fix product attribute definition `create` method
|
5
|
+
* Fix product attribute definition `delete` method
|
6
|
+
* Fix product custom attribute module name
|
7
|
+
* Include `BeyondApi::ProductCustomAttributes` module into `BeyondApi::Products` class
|
8
|
+
* Include `BeyondApi::ProductImages` module into `BeyondApi::Products` class
|
9
|
+
|
10
|
+
* enhancements
|
11
|
+
* Allow to get all product attribute definitions on a single call
|
12
|
+
|
13
|
+
### v0.3.0.pre
|
14
|
+
|
15
|
+
* bug-fixes
|
16
|
+
* Fix logger
|
17
|
+
|
18
|
+
* features
|
19
|
+
* Add a configurable option to raise on error requests
|
20
|
+
|
21
|
+
### v0.2.1.pre
|
22
|
+
|
23
|
+
* features
|
24
|
+
* Add logger option
|
25
|
+
|
26
|
+
### v0.2.0.pre
|
27
|
+
|
28
|
+
* bug-fixes
|
29
|
+
* Fix the signers delete endpoint
|
30
|
+
|
31
|
+
* enhancements
|
32
|
+
* Add better documentation
|
33
|
+
|
34
|
+
### v0.1.0.pre
|
2
35
|
|
3
36
|
* features
|
4
37
|
* All endpoints offered by the Beyond API
|
data/Gemfile.lock
CHANGED
@@ -14,6 +14,7 @@ module BeyondApi
|
|
14
14
|
#
|
15
15
|
# @beyond_api.scopes +prad:r+
|
16
16
|
#
|
17
|
+
# @option param [Boolean] :paginated
|
17
18
|
# @option param [Integer] :size the page size
|
18
19
|
# @option param [Integer] :page the page number
|
19
20
|
#
|
@@ -23,9 +24,18 @@ module BeyondApi
|
|
23
24
|
# @product_attribute_definitions = session.product_attribute_definitions.all(size: 100, page: 0)
|
24
25
|
#
|
25
26
|
def all(params = {})
|
26
|
-
|
27
|
+
if params[:paginated] == false
|
28
|
+
result = all_paginated(page: 0, size: 1000)
|
27
29
|
|
28
|
-
|
30
|
+
(1..result[:page][:total_pages] - 1).each do |page|
|
31
|
+
result[:embedded][:product_attribute_definition].concat(all_paginated(page: page, size: 1000)[:embedded][:product_attribute_definitions])
|
32
|
+
end
|
33
|
+
|
34
|
+
result.is_a?(Hash) ? result.delete(:page) : result.delete_field(:page)
|
35
|
+
result
|
36
|
+
else
|
37
|
+
all_paginated(params)
|
38
|
+
end
|
29
39
|
end
|
30
40
|
|
31
41
|
#
|
@@ -56,8 +66,8 @@ module BeyondApi
|
|
56
66
|
# }
|
57
67
|
# @product_attribute_definition = session.product_attribute_definitions.create(body)
|
58
68
|
#
|
59
|
-
def create(
|
60
|
-
response, status = BeyondApi::Request.post(@session, "/product-attribute-definitions")
|
69
|
+
def create(body)
|
70
|
+
response, status = BeyondApi::Request.post(@session, "/product-attribute-definitions", body)
|
61
71
|
|
62
72
|
handle_response(response, status)
|
63
73
|
end
|
@@ -80,7 +90,7 @@ module BeyondApi
|
|
80
90
|
# session.product_attribute_definitions.delete("filling_capacity")
|
81
91
|
#
|
82
92
|
def delete(product_attribute_name)
|
83
|
-
response, status = BeyondApi::Request.
|
93
|
+
response, status = BeyondApi::Request.delete(@session, "/product-attribute-definitions/#{product_attribute_name}")
|
84
94
|
|
85
95
|
handle_response(response, status, respond_with_true: true)
|
86
96
|
end
|
@@ -105,5 +115,12 @@ module BeyondApi
|
|
105
115
|
|
106
116
|
handle_response(response, status)
|
107
117
|
end
|
118
|
+
|
119
|
+
private
|
120
|
+
|
121
|
+
def all_paginated(params = {})
|
122
|
+
response, status = BeyondApi::Request.get(@session, "/product-attribute-definitions", params)
|
123
|
+
handle_response(response, status)
|
124
|
+
end
|
108
125
|
end
|
109
126
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "beyond_api/utils"
|
4
|
+
require "beyond_api/resources/products/custom_attributes"
|
5
|
+
require "beyond_api/resources/products/images"
|
4
6
|
|
5
7
|
module BeyondApi
|
6
8
|
class Products < Base
|
9
|
+
include BeyondApi::ProductCustomAttributes
|
10
|
+
include BeyondApi::ProductImages
|
7
11
|
include BeyondApi::Utils
|
8
12
|
|
9
13
|
#
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require "beyond_api/utils"
|
4
4
|
|
5
5
|
module BeyondApi
|
6
|
-
module
|
6
|
+
module ProductCustomAttributes
|
7
7
|
|
8
8
|
#
|
9
9
|
# A +POST+ request is used to create a product attribute, which defines the value of a certain {product attribute definition}[http://docs.beyondshop.cloud/#resources-product-attribute-definitions] for a specific {product}[http://docs.beyondshop.cloud/#resources-products].
|
data/lib/beyond_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beyond_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Unai Abrisketa
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-11-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|