beyond_api 0.13.0.pre → 0.16.1.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 +29 -0
- data/Gemfile.lock +25 -25
- data/lib/beyond_api/resources/pickup_options.rb +216 -0
- data/lib/beyond_api/resources/products.rb +7 -10
- data/lib/beyond_api/resources/variations.rb +2 -2
- data/lib/beyond_api/session.rb +5 -0
- data/lib/beyond_api/utils.rb +6 -3
- data/lib/beyond_api/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e21d3e55d80fdab110e763b80945554aaa37db10d9cd1d6420e1048992990442
|
4
|
+
data.tar.gz: abfb64188b9e2b04a223b7cbc839eec16b2f6307ecccf0a8c6b484ab55259231
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a51c07ca44a5f137e8c2cea3e3249e607323ec9a58a661895d4541ccd573d234c72fae261632341e8e44077a8eca1f34e0748cad693961e4195e0c6b881089a
|
7
|
+
data.tar.gz: 64b13f1fa84d4292c6f414071dd64beed61acddcefff7c8aa952cc089e53bf519d8823e7ad9ebf98cfb779fb60855411c603c435b07a5c74caa07a9a243a3ac3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
### v0.16.1.pre
|
2
|
+
|
3
|
+
* bug-fixes
|
4
|
+
* Fix method to retrieve resources without pagination
|
5
|
+
|
6
|
+
### v0.16.0.pre
|
7
|
+
|
8
|
+
* features
|
9
|
+
* Add pickup options methods
|
10
|
+
* `PickupOptions#delete`
|
11
|
+
* `PickupOptions#find`
|
12
|
+
* `PickupOptions#sort`
|
13
|
+
* `PickupOptions#update`
|
14
|
+
|
15
|
+
### v0.15.0.pre
|
16
|
+
|
17
|
+
* features
|
18
|
+
* Add pickup options methods
|
19
|
+
* `PickupOptions#all`
|
20
|
+
* `PickupOptions#create`
|
21
|
+
|
22
|
+
### v0.14.0.pre
|
23
|
+
|
24
|
+
* deprecations
|
25
|
+
* Remove `Products#assign_variation_images_differentiator`
|
26
|
+
|
27
|
+
* features
|
28
|
+
* Add `Products#assign_variation_attribute_as_differentiator`
|
29
|
+
|
1
30
|
### v0.13.0.pre
|
2
31
|
|
3
32
|
* features
|
data/Gemfile.lock
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
beyond_api (0.
|
4
|
+
beyond_api (0.16.1.pre)
|
5
5
|
faraday (~> 0.15)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
coderay (1.1.
|
11
|
-
concurrent-ruby (1.1.
|
12
|
-
diff-lcs (1.
|
13
|
-
dotenv (2.7.
|
14
|
-
faker (2.
|
15
|
-
i18n (
|
16
|
-
faraday (0.17.
|
10
|
+
coderay (1.1.3)
|
11
|
+
concurrent-ruby (1.1.9)
|
12
|
+
diff-lcs (1.4.4)
|
13
|
+
dotenv (2.7.6)
|
14
|
+
faker (2.18.0)
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
faraday (0.17.4)
|
17
17
|
multipart-post (>= 1.2, < 3)
|
18
|
-
i18n (1.
|
18
|
+
i18n (1.8.10)
|
19
19
|
concurrent-ruby (~> 1.0)
|
20
|
-
method_source (0.
|
20
|
+
method_source (1.0.0)
|
21
21
|
multipart-post (2.1.1)
|
22
|
-
pry (0.
|
23
|
-
coderay (~> 1.1
|
24
|
-
method_source (~>
|
22
|
+
pry (0.14.1)
|
23
|
+
coderay (~> 1.1)
|
24
|
+
method_source (~> 1.0)
|
25
25
|
rake (10.5.0)
|
26
|
-
rspec (3.
|
27
|
-
rspec-core (~> 3.
|
28
|
-
rspec-expectations (~> 3.
|
29
|
-
rspec-mocks (~> 3.
|
30
|
-
rspec-core (3.
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-expectations (3.
|
26
|
+
rspec (3.10.0)
|
27
|
+
rspec-core (~> 3.10.0)
|
28
|
+
rspec-expectations (~> 3.10.0)
|
29
|
+
rspec-mocks (~> 3.10.0)
|
30
|
+
rspec-core (3.10.1)
|
31
|
+
rspec-support (~> 3.10.0)
|
32
|
+
rspec-expectations (3.10.1)
|
33
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-mocks (3.
|
34
|
+
rspec-support (~> 3.10.0)
|
35
|
+
rspec-mocks (3.10.2)
|
36
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-support (3.
|
39
|
-
yard (0.9.
|
37
|
+
rspec-support (~> 3.10.0)
|
38
|
+
rspec-support (3.10.2)
|
39
|
+
yard (0.9.26)
|
40
40
|
|
41
41
|
PLATFORMS
|
42
42
|
ruby
|
@@ -0,0 +1,216 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "beyond_api/utils"
|
4
|
+
|
5
|
+
module BeyondApi
|
6
|
+
class PickupOptions < Base
|
7
|
+
include BeyondApi::Utils
|
8
|
+
|
9
|
+
#
|
10
|
+
# A +GET+ request is used to list all pickup options of the shop in a paged way.
|
11
|
+
#
|
12
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X GET \
|
13
|
+
# -H 'Accept: application/hal+json' \
|
14
|
+
# -H 'Authorization: Bearer <Access token>'
|
15
|
+
#
|
16
|
+
# @option params [Boolean] :paginated
|
17
|
+
# @option params [Integer] :size the page size
|
18
|
+
# @option params [Integer] :page the page number
|
19
|
+
#
|
20
|
+
# @return [OpenStruct]
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# @pickup_options = session.pickup_options.all(size: 100, page: 0)
|
24
|
+
#
|
25
|
+
def all(params = {})
|
26
|
+
handle_all_request("/pickup-options", :pickup_options, params)
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# A +POST+ request is used to create a pickup option.
|
31
|
+
#
|
32
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X POST \
|
33
|
+
# -H 'Content-Type: application/json' \
|
34
|
+
# -H 'Authorization: Bearer <Access token>' \
|
35
|
+
# -d '{
|
36
|
+
# "name" : "My little Cornershop - St.Ives",
|
37
|
+
# "description" : "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.",
|
38
|
+
# "taxClass" : "REGULAR",
|
39
|
+
# "freePickupValue" : {
|
40
|
+
# "currency" : "EUR",
|
41
|
+
# "amount" : 50
|
42
|
+
# },
|
43
|
+
# "fixedPrice" : {
|
44
|
+
# "taxModel" : "GROSS",
|
45
|
+
# "currency" : "EUR",
|
46
|
+
# "amount" : 1
|
47
|
+
# },
|
48
|
+
# "phoneNumberRequired" : true,
|
49
|
+
# "locationId" : "cb554eb6-2768-4491-afd2-6bcd0aec0937"
|
50
|
+
# }'
|
51
|
+
#
|
52
|
+
# @beyond_api.scopes +shpz:c+
|
53
|
+
#
|
54
|
+
# @param body [Hash] the request body
|
55
|
+
#
|
56
|
+
# @return [OpenStruct]
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# body = {
|
60
|
+
# name: "My little Cornershop - St.Ives",
|
61
|
+
# description: "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.",
|
62
|
+
# tax_class: "REGULAR",
|
63
|
+
# free_pickup_value: {
|
64
|
+
# currency: "EUR",
|
65
|
+
# amount: 50
|
66
|
+
# },
|
67
|
+
# fixed_price: {
|
68
|
+
# tax_model: "GROSS",
|
69
|
+
# currency: "EUR",
|
70
|
+
# amount: 1
|
71
|
+
# },
|
72
|
+
# phone_number_required: true,
|
73
|
+
# location_id: "cb554eb6-2768-4491-afd2-6bcd0aec0937"
|
74
|
+
# }
|
75
|
+
#
|
76
|
+
# @pickup_option = session.pickup_options.create(body)
|
77
|
+
#
|
78
|
+
def create(body)
|
79
|
+
response, status = BeyondApi::Request.post(@session, "/pickup-options", body)
|
80
|
+
|
81
|
+
handle_response(response, status)
|
82
|
+
end
|
83
|
+
|
84
|
+
#
|
85
|
+
# A +DELETE+ request is used to delete a pickup option.
|
86
|
+
#
|
87
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/d253a31b-3892-4196-ae16-c5d8d6b05791' -i -X DELETE
|
88
|
+
#
|
89
|
+
# @beyond_api.scopes +shpz:d+
|
90
|
+
#
|
91
|
+
# @param pickup_option_id [String] the pickup option UUID
|
92
|
+
#
|
93
|
+
# @return true
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# session.pickup_options.delete("d253a31b-3892-4196-ae16-c5d8d6b05791")
|
97
|
+
#
|
98
|
+
def delete(pickup_option_id)
|
99
|
+
response, status = BeyondApi::Request.delete(@session, "/pickup-options/#{pickup_option_id}")
|
100
|
+
|
101
|
+
handle_response(response, status, respond_with_true: true)
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# A +GET+ request is used to retrieve the details of a pickup option.
|
106
|
+
#
|
107
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/76302c10-761f-43c1-9d18-52ad16bd52e8' -i -X GET \
|
108
|
+
# -H 'Content-Type: application/json' \
|
109
|
+
# -H 'Accept: application/hal+json' \
|
110
|
+
# -H 'Authorization: Bearer <Access token>'
|
111
|
+
#
|
112
|
+
# @beyond_api.scopes +shpz:r+
|
113
|
+
#
|
114
|
+
# @param pickup_option_id [String] the pickup option UUID
|
115
|
+
#
|
116
|
+
# @return [OpenStruct]
|
117
|
+
#
|
118
|
+
# @example
|
119
|
+
# @pickup_option = session.pickup_options.find("76302c10-761f-43c1-9d18-52ad16bd52e8")
|
120
|
+
#
|
121
|
+
def find(pickup_option_id)
|
122
|
+
response, status = BeyondApi::Request.get(@session, "/pickup-options/#{pickup_option_id}")
|
123
|
+
|
124
|
+
handle_response(response, status)
|
125
|
+
end
|
126
|
+
|
127
|
+
#
|
128
|
+
# A +PUT+ request is used to sort the pickup options. This is done by passing the self-links of the pickup options in the desired order. The request must contain URIs for all pickup options of the given page.
|
129
|
+
#
|
130
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X PUT \
|
131
|
+
# -H 'Content-Type: text/uri-list' \
|
132
|
+
# -H 'Authorization: Bearer <Access token>' \
|
133
|
+
# -d 'https://api-shop.beyondshop.cloud/api/pickup-options/bff3673f-91c1-4e09-a8ab-562a3a553fac
|
134
|
+
# https://api-shop.beyondshop.cloud/api/pickup-options/7b4d36fc-ac0f-44a3-8655-f2bd05c2a42d
|
135
|
+
# https://api-shop.beyondshop.cloud/api/pickup-options/630b63ee-c7d8-4953-9b7c-c874fd795154'
|
136
|
+
#
|
137
|
+
# @beyond_api.scopes +shpz:u+
|
138
|
+
#
|
139
|
+
# @param pickup_option_ids [Array] the pickup option UUIDs
|
140
|
+
#
|
141
|
+
# @return [OpenStruct]
|
142
|
+
#
|
143
|
+
# @example
|
144
|
+
# pickup_option_ids = [
|
145
|
+
# "bff3673f-91c1-4e09-a8ab-562a3a553fac",
|
146
|
+
# "7b4d36fc-ac0f-44a3-8655-f2bd05c2a42d",
|
147
|
+
# "630b63ee-c7d8-4953-9b7c-c874fd795154"
|
148
|
+
# ]
|
149
|
+
#
|
150
|
+
# session.pickup_options.sort(pickup_option_ids)
|
151
|
+
#
|
152
|
+
def sort(pickup_option_ids)
|
153
|
+
body = pickup_option_ids.map { |id| "#{@session.api_url}/pickup-options/#{id}" }
|
154
|
+
response, status = BeyondApi::Request.put(@session, "/pickup-options", body)
|
155
|
+
|
156
|
+
handle_response(response, status, respond_with_true: true)
|
157
|
+
end
|
158
|
+
|
159
|
+
#
|
160
|
+
# A +PUT+ request is used to update a pickup option.
|
161
|
+
#
|
162
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/5765b837-db5b-49a9-a659-68d00376e42a' -i -X PUT \
|
163
|
+
# -H 'Content-Type: application/json' \
|
164
|
+
# -H 'Accept: application/hal+json' \
|
165
|
+
# -H 'Authorization: Bearer <Access token>' \
|
166
|
+
# -d '{
|
167
|
+
# "name" : "New name",
|
168
|
+
# "description" : "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.",
|
169
|
+
# "taxClass" : "REGULAR",
|
170
|
+
# "freePickupValue" : {
|
171
|
+
# "currency" : "EUR",
|
172
|
+
# "amount" : 50
|
173
|
+
# },
|
174
|
+
# "fixedPrice" : {
|
175
|
+
# "taxModel" : "GROSS",
|
176
|
+
# "currency" : "EUR",
|
177
|
+
# "amount" : 1
|
178
|
+
# },
|
179
|
+
# "phoneNumberRequired" : true,
|
180
|
+
# "locationId" : "c9179393-abcc-450a-8cf4-875b39647ab6"
|
181
|
+
# }'
|
182
|
+
#
|
183
|
+
# @beyond_api.scopes +shpz:u+
|
184
|
+
#
|
185
|
+
# @param pickup_option_id [String] the pickup option UUID
|
186
|
+
# @param body [Hash] the request body
|
187
|
+
#
|
188
|
+
# @return [OpenStruct]
|
189
|
+
#
|
190
|
+
# @example
|
191
|
+
# body = {
|
192
|
+
# name: "New name",
|
193
|
+
# description: "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.",
|
194
|
+
# tax_class: "REGULAR",
|
195
|
+
# free_pickup_value: {
|
196
|
+
# currency: "EUR",
|
197
|
+
# amount: 50
|
198
|
+
# },
|
199
|
+
# fixed_price: {
|
200
|
+
# tax_model: "GROSS",
|
201
|
+
# currency: "EUR",
|
202
|
+
# amount: 1
|
203
|
+
# },
|
204
|
+
# phone_number_required: true,
|
205
|
+
# location_id: "c9179393-abcc-450a-8cf4-875b39647ab6"
|
206
|
+
# }
|
207
|
+
#
|
208
|
+
# @pickup_option = session.pickup_options.update("5765b837-db5b-49a9-a659-68d00376e42a", body)
|
209
|
+
#
|
210
|
+
def update(pickup_option_id, body)
|
211
|
+
response, status = BeyondApi::Request.put(@session, "/pickup-options/#{pickup_option_id}", body)
|
212
|
+
|
213
|
+
handle_response(response, status)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
@@ -253,28 +253,25 @@ module BeyondApi
|
|
253
253
|
end
|
254
254
|
|
255
255
|
#
|
256
|
-
# A +
|
256
|
+
# A +POST+ request is used to assign a variation attribute as the variation images differentiator for a variation product.
|
257
257
|
#
|
258
258
|
# @beyond_api.scopes +prod:u+
|
259
259
|
#
|
260
|
-
# $ curl 'https://api-shop.beyondshop.cloud/api/products/
|
260
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/f205294b-17dc-4f75-8b5e-5df72abb96df/variation-attributes/491fedf4-37a9-4bcf-98b8-cff2f82879b7/make-differentiator' -i -X POST \
|
261
261
|
# -H 'Content-Type: application/hal+json' \
|
262
262
|
# -H 'Accept: application/hal+json' \
|
263
|
-
# -H 'Authorization: Bearer <Access token>'
|
264
|
-
# -d '{
|
265
|
-
# "differentiator" : "size"
|
266
|
-
# }'
|
263
|
+
# -H 'Authorization: Bearer <Access token>'
|
267
264
|
#
|
268
265
|
# @param product_id [String] the product UUID
|
269
|
-
# @param
|
266
|
+
# @param variation_attribute_id [String] the variation attribute UUID
|
270
267
|
#
|
271
268
|
# @return [true]
|
272
269
|
#
|
273
270
|
# @example
|
274
|
-
# session.products.assign_variation_images_differentiator("
|
271
|
+
# session.products.assign_variation_images_differentiator("f205294b-17dc-4f75-8b5e-5df72abb96df", "491fedf4-37a9-4bcf-98b8-cff2f82879b7")
|
275
272
|
#
|
276
|
-
def
|
277
|
-
response, status = BeyondApi::Request.
|
273
|
+
def assign_variation_attribute_as_differentiator(product_id, variation_attribute_id)
|
274
|
+
response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/variation-attributes/#{variation_attribute_id}/make-differentiator")
|
278
275
|
|
279
276
|
handle_response(response, status, respond_with_true: true)
|
280
277
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
require "beyond_api/utils"
|
4
4
|
|
5
5
|
module BeyondApi
|
6
|
-
autoload :
|
7
|
-
autoload :
|
6
|
+
autoload :VariationImages, "beyond_api/resources/variations/images"
|
7
|
+
autoload :VariationAvailability, "beyond_api/resources/variations/availability"
|
8
8
|
|
9
9
|
class Variations < Base
|
10
10
|
include BeyondApi::VariationImages
|
data/lib/beyond_api/session.rb
CHANGED
@@ -11,6 +11,7 @@ module BeyondApi
|
|
11
11
|
autoload :OrderSettings, "beyond_api/resources/order_settings"
|
12
12
|
autoload :Orders, "beyond_api/resources/orders"
|
13
13
|
autoload :PaymentMethodDefinitions, "beyond_api/resources/payment_method_definitions"
|
14
|
+
autoload :PickupOptions, "beyond_api/resources/pickup_options"
|
14
15
|
autoload :PaymentMethods, "beyond_api/resources/payment_methods"
|
15
16
|
autoload :ProductAttributeDefinitions, "beyond_api/resources/product_attribute_definitions"
|
16
17
|
autoload :ProductsView, "beyond_api/resources/products_view"
|
@@ -74,6 +75,10 @@ module BeyondApi
|
|
74
75
|
BeyondApi::PaymentMethods.new(self)
|
75
76
|
end
|
76
77
|
|
78
|
+
def pickup_options
|
79
|
+
BeyondApi::PickupOptions.new(self)
|
80
|
+
end
|
81
|
+
|
77
82
|
def product_attribute_definitions
|
78
83
|
BeyondApi::ProductAttributeDefinitions.new(self)
|
79
84
|
end
|
data/lib/beyond_api/utils.rb
CHANGED
@@ -45,14 +45,17 @@ module BeyondApi
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def handle_all_request(url, resource, params = {})
|
48
|
+
|
48
49
|
if params[:paginated] == false
|
49
|
-
result = all_paginated(url,
|
50
|
+
result = all_paginated(url, params.merge(page: 0, size: 1000))
|
50
51
|
|
51
52
|
(1..result[:page][:total_pages] - 1).each do |page|
|
52
|
-
result[:embedded][resource].concat(all_paginated(url,
|
53
|
+
result[:embedded][resource].concat(all_paginated(url, params.merge(page: page, size: 1000))[:embedded][resource])
|
53
54
|
end
|
54
55
|
|
55
|
-
result
|
56
|
+
result[:page][:size] = result[:page][:total_elements]
|
57
|
+
result[:page][:total_pages] = 1
|
58
|
+
result[:page][:number] = 0
|
56
59
|
|
57
60
|
result
|
58
61
|
else
|
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.16.1.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:
|
13
|
+
date: 2021-07-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/beyond_api/resources/orders.rb
|
149
149
|
- lib/beyond_api/resources/payment_method_definitions.rb
|
150
150
|
- lib/beyond_api/resources/payment_methods.rb
|
151
|
+
- lib/beyond_api/resources/pickup_options.rb
|
151
152
|
- lib/beyond_api/resources/product_attribute_definitions.rb
|
152
153
|
- lib/beyond_api/resources/products.rb
|
153
154
|
- lib/beyond_api/resources/products/attachments.rb
|
@@ -197,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
198
|
- !ruby/object:Gem::Version
|
198
199
|
version: 1.3.1
|
199
200
|
requirements: []
|
200
|
-
rubygems_version: 3.
|
201
|
+
rubygems_version: 3.0.3
|
201
202
|
signing_key:
|
202
203
|
specification_version: 4
|
203
204
|
summary: Ruby client to access the Beyond API
|