Skip to content

Commit 0a9786b

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e17f14c + e4b1096 commit 0a9786b

32 files changed

+1340
-374
lines changed

CHANGELOG.md

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,61 @@
1+
### v0.6.0.pre
2+
3+
* bug-fixes
4+
* Fix `Carts#create` method
5+
* Fix `Carts#set_shipping_method_to_default` method
6+
* Fix `OrderSettings#update` method
7+
* Fix `Orders#capture_payment_process` method
8+
* Fix `Orders#create_cancelation_process` method
9+
* Fix `Products#attachments` method
10+
* Fix `Products#adjust_stock_level` method
11+
* Fix `Products#add_image` method
12+
* Fix `Products#set_image_as_default` method
13+
* Fix `ProductsView#all` method
14+
* Fix `Shops#legal_content` method
15+
* Fix `Shops#legal_contents` method
16+
* Fix `Shops#update` method
17+
* Fix `Users#verify_password` method
18+
19+
* deprecations
20+
* Remove `Orders#send_invoice` method
21+
* Remove all product_settings methods
22+
* Remove `ProductsView#search_by_query` method
23+
* `Orders#update_order_note` receives parameter `order_note` instead of `body`
24+
* `Products#adjust_stock_level` receives parameter `relative_amount` instead of `body`
25+
* `Products#update_reserve_stock` receives parameter `stock_threshold` instead of `body`
26+
27+
* features
28+
* Add customers methods
29+
* `Customers#all`
30+
* `Customers#create`
31+
* `Customers#delete`
32+
* `Customers#find`
33+
* `Customers#update`
34+
* Add `Orders#send_order_document` method
35+
* Add products cross-sells methods
36+
* `ProductCrossSells#create_cross_sell`
37+
* `ProductCrossSells#cross_sell`
38+
* `ProductCrossSells#cross_sells`
39+
* `ProductCrossSells#delete_cross_sell`
40+
* `ProductCrossSells#update_cross_sell`
41+
* Add products videos methods
42+
* `ProductVideos#add_video`
43+
* `ProductVideos#delete_video`
44+
* `ProductVideos#update_video`
45+
* `ProductVideos#video`
46+
* `ProductVideos#videos`
47+
* Add `Products#sort_images` method
48+
* Add variation images methods
49+
* `VariationImages#add_image`
50+
* `VariationImages#delete_image`
51+
* `VariationImages#image`
52+
* `VariationImages#images`
53+
* `VariationImages#upload_image`
54+
155
### v0.5.1.pre
256

357
* bug-fixes
4-
* Fix `adjust_stock_level` method
58+
* Fix `Products#adjust_stock_level` method
559

660
### v0.5.0.pre
761

@@ -16,8 +70,8 @@
1670
### v0.4.0.pre
1771

1872
* bug-fixes
19-
* Fix product attribute definition `create` method
20-
* Fix product attribute definition `delete` method
73+
* Fix `ProductAttributeDefinitions#create` method
74+
* Fix `ProductAttributeDefinitions#delete` method
2175
* Fix product custom attribute module name
2276
* Include `BeyondApi::ProductCustomAttributes` module into `BeyondApi::Products` class
2377
* Include `BeyondApi::ProductImages` module into `BeyondApi::Products` class

GETTING_STARTED.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ session.token.refresh
3737

3838
## Consuming the API
3939

40+
Check the [_rubydoc_ documentation](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client) for more information on the Beyond API Ruby Client.
41+
4042
Here you can find a list with all available methods:
4143

4244
* Carts

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
beyond_api (0.5.1.pre)
4+
beyond_api (0.6.0.pre)
55
faraday (~> 0.15)
66

77
GEM
@@ -13,7 +13,7 @@ GEM
1313
dotenv (2.7.5)
1414
faker (2.4.0)
1515
i18n (~> 1.6.0)
16-
faraday (0.17.1)
16+
faraday (0.17.3)
1717
multipart-post (>= 1.2, < 3)
1818
i18n (1.6.0)
1919
concurrent-ruby (~> 1.0)
@@ -52,4 +52,4 @@ DEPENDENCIES
5252
yard (~> 0.9)
5353

5454
BUNDLED WITH
55-
2.0.2
55+
2.1.0.pre.3

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Beyond API Ruby Client
22

