beyond_api 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +4 -0
- data/CONTRIBUTING.md +48 -0
- data/GETTING_STARTED.md +0 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +55 -0
- data/LICENSE +19 -0
- data/README.md +51 -0
- data/Rakefile +11 -0
- data/beyond_api.gemspec +31 -0
- data/bin/console +18 -0
- data/bin/setup +8 -0
- data/lib/beyond_api.rb +37 -0
- data/lib/beyond_api/connection.rb +30 -0
- data/lib/beyond_api/ext.rb +43 -0
- data/lib/beyond_api/request.rb +55 -0
- data/lib/beyond_api/resources/base.rb +17 -0
- data/lib/beyond_api/resources/carts.rb +547 -0
- data/lib/beyond_api/resources/categories.rb +168 -0
- data/lib/beyond_api/resources/categories_view.rb +142 -0
- data/lib/beyond_api/resources/checkout_settings.rb +48 -0
- data/lib/beyond_api/resources/newsletter_target.rb +97 -0
- data/lib/beyond_api/resources/order_settings.rb +80 -0
- data/lib/beyond_api/resources/orders.rb +968 -0
- data/lib/beyond_api/resources/payment_methods.rb +192 -0
- data/lib/beyond_api/resources/product_attribute_definitions.rb +109 -0
- data/lib/beyond_api/resources/product_settings.rb +28 -0
- data/lib/beyond_api/resources/products.rb +245 -0
- data/lib/beyond_api/resources/products/attachments.rb +119 -0
- data/lib/beyond_api/resources/products/availability.rb +177 -0
- data/lib/beyond_api/resources/products/custom_attributes.rb +141 -0
- data/lib/beyond_api/resources/products/images.rb +165 -0
- data/lib/beyond_api/resources/products/searches.rb +52 -0
- data/lib/beyond_api/resources/products/variation_properties.rb +87 -0
- data/lib/beyond_api/resources/products_view.rb +158 -0
- data/lib/beyond_api/resources/scopes.rb +31 -0
- data/lib/beyond_api/resources/script_tags.rb +122 -0
- data/lib/beyond_api/resources/shipping_zones.rb +324 -0
- data/lib/beyond_api/resources/shop.rb +561 -0
- data/lib/beyond_api/resources/signers.rb +63 -0
- data/lib/beyond_api/resources/token.rb +41 -0
- data/lib/beyond_api/resources/users.rb +376 -0
- data/lib/beyond_api/resources/variations.rb +145 -0
- data/lib/beyond_api/resources/variations/availability.rb +105 -0
- data/lib/beyond_api/resources/webhook_subscriptions.rb +176 -0
- data/lib/beyond_api/session.rb +121 -0
- data/lib/beyond_api/utils.rb +51 -0
- data/lib/beyond_api/version.rb +3 -0
- data/lib/generators/beyond_api/install_generator.rb +13 -0
- data/lib/generators/templates/beyond_api_initializer.rb +29 -0
- metadata +194 -0
@@ -0,0 +1,145 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "beyond_api/utils"
|
4
|
+
|
5
|
+
module BeyondApi
|
6
|
+
class Variations < Base
|
7
|
+
include BeyondApi::Utils
|
8
|
+
|
9
|
+
#
|
10
|
+
# A +GET+ request is used to retrieve the variations of a product.
|
11
|
+
#
|
12
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/dc1b5caf-51ea-4fcd-b1ba-0c5128e91d17/variations' -i -X GET \
|
13
|
+
# -H 'Content-Type: application/json' \
|
14
|
+
# -H 'Authorization: Bearer <Access token>'
|
15
|
+
#
|
16
|
+
# @beyond_api.scopes +prod:r+
|
17
|
+
#
|
18
|
+
# @option params [Integer] :size the page size
|
19
|
+
# @option params [Integer] :page the page number
|
20
|
+
#
|
21
|
+
# @return [OpenStruct]
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# @products = session.variations.all(size: 100, page: 0)
|
25
|
+
#
|
26
|
+
def all(product_id, params = {})
|
27
|
+
response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/variations", params)
|
28
|
+
|
29
|
+
handle_response(response, status)
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# A +GET+ request is used to retrieve the variation of a product.
|
34
|
+
#
|
35
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/5f6e426e-c8d9-48ba-9b37-9a8eb6381373/variations/f6e5bb16-af2e-440f-acd3-a883ad3c1922' -i -X GET \
|
36
|
+
# -H 'Content-Type: application/json' \
|
37
|
+
# -H 'Accept: application/hal+json' \
|
38
|
+
# -H 'Authorization: Bearer <Access token>'
|
39
|
+
#
|
40
|
+
# @beyond_api.scopes +prod:r+
|
41
|
+
#
|
42
|
+
# @param product_id [String] the product UUID
|
43
|
+
# @param variation_id [String] the variation UUID
|
44
|
+
#
|
45
|
+
# @return [OpenStruct]
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# @product = session.variations.find("f461fb56-1984-4ade-bd4e-007c273cc923", "f6e5bb16-af2e-440f-acd3-a883ad3c1922")
|
49
|
+
#
|
50
|
+
def find(product_id, variation_id)
|
51
|
+
response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/variations/#{variation_id}")
|
52
|
+
|
53
|
+
handle_response(response, status)
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# A +PATCH+ request is used to update a variation partially with json content type.
|
58
|
+
#
|
59
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/7cf4b5b1-b141-4869-96d1-4eaee8bf7563/variations/9f93fdd0-2d21-4ea9-b9d7-e9a53edb091b' -i -X PATCH \
|
60
|
+
# -H 'Content-Type: application/json' \
|
61
|
+
# -H 'Accept: application/hal+json' \
|
62
|
+
# -H 'Authorization: Bearer <Access token>' \
|
63
|
+
# -d '{
|
64
|
+
# "salesPrice" : {
|
65
|
+
# "taxModel" : "NET",
|
66
|
+
# "amount" : 8.7,
|
67
|
+
# "currency" : "EUR"
|
68
|
+
# },
|
69
|
+
# "listPrice" : {
|
70
|
+
# "taxModel" : "NET",
|
71
|
+
# "amount" : 10.95,
|
72
|
+
# "currency" : "EUR"
|
73
|
+
# },
|
74
|
+
# "manufacturerPrice" : {
|
75
|
+
# "taxModel" : "NET",
|
76
|
+
# "amount" : 99.95,
|
77
|
+
# "currency" : "EUR"
|
78
|
+
# },
|
79
|
+
# "refPrice" : {
|
80
|
+
# "refQuantity" : 1,
|
81
|
+
# "unit" : "LITER",
|
82
|
+
# "quantity" : 0.75,
|
83
|
+
# "price" : {
|
84
|
+
# "taxModel" : "NET",
|
85
|
+
# "amount" : 11.6,
|
86
|
+
# "currency" : "EUR"
|
87
|
+
# }
|
88
|
+
# },
|
89
|
+
# "sku" : "my-new-sku",
|
90
|
+
# "productIdentifiers" : [ {
|
91
|
+
# "type" : "EAN",
|
92
|
+
# "value" : "9780134308135"
|
93
|
+
# } ]
|
94
|
+
# }'
|
95
|
+
#
|
96
|
+
# @beyond_api.scopes +prod:u+
|
97
|
+
#
|
98
|
+
# @param product_id [String] the product UUID
|
99
|
+
# @param variation_id [String] the variation UUID
|
100
|
+
# @param body [Hash] the request body
|
101
|
+
#
|
102
|
+
# @return [OpenStruct]
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# body = {
|
106
|
+
# "salesPrice": {
|
107
|
+
# "taxModel": "NET",
|
108
|
+
# "amount": 8.7,
|
109
|
+
# "currency": "EUR"
|
110
|
+
# },
|
111
|
+
# "listPrice": {
|
112
|
+
# "taxModel": "NET",
|
113
|
+
# "amount": 10.95,
|
114
|
+
# "currency": "EUR"
|
115
|
+
# },
|
116
|
+
# "manufacturerPrice": {
|
117
|
+
# "taxModel": "NET",
|
118
|
+
# "amount": 99.95,
|
119
|
+
# "currency": "EUR"
|
120
|
+
# },
|
121
|
+
# "refPrice": {
|
122
|
+
# "refQuantity": 1,
|
123
|
+
# "unit": "LITER",
|
124
|
+
# "quantity": 0.75,
|
125
|
+
# "price": {
|
126
|
+
# "taxModel": "NET",
|
127
|
+
# "amount": 11.6,
|
128
|
+
# "currency": "EUR"
|
129
|
+
# }
|
130
|
+
# },
|
131
|
+
# "sku": "my-new-sku",
|
132
|
+
# "productIdentifiers": [{
|
133
|
+
# "type": "EAN",
|
134
|
+
# "value": "9780134308135"
|
135
|
+
# }]
|
136
|
+
# }
|
137
|
+
# @product = session.variations.update("f461fb56-1984-4ade-bd4e-007c273cc923", "f6e5bb16-af2e-440f-acd3-a883ad3c1922", body)
|
138
|
+
#
|
139
|
+
def update(product_id, variation_id, body)
|
140
|
+
response, status = BeyondApi::Request.patch(@session, "/products/#{product_id}/variations/#{variation_id}", body)
|
141
|
+
|
142
|
+
handle_response(response, status)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "beyond_api/utils"
|
4
|
+
|
5
|
+
module BeyondApi
|
6
|
+
module VariationAvailability
|
7
|
+
|
8
|
+
#
|
9
|
+
# A +POST+ request is used to adjust the available stock of a variation.
|
10
|
+
#
|
11
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/9171c3ed-0b53-43ef-8fed-c081f55560f4/variations/a6d8275f-66cd-4cd7-8623-2d005f1ab7fc/availability/adjust-available-stock' -i -X POST \
|
12
|
+
# -H 'Content-Type: application/json' \
|
13
|
+
# -H 'Accept: application/hal+json' \
|
14
|
+
# -H 'Authorization: Bearer <Access token>' \
|
15
|
+
# -d '{ "relativeAmount" : -1 }'
|
16
|
+
#
|
17
|
+
# @beyond_api.scopes +prda:u+
|
18
|
+
#
|
19
|
+
# @param product_id [String] the product UUID
|
20
|
+
# @param variation_id [String] the product variation UUID
|
21
|
+
# @param body [Hash] the request body
|
22
|
+
#
|
23
|
+
# @return [OpenStruct]
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# @availability = session.variations.adjust_stock_level(product_id, variation_id, { relativeAmount => -1 })
|
27
|
+
#
|
28
|
+
def adjust_stock_level(product_id, variation_id, body)
|
29
|
+
response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/variations/#{variation_id}/availability/enable-stock-management", body)
|
30
|
+
|
31
|
+
handle_response(response, status)
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# A +GET+ request is used to retrieve the availability of a variation.
|
36
|
+
#
|
37
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/7fdc9424-1ddd-4fba-a59d-3d5de08d89d1/variations/13b28149-975a-4f47-ad54-bdc4ca4a07ec/availability' -i -X GET \
|
38
|
+
# -H 'Content-Type: application/json' \
|
39
|
+
# -H 'Accept: application/hal+json' \
|
40
|
+
# -H 'Authorization: Bearer <Access token>'
|
41
|
+
#
|
42
|
+
# @beyond_api.scopes +prda:r+
|
43
|
+
#
|
44
|
+
# @param product_id [String] the product UUID
|
45
|
+
# @param variation_id [String] the product variation UUID
|
46
|
+
#
|
47
|
+
# @return [OpenStruct]
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# @availability = session.variations.availability("fb22d408-00dc-47e3-ae58-e35769bdb428", "13b28149-975a-4f47-ad54-bdc4ca4a07ec")
|
51
|
+
#
|
52
|
+
def availability(product_id, variation_id)
|
53
|
+
response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/variations/#{variation_id}/availability")
|
54
|
+
|
55
|
+
handle_response(response, status)
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# A +POST+ request is used to enable purchasability for a variation.
|
60
|
+
#
|
61
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/131400c9-54f1-4510-a0c4-2c7e34c57336/variations/cec06f66-5a80-4638-a74c-c916e1173c21/availability/enable-purchasability' -i -X POST \
|
62
|
+
# -H 'Content-Type: application/json' \
|
63
|
+
# -H 'Accept: application/hal+json' \
|
64
|
+
# -H 'Authorization: Bearer <Access token>'
|
65
|
+
#
|
66
|
+
# @beyond_api.scopes +prda:u+
|
67
|
+
#
|
68
|
+
# @param product_id [String] the product UUID
|
69
|
+
# @param variation_id [String] the product variation UUID
|
70
|
+
#
|
71
|
+
# @return [OpenStruct]
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# @availability = session.variations.enable_purchaability("1e3a92b-6f3b-4415-bd8f-c9c8921a5a73", "13b28149-975a-4f47-ad54-bdc4ca4a07ec")
|
75
|
+
#
|
76
|
+
def enable_purchasability(product_id, variation_id)
|
77
|
+
response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/variations/#{variation_id}/availability/enable-purchasability")
|
78
|
+
|
79
|
+
handle_response(response, status)
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# A +POST+ request is used to disable purchasability for a variation.
|
84
|
+
#
|
85
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/f3b9d880-b73e-45a4-b04c-e03acae4fcdd/variations/40337e9c-a187-4bb6-9a0d-c8d66386cb8d/availability/disable-purchasability' -i -X POST \
|
86
|
+
# -H 'Content-Type: application/json' \
|
87
|
+
# -H 'Accept: application/hal+json' \
|
88
|
+
# -H 'Authorization: Bearer <Access token>'
|
89
|
+
#
|
90
|
+
# @beyond_api.scopes +prda:u+
|
91
|
+
#
|
92
|
+
# @param product_id [String] the product UUID
|
93
|
+
#
|
94
|
+
# @return true
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
# @availability = session.variations.disable_purchasability("17e3a92b-6f3b-4415-bd8f-c9c8921a5a73", "13b28149-975a-4f47-ad54-bdc4ca4a07ec")
|
98
|
+
#
|
99
|
+
def disable_purchasability(product_id, variation_id)
|
100
|
+
response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/variations/#{variation_id}/availability/disable-purchasability")
|
101
|
+
|
102
|
+
handle_response(response, status)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "beyond_api/utils"
|
4
|
+
|
5
|
+
module BeyondApi
|
6
|
+
class WebhookSubscriptions < Base # :category: Resources
|
7
|
+
include BeyondApi::Utils
|
8
|
+
|
9
|
+
#
|
10
|
+
# A +POST+ request is used to activate a webhook subscription.
|
11
|
+
#
|
12
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/268a8629-55cd-4890-9013-936b9b5ea14c/activate' -i -X POST \
|
13
|
+
# -H 'Authorization: Bearer <Access token>'
|
14
|
+
#
|
15
|
+
# @beyond_api.scopes +ordr:r+, +prod:r+
|
16
|
+
#
|
17
|
+
# @param webhook_subscription_id [String] the webhook subscription UUID
|
18
|
+
#
|
19
|
+
# @return true
|
20
|
+
#
|
21
|
+
# @example Ruby example request
|
22
|
+
# session.webhook_subscriptions.activate("268a8629-55cd-4890-9013-936b9b5ea14c")
|
23
|
+
#
|
24
|
+
def activate(webhook_subscription_id)
|
25
|
+
response, status = BeyondApi::Request.post(@session, "/webhook-subscriptions/#{webhook_subscription_id}/activate")
|
26
|
+
|
27
|
+
handle_response(response, status, respond_with_true: true)
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# A +GET+ request is used to list all of the webhook subscriptions in a paged way.
|
32
|
+
#
|
33
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions' -i -X GET \
|
34
|
+
# -H 'Accept: application/hal+json' \
|
35
|
+
# -H 'Authorization: Bearer <Access token>'
|
36
|
+
#
|
37
|
+
# @option params [Integer] :size the page size
|
38
|
+
# @option params [Integer] :page the page number
|
39
|
+
#
|
40
|
+
# @return [OpenStruct]
|
41
|
+
#
|
42
|
+
# @example
|
43
|
+
# @webhook_subscriptions = session.webhook_subscriptions.all(size: 100, page: 0)
|
44
|
+
#
|
45
|
+
def all(params = {})
|
46
|
+
response, status = BeyondApi::Request.get(@session, "/webhook-subscriptions", params)
|
47
|
+
|
48
|
+
handle_response(response, status)
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# A +POST+ request is used to create a webhook subscription.
|
53
|
+
#
|
54
|
+
# The scopes needed for the operation depend on the event types you register for. e.g. Order events require the scope +orde:r+.
|
55
|
+
#
|
56
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions' -i -X POST \
|
57
|
+
# -H 'Content-Type: application/json' \
|
58
|
+
# -H 'Accept: application/hal+json' \
|
59
|
+
# -H 'Authorization: Bearer <Access token>' \
|
60
|
+
# -d '{
|
61
|
+
# "callbackUri":"http://example.com/test",
|
62
|
+
# "eventTypes": ["order.created", "product.created"]
|
63
|
+
# }'
|
64
|
+
#
|
65
|
+
# @param body [Hash] the request body
|
66
|
+
#
|
67
|
+
# @return [OpenStruct]
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# body = {
|
71
|
+
# "callback_uri" => "http://example.com/test",
|
72
|
+
# "event_types" => ["order.created", "product.created"]
|
73
|
+
# }
|
74
|
+
#
|
75
|
+
# @webhook_subscription = session.webhook_subscriptions.create(body)
|
76
|
+
#
|
77
|
+
def create(body)
|
78
|
+
response, status = BeyondApi::Request.post(@session, "/webhook-subscriptions", body)
|
79
|
+
|
80
|
+
handle_response(response, status)
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# A +POST+ request is used to deactivate a webhook subscription.
|
85
|
+
#
|
86
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/a597cea4-b688-4164-8c56-b6568ea4d5aa/deactivate' -i -X POST \
|
87
|
+
# -H 'Authorization: Bearer <Access token>'
|
88
|
+
#
|
89
|
+
# @param webhook_subscription_id [String] the webhook subscription UUID
|
90
|
+
#
|
91
|
+
# @return true
|
92
|
+
#
|
93
|
+
# @example
|
94
|
+
# session.webhook_subscriptions.deactivate("a597cea4-b688-4164-8c56-b6568ea4d5aa")
|
95
|
+
#
|
96
|
+
def deactivate(webhook_subscription_id)
|
97
|
+
response, status = BeyondApi::Request.post(@session, "/webhook-subscriptions/#{webhook_subscription_id}/deactivate")
|
98
|
+
|
99
|
+
handle_response(response, status, respond_with_true: true)
|
100
|
+
end
|
101
|
+
|
102
|
+
#
|
103
|
+
# A +DELETE+ request is used to delete a webhook subscription.
|
104
|
+
#
|
105
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/c6076a5a-a8ad-443f-b20b-8a1b268b069e' -i -X DELETE \
|
106
|
+
# -H 'Authorization: Bearer <Access token>'
|
107
|
+
#
|
108
|
+
# @param webhook_subscription_id [String] the webhook subscription UUID
|
109
|
+
#
|
110
|
+
# @return true
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
# webhook_subscriptions = session.webhook_subscriptions.delete("c6076a5a-a8ad-443f-b20b-8a1b268b069e")
|
114
|
+
#
|
115
|
+
def delete(webhook_subscription_id)
|
116
|
+
response, status = BeyondApi::Request.delete(@session, "/webhook-subscriptions/#{webhook_subscription_id}")
|
117
|
+
|
118
|
+
handle_response(response, status, respond_with_true: true)
|
119
|
+
end
|
120
|
+
|
121
|
+
#
|
122
|
+
# A +GET+ request is used to retrieve the details of a webook subscription.
|
123
|
+
#
|
124
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/3d44ec71-768c-4927-9069-a96a5153e87c' -i -X GET \
|
125
|
+
# -H 'Accept: application/hal+json' \
|
126
|
+
# -H 'Authorization: Bearer <Access token>'
|
127
|
+
#
|
128
|
+
# @param webhook_subscription_id [String] the webhook subscription UUID
|
129
|
+
#
|
130
|
+
# @return [OpenStruct]
|
131
|
+
#
|
132
|
+
# @example
|
133
|
+
# @webhook_subscription = session.webhook_subscriptions.find("3d44ec71-768c-4927-9069-a96a5153e87c")
|
134
|
+
#
|
135
|
+
def find(webhook_subscription_id)
|
136
|
+
response, status = BeyondApi::Request.get(@session, "/webhook-subscriptions/#{webhook_subscription_id}")
|
137
|
+
|
138
|
+
handle_response(response, status)
|
139
|
+
end
|
140
|
+
|
141
|
+
#
|
142
|
+
# A +PUT+ request is used to update a subscription.
|
143
|
+
#
|
144
|
+
# The scopes needed for the operation depend on the event types you register for. e.g. Order events require the scope +orde:r+.
|
145
|
+
#
|
146
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/6f3bc033-c2d1-4f44-80e3-1b668f6bd699' -i -X PUT \
|
147
|
+
# -H 'Content-Type: application/json' \
|
148
|
+
# -H 'Accept: application/hal+json' \
|
149
|
+
# -H 'Authorization: Bearer <Access token>' \
|
150
|
+
# -d '{
|
151
|
+
# "callbackUri":"http://example.com/test/updated",
|
152
|
+
# "eventTypes": ["product.updated"]
|
153
|
+
# }'
|
154
|
+
#
|
155
|
+
# @beyond_api.scopes +ordr:r+, +prod:r+
|
156
|
+
#
|
157
|
+
# @param webhook_subscription_id [String] the webhook subscription UUID
|
158
|
+
# @param body [Hash] the request body
|
159
|
+
#
|
160
|
+
# @return [OpenStruct]
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# body = {
|
164
|
+
# "callback_uri" => "http://example.com/test/updated",
|
165
|
+
# "event_types" => ["product.updated"]
|
166
|
+
# }
|
167
|
+
#
|
168
|
+
# @webhook_subscription = session.webhook_subscriptions.update("6f3bc033-c2d1-4f44-80e3-1b668f6bd699", body)
|
169
|
+
#
|
170
|
+
def update(webhook_subscription_id, body)
|
171
|
+
response, status = BeyondApi::Request.put(@session, "/webhook-subscriptions/#{webhook_subscription_id}", body)
|
172
|
+
|
173
|
+
handle_response(response, status)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
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/newsletter_target"
|
9
|
+
require "beyond_api/resources/order_settings"
|
10
|
+
require "beyond_api/resources/orders"
|
11
|
+
require "beyond_api/resources/payment_methods"
|
12
|
+
require "beyond_api/resources/product_attribute_definitions"
|
13
|
+
require "beyond_api/resources/product_settings"
|
14
|
+
require "beyond_api/resources/products_view"
|
15
|
+
require "beyond_api/resources/products"
|
16
|
+
require "beyond_api/resources/scopes"
|
17
|
+
require "beyond_api/resources/script_tags"
|
18
|
+
require "beyond_api/resources/shipping_zones"
|
19
|
+
require "beyond_api/resources/shop"
|
20
|
+
require "beyond_api/resources/signers"
|
21
|
+
require "beyond_api/resources/token"
|
22
|
+
require "beyond_api/resources/users"
|
23
|
+
require "beyond_api/resources/variations"
|
24
|
+
require "beyond_api/resources/webhook_subscriptions"
|
25
|
+
|
26
|
+
module BeyondApi
|
27
|
+
class Session
|
28
|
+
attr_reader :api_url
|
29
|
+
attr_accessor :access_token, :refresh_token
|
30
|
+
|
31
|
+
def initialize(api_url:, access_token: nil, refresh_token: nil)
|
32
|
+
@api_url = api_url
|
33
|
+
@access_token = access_token
|
34
|
+
@refresh_token = refresh_token
|
35
|
+
end
|
36
|
+
|
37
|
+
def carts
|
38
|
+
BeyondApi::Carts.new(self)
|
39
|
+
end
|
40
|
+
|
41
|
+
def categories_view
|
42
|
+
BeyondApi::CategoriesView.new(self)
|
43
|
+
end
|
44
|
+
|
45
|
+
def categories
|
46
|
+
BeyondApi::Categories.new(self)
|
47
|
+
end
|
48
|
+
|
49
|
+
def checkout_settings
|
50
|
+
BeyondApi::CheckoutSettings.new(self)
|
51
|
+
end
|
52
|
+
|
53
|
+
def newsletter_target
|
54
|
+
BeyondApi::NewsletterTarget.new(self)
|
55
|
+
end
|
56
|
+
|
57
|
+
def order_settings
|
58
|
+
BeyondApi::OrderSettings.new(self)
|
59
|
+
end
|
60
|
+
|
61
|
+
def orders
|
62
|
+
BeyondApi::Orders.new(self)
|
63
|
+
end
|
64
|
+
|
65
|
+
def payment_methods
|
66
|
+
BeyondApi::PaymentMethods.new(self)
|
67
|
+
end
|
68
|
+
|
69
|
+
def product_attribute_definitions
|
70
|
+
BeyondApi::ProductAttributeDefinitions.new(self)
|
71
|
+
end
|
72
|
+
|
73
|
+
def product_settings
|
74
|
+
BeyondApi::ProductSettings.new(self)
|
75
|
+
end
|
76
|
+
|
77
|
+
def products_view
|
78
|
+
BeyondApi::ProductsView.new(self)
|
79
|
+
end
|
80
|
+
|
81
|
+
def products
|
82
|
+
BeyondApi::Products.new(self)
|
83
|
+
end
|
84
|
+
|
85
|
+
def scopes
|
86
|
+
BeyondApi::Scopes.new(self)
|
87
|
+
end
|
88
|
+
|
89
|
+
def script_tags
|
90
|
+
BeyondApi::ScriptTags.new(self)
|
91
|
+
end
|
92
|
+
|
93
|
+
def shipping_zones
|
94
|
+
BeyondApi::ShippingZones.new(self)
|
95
|
+
end
|
96
|
+
|
97
|
+
def shop
|
98
|
+
BeyondApi::Shop.new(self)
|
99
|
+
end
|
100
|
+
|
101
|
+
def signers
|
102
|
+
BeyondApi::Signers.new(self)
|
103
|
+
end
|
104
|
+
|
105
|
+
def token
|
106
|
+
BeyondApi::Token.new(self)
|
107
|
+
end
|
108
|
+
|
109
|
+
def users
|
110
|
+
BeyondApi::Users.new(self)
|
111
|
+
end
|
112
|
+
|
113
|
+
def variations
|
114
|
+
BeyondApi::Variations.new(self)
|
115
|
+
end
|
116
|
+
|
117
|
+
def webhook_subscriptions
|
118
|
+
BeyondApi::WebhookSubscriptions.new(self)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|