beyond_api 0.11.1.pre → 0.12.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 +13 -0
- data/Gemfile.lock +1 -1
- data/lib/beyond_api/resources/products.rb +9 -8
- data/lib/beyond_api/resources/shop.rb +11 -438
- data/lib/beyond_api/resources/shops/address.rb +54 -0
- data/lib/beyond_api/resources/shops/attributes.rb +137 -0
- data/lib/beyond_api/resources/shops/images.rb +155 -0
- data/lib/beyond_api/resources/shops/legals.rb +124 -0
- data/lib/beyond_api/resources/shops/locations.rb +252 -0
- data/lib/beyond_api/resources/variations.rb +3 -2
- data/lib/beyond_api/session.rb +22 -22
- data/lib/beyond_api/version.rb +1 -1
- metadata +8 -3
@@ -0,0 +1,252 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "beyond_api/utils"
|
4
|
+
|
5
|
+
module BeyondApi
|
6
|
+
module ShopLocations
|
7
|
+
|
8
|
+
#
|
9
|
+
# A +GET+ request is used to retrieve a list of all locations for the current shop.
|
10
|
+
#
|
11
|
+
# $ curl 'https://yourshop.api.urn/shop/locations' -i -X GET \
|
12
|
+
# -H 'Accept: application/hal+json' \
|
13
|
+
# -H 'Authorization: Bearer <Access token>'
|
14
|
+
#
|
15
|
+
# @beyond_api.scopes +loca:r+
|
16
|
+
#
|
17
|
+
# @option params [Boolean] :paginated
|
18
|
+
# @option params [Integer] :size the page size
|
19
|
+
# @option params [Integer] :page the page number
|
20
|
+
#
|
21
|
+
# @return [OpenStruct]
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# @locations = session.shop.locations(size: 100, page: 0)
|
25
|
+
#
|
26
|
+
def locations(params = {})
|
27
|
+
handle_all_request("/shop/locations", :locations, params)
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# A +POST+ request is used to create a location.
|
32
|
+
#
|
33
|
+
# $ curl 'https://yourshop.api.urn/shop/locations' -i -X POST \
|
34
|
+
# -H 'Content-Type: application/json;charset=UTF-8' \
|
35
|
+
# -H 'Accept: application/hal+json' \
|
36
|
+
# -H 'Authorization: Bearer <Access token>' \
|
37
|
+
# -d '{
|
38
|
+
# "languageCode" : "de",
|
39
|
+
# "storeCode" : "",
|
40
|
+
# "locationName" : "HealthyThings",
|
41
|
+
# "primaryPhone" : "01522 3097093",
|
42
|
+
# "address" : {
|
43
|
+
# "locality" : "Hamburg",
|
44
|
+
# "postalCode" : "20253",
|
45
|
+
# "regionCode" : "DE",
|
46
|
+
# "addressLines" : [ "Pilatuspool 2", "ePages GmbH" ]
|
47
|
+
# },
|
48
|
+
# "primaryCategory" : {
|
49
|
+
# "categoryId" : "gcid:store",
|
50
|
+
# "displayName" : "Geschaeft"
|
51
|
+
# },
|
52
|
+
# "websiteUrl" : "",
|
53
|
+
# "regularHours" : {
|
54
|
+
# "periods" : [ {
|
55
|
+
# "openDay" : "MONDAY",
|
56
|
+
# "openTime" : "18:00",
|
57
|
+
# "closeDay" : "TUESDAY",
|
58
|
+
# "closeTime" : "03:00"
|
59
|
+
# }, {
|
60
|
+
# "openDay" : "WEDNESDAY",
|
61
|
+
# "openTime" : "17:00",
|
62
|
+
# "closeDay" : "WEDNESDAY",
|
63
|
+
# "closeTime" : "23:00"
|
64
|
+
# } ]
|
65
|
+
# },
|
66
|
+
# "latLng" : {
|
67
|
+
# "latitude" : 53.5847424,
|
68
|
+
# "longitude" : 9.968901
|
69
|
+
# }
|
70
|
+
# }'
|
71
|
+
#
|
72
|
+
# @beyond_api.scopes +loca:c+
|
73
|
+
#
|
74
|
+
# @param body [Hash] the request body
|
75
|
+
#
|
76
|
+
# @return [OpenStruct]
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# body = {
|
80
|
+
# "languageCode" => "de",
|
81
|
+
# "storeCode" => "",
|
82
|
+
# "locationName" => "HealthyThings",
|
83
|
+
# "primaryPhone" => "01522 3097093",
|
84
|
+
# "address" => {
|
85
|
+
# "locality" => "Hamburg",
|
86
|
+
# "postalCode" => "20253",
|
87
|
+
# "regionCode" => "DE",
|
88
|
+
# "addressLines" => [ "Pilatuspool 2", "ePages GmbH" ]
|
89
|
+
# },
|
90
|
+
# "primaryCategory" => {
|
91
|
+
# "categoryId" => "gcid:store",
|
92
|
+
# "displayName" => "Geschaeft"
|
93
|
+
# },
|
94
|
+
# "websiteUrl" => "",
|
95
|
+
# "regularHours" => {
|
96
|
+
# "periods" => [ {
|
97
|
+
# "openDay" => "MONDAY",
|
98
|
+
# "openTime" => "18:00",
|
99
|
+
# "closeDay" => "TUESDAY",
|
100
|
+
# "closeTime" => "03:00"
|
101
|
+
# }, {
|
102
|
+
# "openDay" => "WEDNESDAY",
|
103
|
+
# "openTime" => "17:00",
|
104
|
+
# "closeDay" => "WEDNESDAY",
|
105
|
+
# "closeTime" => "23:00"
|
106
|
+
# } ]
|
107
|
+
# },
|
108
|
+
# "latLng" : {
|
109
|
+
# "latitude" => 53.5847424,
|
110
|
+
# "longitude" => 9.968901
|
111
|
+
# }
|
112
|
+
# }
|
113
|
+
# @location = session.shop.create_location(body)
|
114
|
+
#
|
115
|
+
def create_location(body)
|
116
|
+
response, status = BeyondApi::Request.post(@session, "/shop/locations", body)
|
117
|
+
|
118
|
+
handle_response(response, status)
|
119
|
+
end
|
120
|
+
|
121
|
+
#
|
122
|
+
# A +DELETE+ request is used to delete a location.
|
123
|
+
#
|
124
|
+
# $ curl 'https://yourshop.api.urn/shop/locations/5bcf7c0a-d130-4cf8-af0c-5e57d4605be0' -i -X DELETE \
|
125
|
+
# -H 'Accept: application/hal+json' \
|
126
|
+
# -H 'Authorization: Bearer <Access token>'
|
127
|
+
#
|
128
|
+
# @beyond_api.scopes +loca:d+
|
129
|
+
#
|
130
|
+
# @param location_id [String] the location UUID
|
131
|
+
#
|
132
|
+
# @return true
|
133
|
+
#
|
134
|
+
# @example
|
135
|
+
# session.shop.delete_location("f461fb56-1984-4ade-bd4e-007c273cc923")
|
136
|
+
#
|
137
|
+
def delete_location(location_id)
|
138
|
+
response, status = BeyondApi::Request.delete(@session, "/shop/locations/#{location_id}")
|
139
|
+
|
140
|
+
handle_response(response, status, respond_with_true: true)
|
141
|
+
end
|
142
|
+
|
143
|
+
#
|
144
|
+
# A +GET+ request is used to retrieve a particular location by its id.
|
145
|
+
#
|
146
|
+
# $ curl 'https://yourshop.api.urn/shop/locations/09ca2715-cdf7-4af3-8b22-9ecf39d1e202' -i -X GET \
|
147
|
+
# -H 'Accept: application/hal+json' \
|
148
|
+
# -H 'Authorization: Bearer <Access token>'
|
149
|
+
#
|
150
|
+
# @beyond_api.scopes +loca:r+
|
151
|
+
#
|
152
|
+
# @param location_id [String] the location UUID
|
153
|
+
#
|
154
|
+
# @return [OpenStruct]
|
155
|
+
#
|
156
|
+
# @example
|
157
|
+
# @location = session.shop.location("27a94b71-9b17-4f06-9596-fbbf4d18021f")
|
158
|
+
#
|
159
|
+
def location(location_id)
|
160
|
+
response, status = BeyondApi::Request.get(@session, "/shop/locations/#{location_id}")
|
161
|
+
|
162
|
+
handle_response(response, status)
|
163
|
+
end
|
164
|
+
|
165
|
+
#
|
166
|
+
# A +PUT+ request is used to update a location.
|
167
|
+
#
|
168
|
+
# $ curl 'https://yourshop.api.urn/shop/locations/a7a2acfa-0243-4e52-8b56-81cb781ce61d' -i -X PUT \
|
169
|
+
# -H 'Content-Type: application/json;charset=UTF-8' \
|
170
|
+
# -H 'Accept: application/hal+json' \
|
171
|
+
# -H 'Authorization: Bearer <Access token>' \
|
172
|
+
# -d '{
|
173
|
+
# "languageCode" : "en",
|
174
|
+
# "storeCode" : "",
|
175
|
+
# "locationName" : "UnhealthyThings",
|
176
|
+
# "primaryPhone" : "01234 691997",
|
177
|
+
# "address" : {
|
178
|
+
# "locality" : "London",
|
179
|
+
# "postalCode" : "1",
|
180
|
+
# "regionCode" : "GB",
|
181
|
+
# "addressLines" : [ "St. James Square", "ePages Ltd" ]
|
182
|
+
# },
|
183
|
+
# "primaryCategory" : {
|
184
|
+
# "categoryId" : "gcid:store",
|
185
|
+
# "displayName" : "Shop"
|
186
|
+
# },
|
187
|
+
# "websiteUrl" : "",
|
188
|
+
# "regularHours" : {
|
189
|
+
# "periods" : [ {
|
190
|
+
# "openDay" : "SATURDAY",
|
191
|
+
# "openTime" : "06:00",
|
192
|
+
# "closeDay" : "SATURDAY",
|
193
|
+
# "closeTime" : "22:00"
|
194
|
+
# } ]
|
195
|
+
# },
|
196
|
+
# "latLng" : {
|
197
|
+
# "latitude" : 51.5072,
|
198
|
+
# "longitude" : -0.1353
|
199
|
+
# }
|
200
|
+
# }'
|
201
|
+
#
|
202
|
+
# @beyond_api.scopes +loca:u+
|
203
|
+
#
|
204
|
+
# @param location_id [String] the location UUID
|
205
|
+
# @param body [Hash] the request body
|
206
|
+
#
|
207
|
+
# @return [OpenStruct]
|
208
|
+
#
|
209
|
+
# @example
|
210
|
+
# body = {
|
211
|
+
# "languageCode" => "de",
|
212
|
+
# "storeCode" => "",
|
213
|
+
# "locationName" => "HealthyThings",
|
214
|
+
# "primaryPhone" => "01522 3097093",
|
215
|
+
# "address" => {
|
216
|
+
# "locality" => "Hamburg",
|
217
|
+
# "postalCode" => "20253",
|
218
|
+
# "regionCode" => "DE",
|
219
|
+
# "addressLines" => [ "Pilatuspool 2", "ePages GmbH" ]
|
220
|
+
# },
|
221
|
+
# "primaryCategory" => {
|
222
|
+
# "categoryId" => "gcid:store",
|
223
|
+
# "displayName" => "Geschaeft"
|
224
|
+
# },
|
225
|
+
# "websiteUrl" => "",
|
226
|
+
# "regularHours" => {
|
227
|
+
# "periods" => [ {
|
228
|
+
# "openDay" => "MONDAY",
|
229
|
+
# "openTime" => "18:00",
|
230
|
+
# "closeDay" => "TUESDAY",
|
231
|
+
# "closeTime" => "03:00"
|
232
|
+
# }, {
|
233
|
+
# "openDay" => "WEDNESDAY",
|
234
|
+
# "openTime" => "17:00",
|
235
|
+
# "closeDay" => "WEDNESDAY",
|
236
|
+
# "closeTime" => "23:00"
|
237
|
+
# } ]
|
238
|
+
# },
|
239
|
+
# "latLng" : {
|
240
|
+
# "latitude" => 53.5847424,
|
241
|
+
# "longitude" => 9.968901
|
242
|
+
# }
|
243
|
+
# }
|
244
|
+
# @location = session.shop.update_location("27a94b71-9b17-4f06-9596-fbbf4d18021f", body)
|
245
|
+
#
|
246
|
+
def update_location(location_id, body)
|
247
|
+
response, status = BeyondApi::Request.put(@session, "/shop/locations/#{location_id}", body)
|
248
|
+
|
249
|
+
handle_response(response, status)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "beyond_api/utils"
|
4
|
-
require "beyond_api/resources/variations/images"
|
5
|
-
require "beyond_api/resources/variations/availability"
|
6
4
|
|
7
5
|
module BeyondApi
|
6
|
+
autoload :Images, "beyond_api/resources/variations/images"
|
7
|
+
autoload :Availability, "beyond_api/resources/variations/availability"
|
8
|
+
|
8
9
|
class Variations < Base
|
9
10
|
include BeyondApi::VariationImages
|
10
11
|
include BeyondApi::VariationAvailability
|
data/lib/beyond_api/session.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "beyond_api/resources/base"
|
4
|
-
require "beyond_api/resources/carts"
|
5
|
-
require "beyond_api/resources/categories_view"
|
6
|
-
require "beyond_api/resources/categories"
|
7
|
-
require "beyond_api/resources/checkout_settings"
|
8
|
-
require "beyond_api/resources/customers"
|
9
|
-
require "beyond_api/resources/newsletter_target"
|
10
|
-
require "beyond_api/resources/order_settings"
|
11
|
-
require "beyond_api/resources/orders"
|
12
|
-
require "beyond_api/resources/payment_methods"
|
13
|
-
require "beyond_api/resources/product_attribute_definitions"
|
14
|
-
require "beyond_api/resources/products_view"
|
15
|
-
require "beyond_api/resources/products"
|
16
|
-
require "beyond_api/resources/script_tags"
|
17
|
-
require "beyond_api/resources/shipping_zones"
|
18
|
-
require "beyond_api/resources/shop"
|
19
|
-
require "beyond_api/resources/signers"
|
20
|
-
require "beyond_api/resources/token"
|
21
|
-
require "beyond_api/resources/users"
|
22
|
-
require "beyond_api/resources/variations"
|
23
|
-
require "beyond_api/resources/webhook_subscriptions"
|
24
|
-
|
25
3
|
module BeyondApi
|
4
|
+
autoload :Base, "beyond_api/resources/base"
|
5
|
+
autoload :Carts, "beyond_api/resources/carts"
|
6
|
+
autoload :CategoriesView, "beyond_api/resources/categories_view"
|
7
|
+
autoload :Categories, "beyond_api/resources/categories"
|
8
|
+
autoload :CheckoutSettings, "beyond_api/resources/checkout_settings"
|
9
|
+
autoload :Customers, "beyond_api/resources/customers"
|
10
|
+
autoload :NewsletterTarget, "beyond_api/resources/newsletter_target"
|
11
|
+
autoload :OrderSettings, "beyond_api/resources/order_settings"
|
12
|
+
autoload :Orders, "beyond_api/resources/orders"
|
13
|
+
autoload :PaymentMethods, "beyond_api/resources/payment_methods"
|
14
|
+
autoload :ProductAttributeDefinitions, "beyond_api/resources/product_attribute_definitions"
|
15
|
+
autoload :ProductsView, "beyond_api/resources/products_view"
|
16
|
+
autoload :Products, "beyond_api/resources/products"
|
17
|
+
autoload :ScriptTags, "beyond_api/resources/script_tags"
|
18
|
+
autoload :ShippingZones, "beyond_api/resources/shipping_zones"
|
19
|
+
autoload :Shop, "beyond_api/resources/shop"
|
20
|
+
autoload :Signers, "beyond_api/resources/signers"
|
21
|
+
autoload :Token, "beyond_api/resources/token"
|
22
|
+
autoload :Users, "beyond_api/resources/users"
|
23
|
+
autoload :Variations, "beyond_api/resources/variations"
|
24
|
+
autoload :WebhookSubscriptions, "beyond_api/resources/webhook_subscriptions"
|
25
|
+
|
26
26
|
class Session
|
27
27
|
attr_reader :api_url
|
28
28
|
attr_accessor :access_token, :refresh_token
|
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.12.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: 2020-
|
13
|
+
date: 2020-08-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -160,6 +160,11 @@ files:
|
|
160
160
|
- lib/beyond_api/resources/script_tags.rb
|
161
161
|
- lib/beyond_api/resources/shipping_zones.rb
|
162
162
|
- lib/beyond_api/resources/shop.rb
|
163
|
+
- lib/beyond_api/resources/shops/address.rb
|
164
|
+
- lib/beyond_api/resources/shops/attributes.rb
|
165
|
+
- lib/beyond_api/resources/shops/images.rb
|
166
|
+
- lib/beyond_api/resources/shops/legals.rb
|
167
|
+
- lib/beyond_api/resources/shops/locations.rb
|
163
168
|
- lib/beyond_api/resources/signers.rb
|
164
169
|
- lib/beyond_api/resources/token.rb
|
165
170
|
- lib/beyond_api/resources/users.rb
|
@@ -190,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
195
|
- !ruby/object:Gem::Version
|
191
196
|
version: 1.3.1
|
192
197
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
198
|
+
rubygems_version: 3.1.2
|
194
199
|
signing_key:
|
195
200
|
specification_version: 4
|
196
201
|
summary: Ruby client to access the Beyond API
|