33
![Gem Version](https://img.shields.io/gem/v/beyond_api?label=gem%20version)
4+
[![Docs](https://img.shields.io/badge/docs-rubydoc-blue)](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client)
45
[![Maintainability](https://api.codeclimate.com/v1/badges/1d173fa0b393e8eaf2a2/maintainability)](https://codeclimate.com/github/ePages-de/beyond_api-ruby_client/maintainability)
56
![License](https://img.shields.io/github/license/ePages-de/beyond_api-ruby_client)
67

lib/beyond_api/resources/carts.rb

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def add_line_item(cart_id, body)
4343
# @example
4444
# @cart = session.carts.create
4545
#
46-
def create(body)
47-
response, status = BeyondApi::Request.post(@session, "/carts", body)
46+
def create
47+
response, status = BeyondApi::Request.post(@session, "/carts")
4848

4949
handle_response(response, status)
5050
end
@@ -202,7 +202,7 @@ def delete_line_item(cart_id, line_item_id)
202202
# @return true
203203
#
204204
# @example
205-
# session.carts.delete_line_item("2fa7dc36-8305-4628-b961-f2c3f7dda47d")
205+
# session.carts.delete_shipping_address("2fa7dc36-8305-4628-b961-f2c3f7dda47d")
206206
#
207207
def delete_shipping_address(cart_id)
208208
response, status = BeyondApi::Request.delete(@session, "/carts/#{cart_id}/shipping-address")
@@ -290,6 +290,7 @@ def payment_methods(cart_id)
290290
# "_ref" => "f084553c-ea77-4745-b1bd-71c64c8419fd",
291291
# "quantity" => 2
292292
# }
293+
#
293294
# @cart = session.carts.replace_line_item("f73629e5-fecf-4474-9b04-6b2fcd4663c4", "2c9c0f38-0b9e-4fa7-bcbe-960098ff63aa", body)
294295
#
295296
def replace_line_item(cart_id, line_item_id, body)
@@ -311,8 +312,13 @@ def replace_line_item(cart_id, line_item_id, body)
311312
# @return [OpenStruct]
312313
#
313314
# @example
314-
# body = [{"_type":"PRODUCT","_ref":"0612362d-9856-4b40-94c6-a36abec0cf8c","quantity":1}]
315-
# @cart = session.carts.replace_line_item("c1436110-e283-49b3-a748-0321efec6d35", body)
315+
# body = [ {
316+
# "_type" => "PRODUCT",
317+
# "_ref" => "0612362d-9856-4b40-94c6-a36abec0cf8c",
318+
# "quantity" => 1
319+
# } ]
320+
#
321+
# @cart = session.carts.replace_line_items("c1436110-e283-49b3-a748-0321efec6d35", body)
316322
#
317323
def replace_line_items(cart_id, body)
318324
response, status = BeyondApi::Request.put(@session, "/carts/#{cart_id}/line-items", body)
@@ -361,6 +367,7 @@ def replace_line_items(cart_id, body)
361367
# "taxNumber" => "123-34-6789",
362368
# "birthDate" => "1985-03-20"
363369
# }
370+
#
364371
# @cart = session.carts.set_billing_address("01da6aa7-8aa2-4383-a496-6611a14afbc9", body)
365372
#
366373
def set_billing_address(cart_id, body)
@@ -453,6 +460,7 @@ def set_payment_method_to_default(cart_id)
453460
# "taxNumber" => "123-34-6789",
454461
# "birthDate" => "1985-03-20"
455462
# }
463+
#
456464
# @cart = session.carts.set_shipping_address("01da6aa7-8aa2-4383-a496-6611a14afbc9", body)
457465
#
458466
def set_shipping_address(cart_id, body)
@@ -489,7 +497,7 @@ def set_shipping_method(cart_id, shipping_zone_id, shipping_method_id)
489497
# A +PUT+ request is used to set the shipping method to the current default shipping method.
490498
# The default shipping method is the one with the highest priority of the applicable shipping methods.
491499
#
492-
# $ curl 'https://api-shop.beyondshop.cloud/api/carts/64efe22b-2699-4032-a2c9-c94a2e4fa425/shipping-methods/default' -i -X PUT \
500+
# $ curl 'https://api-shop.beyondshop.cloud/api/carts/c31c5d06-4460-4f89-9e09-47f9956dea98/shipping-methods/default' -i -X PUT \
493501
# -H 'Content-Type: application/json' \
494502
# -H 'Accept: application/json'
495503
#
@@ -498,11 +506,10 @@ def set_shipping_method(cart_id, shipping_zone_id, shipping_method_id)
498506
# @return [OpenStruct]
499507
#
500508
# @example
501-
# @cart = session.carts.set_shipping_method_to_default("a4e7922a-f895-4a7d-8cb1-6ecf74d7ceba")
509+
# @cart = session.carts.set_shipping_method_to_default("c31c5d06-4460-4f89-9e09-47f9956dea98")
502510
#
503511
def set_shipping_method_to_default(cart_id)
504-
response, status = BeyondApi::Request.put(@session, "/carts/#{cart_id}/shipping-methods/current",
505-
"#{session.api_url}/shipping-zones/#{shipping_zone_id}/shipping-methods/#{shipping_method_id}")
512+
response, status = BeyondApi::Request.put(@session, "/carts/#{cart_id}/shipping-methods/default")
506513

507514
handle_response(response, status)
508515
end
@@ -523,6 +530,7 @@ def set_shipping_method_to_default(cart_id)
523530
#
524531
def shipping_method(cart_id)
525532
response, status = BeyondApi::Request.get(@session, "/carts/#{cart_id}")
533+
526534
handle_response(response, status)
527535
end
528536

@@ -541,6 +549,7 @@ def shipping_method(cart_id)
541549
#
542550
def shipping_methods(cart_id)
543551
response, status = BeyondApi::Request.get(@session, "/carts/#{cart_id}")
552+
544553
handle_response(response, status)
545554
end
546555
end

lib/beyond_api/resources/categories.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def delete(category_id)
9696
# @return [OpenStruct]
9797
#
9898
# @example
99-
# @category = session.categories.find(category_id)
99+
# @category = session.categories.find("27a94b71-9b17-4f06-9596-fbbf4d18021f")
100100
#
101101
def find(category_id)
102102
response, status = BeyondApi::Request.get(@session, "/categories/#{category_id}")
@@ -135,7 +135,7 @@ def patch(category_id, body)
135135
end
136136

137137
#
138-
# A PUT request is issued to update all category properties with application/json content type.
138+
# A +PUT+ request is issued to update all category properties with application/json content type.
139139
#
140140
# $ curl 'https://api-shop.beyondshop.cloud/api/categories/cb2058dc-871a-4e64-83ac-39a0be9e6f82' -i -X PUT \
141141
# -H 'Content-Type: application/json' \

lib/beyond_api/resources/categories_view.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,23 @@ def search_by_product_id(product_id, params = {})
126126
# }
127127
# }'
128128
#
129-
# @param product_id [String] the product UUID of the category
129+
# @param body [Hash] the request body
130+
# @option params [Integer] :size the page size
131+
# @option params [Integer] :page the page number
130132
#
131133
# @return [OpenStruct]
132134
#
133135
# @example
134-
# @category = session.categories_view.search_by_product_id("ba68427f-603c-4741-9185-3b379f7769b5")
136+
# body = {
137+
# "tags" => [ "books" ],
138+
# "manufacturer" => "The Standard Manufacturer",
139+
# "sales_price" => {
140+
# "amount" => 10.0,
141+
# "currency" => "EUR"
142+
# }
143+
# }
144+
#
145+
# @categories = session.categories_view.search_by_product(body, { size: 100, page: 0 })
135146
#
136147
def search_by_product(body, params = {})
137148
response, status = BeyondApi::Request.post(@session, "/product-view/categories/search/find-by-product", body, params)

lib/beyond_api/resources/checkout_settings.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,28 @@ def all
3232
# -H 'Content-Type: application/json' \
3333
# -H 'Accept: application/hal+json' \
3434
# -H 'Authorization: Bearer <Access token>' \
35-
# -d ' {
35+
# -d '{
3636
# "minimumOrderValue" : {
3737
# "currency" : "EUR",
3838
# "amount" : 50
3939
# },
4040
# "mustAcceptTermsAndConditions" : true
4141
# }'
42+
#
43+
# @beyond_api.scopes +cset:u+
44+
#
45+
# @return [OpenStruct]
46+
#
47+
# @example
48+
# body = {
49+
# "minimum_order_value" => {
50+
# "currency" => "EUR",
51+
# "amount" => 50
52+
# },
53+
# "must_accept_terms_and_conditions" => true
54+
# }
55+
# @checkout_settiongs = session.checkout_settings.update(body)
56+
#
4257
def update(body)
4358
response, status = BeyondApi::Request.put(@session, "/checkout-settings", body)
4459

0 commit comments

Comments
 (0)