beyond_api 0.5.1.pre → 0.6.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -3
  3. data/Gemfile.lock +3 -3
  4. data/lib/beyond_api/resources/carts.rb +18 -9
  5. data/lib/beyond_api/resources/categories.rb +2 -2
  6. data/lib/beyond_api/resources/categories_view.rb +13 -2
  7. data/lib/beyond_api/resources/checkout_settings.rb +16 -1
  8. data/lib/beyond_api/resources/customers.rb +333 -0
  9. data/lib/beyond_api/resources/newsletter_target.rb +1 -1
  10. data/lib/beyond_api/resources/order_settings.rb +45 -28
  11. data/lib/beyond_api/resources/orders.rb +175 -87
  12. data/lib/beyond_api/resources/payment_methods.rb +28 -25
  13. data/lib/beyond_api/resources/product_attribute_definitions.rb +3 -5
  14. data/lib/beyond_api/resources/products/attachments.rb +13 -14
  15. data/lib/beyond_api/resources/products/availability.rb +12 -10
  16. data/lib/beyond_api/resources/products/cross_sells.rb +159 -0
  17. data/lib/beyond_api/resources/products/custom_attributes.rb +7 -7
  18. data/lib/beyond_api/resources/products/images.rb +47 -8
  19. data/lib/beyond_api/resources/products/videos.rb +146 -0
  20. data/lib/beyond_api/resources/products.rb +11 -9
  21. data/lib/beyond_api/resources/products_view.rb +6 -51
  22. data/lib/beyond_api/resources/shipping_zones.rb +5 -5
  23. data/lib/beyond_api/resources/shop.rb +16 -21
  24. data/lib/beyond_api/resources/signers.rb +1 -1
  25. data/lib/beyond_api/resources/users.rb +13 -10
  26. data/lib/beyond_api/resources/variations/images.rb +160 -0
  27. data/lib/beyond_api/resources/variations.rb +40 -37
  28. data/lib/beyond_api/resources/webhook_subscriptions.rb +1 -1
  29. data/lib/beyond_api/session.rb +5 -5
  30. data/lib/beyond_api/version.rb +1 -1
  31. metadata +7 -4
  32. data/lib/beyond_api/resources/product_settings.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b482e3ba36e154ce480dbc1a7ac833456f73e14b3b1f033c4a8af702793c16d4
4
- data.tar.gz: 6ef513a870018c2fc11fd9f21779fb48057179a45ba9d3cb78d5bd609f4452fb
3
+ metadata.gz: 31b8f47b376a95d1575e48fb7661397aa5c4e374fc6ac680b44d16dcd7bb4e5d
4
+ data.tar.gz: 5fb3e444da729827dee2f3ae336771b6ffc9d278150bcd371b115d9e7496dd7d
5
5
  SHA512:
6
- metadata.gz: 1a5247f113f75d39102103cf411c7cbc4370083d1b7c456d07cfe48d846bd91229557e997999e150db5e1bc5f30654f449e67de40d7b9a9ea72765d5863e0a7b
7
- data.tar.gz: fdd24ad0101b5da1af79993fe75992b06bd2703b57ff1f3d5646fbf29017d629331d97560adc11bf79663b8c788325e083b28e2579764675fd74f5787acac017
6
+ metadata.gz: fcf18ac9f5037a904f630cef79698edfe2ab1d4a9bdc417cf27a1f9e354d0df760dd2ff18416790774dc451bba569c7227de8c5bee7644b42cce35796dccc82a
7
+ data.tar.gz: 1126ed97396c7db4fdf721106a49471ba9c68c4f6c61f0a35f061b23e262acbdf78a9ea091a53eb8052a65ddb7edf9cb02a18a1920ae108fd949464745a1d692
data/CHANGELOG.md CHANGED
@@ -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
+
1
55
  ### v0.5.1.pre
2
56
 
3
57
  * bug-fixes
4
- * Fix `adjust_stock_level` method
58
+ * Fix `Products#adjust_stock_level` method
5
59
 
6
60
  ### v0.5.0.pre
7
61
 
@@ -16,8 +70,8 @@
16
70
  ### v0.4.0.pre
17
71
 
18
72
  * 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
21
75
  * Fix product custom attribute module name
22
76
  * Include `BeyondApi::ProductCustomAttributes` module into `BeyondApi::Products` class
23
77
  * Include `BeyondApi::ProductImages` module into `BeyondApi::Products` class
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beyond_api (0.5.1.pre)
4
+ beyond_api (0.6.0.pre)
5
5
  faraday (~> 0.15)
6
6
 
7
7
  GEM
@@ -13,7 +13,7 @@ GEM
13
13
  dotenv (2.7.5)
14
14
  faker (2.4.0)
15
15
  i18n (~> 1.6.0)
16
- faraday (0.17.1)
16
+ faraday (0.17.3)
17
17
  multipart-post (>= 1.2, < 3)
18
18
  i18n (1.6.0)
19
19
  concurrent-ruby (~> 1.0)
@@ -52,4 +52,4 @@ DEPENDENCIES
52
52
  yard (~> 0.9)
53
53
 
54
54
  BUNDLED WITH
55
- 2.0.2
55
+ 2.1.0.pre.3
@@ -43,8 +43,8 @@ module BeyondApi
43
43
  # @example
44
44
  # @cart = session.carts.create
45
45
  #
46
- def create(body)
47
- response, status = BeyondApi::Request.post(@session, "/carts", body)
46
+ def create
47
+ response, status = BeyondApi::Request.post(@session, "/carts")
48
48
 
49
49
  handle_response(response, status)
50
50
  end
@@ -202,7 +202,7 @@ module BeyondApi
202
202
  # @return true
203
203
  #
204
204
  # @example
205
- # session.carts.delete_line_item("2fa7dc36-8305-4628-b961-f2c3f7dda47d")
205
+ # session.carts.delete_shipping_address("2fa7dc36-8305-4628-b961-f2c3f7dda47d")
206
206
  #
207
207
  def delete_shipping_address(cart_id)
208
208
  response, status = BeyondApi::Request.delete(@session, "/carts/#{cart_id}/shipping-address")
@@ -290,6 +290,7 @@ module BeyondApi
290
290
  # "_ref" => "f084553c-ea77-4745-b1bd-71c64c8419fd",
291
291
  # "quantity" => 2
292
292
  # }
293
+ #
293
294
  # @cart = session.carts.replace_line_item("f73629e5-fecf-4474-9b04-6b2fcd4663c4", "2c9c0f38-0b9e-4fa7-bcbe-960098ff63aa", body)
294
295
  #
295
296
  def replace_line_item(cart_id, line_item_id, body)
@@ -311,8 +312,13 @@ module BeyondApi
311
312
  # @return [OpenStruct]
312
313
  #
313
314
  # @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)
316
322
  #
317
323
  def replace_line_items(cart_id, body)
318
324
  response, status = BeyondApi::Request.put(@session, "/carts/#{cart_id}/line-items", body)
@@ -361,6 +367,7 @@ module BeyondApi
361
367
  # "taxNumber" => "123-34-6789",
362
368
  # "birthDate" => "1985-03-20"
363
369
  # }
370
+ #
364
371
  # @cart = session.carts.set_billing_address("01da6aa7-8aa2-4383-a496-6611a14afbc9", body)
365
372
  #
366
373
  def set_billing_address(cart_id, body)
@@ -453,6 +460,7 @@ module BeyondApi
453
460
  # "taxNumber" => "123-34-6789",
454
461
  # "birthDate" => "1985-03-20"
455
462
  # }
463
+ #
456
464
  # @cart = session.carts.set_shipping_address("01da6aa7-8aa2-4383-a496-6611a14afbc9", body)
457
465
  #
458
466
  def set_shipping_address(cart_id, body)
@@ -489,7 +497,7 @@ module BeyondApi
489
497
  # A +PUT+ request is used to set the shipping method to the current default shipping method.
490
498
  # The default shipping method is the one with the highest priority of the applicable shipping methods.
491
499
  #
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 \
493
501
  # -H 'Content-Type: application/json' \
494
502
  # -H 'Accept: application/json'
495
503
  #
@@ -498,11 +506,10 @@ module BeyondApi
498
506
  # @return [OpenStruct]
499
507
  #
500
508
  # @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")
502
510
  #
503
511
  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")
506
513
 
507
514
  handle_response(response, status)
508
515
  end
@@ -523,6 +530,7 @@ module BeyondApi
523
530
  #
524
531
  def shipping_method(cart_id)
525
532
  response, status = BeyondApi::Request.get(@session, "/carts/#{cart_id}")
533
+
526
534
  handle_response(response, status)
527
535
  end
528
536
 
@@ -541,6 +549,7 @@ module BeyondApi
541
549
  #
542
550
  def shipping_methods(cart_id)
543
551
  response, status = BeyondApi::Request.get(@session, "/carts/#{cart_id}")
552
+
544
553
  handle_response(response, status)
545
554
  end
546
555
  end
@@ -96,7 +96,7 @@ module BeyondApi
96
96
  # @return [OpenStruct]
97
97
  #
98
98
  # @example
99
- # @category = session.categories.find(category_id)
99
+ # @category = session.categories.find("27a94b71-9b17-4f06-9596-fbbf4d18021f")
100
100
  #
101
101
  def find(category_id)
102
102
  response, status = BeyondApi::Request.get(@session, "/categories/#{category_id}")
@@ -135,7 +135,7 @@ module BeyondApi
135
135
  end
136
136
 
137
137
  #
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.
139
139
  #
140
140
  # $ curl 'https://api-shop.beyondshop.cloud/api/categories/cb2058dc-871a-4e64-83ac-39a0be9e6f82' -i -X PUT \
141
141
  # -H 'Content-Type: application/json' \
@@ -126,12 +126,23 @@ module BeyondApi
126
126
  # }
127
127
  # }'
128
128
  #
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
130
132
  #
131
133
  # @return [OpenStruct]
132
134
  #
133
135
  # @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 })
135
146
  #
136
147
  def search_by_product(body, params = {})
137
148
  response, status = BeyondApi::Request.post(@session, "/product-view/categories/search/find-by-product", body, params)
@@ -32,13 +32,28 @@ module BeyondApi
32
32
  # -H 'Content-Type: application/json' \
33
33
  # -H 'Accept: application/hal+json' \
34
34
  # -H 'Authorization: Bearer <Access token>' \
35
- # -d ' {
35
+ # -d '{
36
36
  # "minimumOrderValue" : {
37
37
  # "currency" : "EUR",
38
38
  # "amount" : 50
39
39
  # },
40
40
  # "mustAcceptTermsAndConditions" : true
41
41
  # }'
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
+ #
42
57
  def update(body)
43
58
  response, status = BeyondApi::Request.put(@session, "/checkout-settings", body)
44
59
 
@@ -0,0 +1,333 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "beyond_api/utils"
4
+
5
+ module BeyondApi
6
+ class Customers < Base
7
+ include BeyondApi::Utils
8
+
9
+ #
10
+ # A +GET+ request is used to list all customers of the shop in a paged way. Each item in the response represents a summary of the customer data.
11
+ #
12
+ # $ curl 'https://api-shop.beyondshop.cloud/api/customers' -i -X GET \
13
+ # -H 'Authorization: Bearer <Access token>'
14
+ #
15
+ # @beyond_api.scopes +cust:r+
16
+ #
17
+ # @option params [Integer] :size the page size
18
+ # @option params [Integer] :page the page number
19
+ #
20
+ # @return [OpenStruct]
21
+ #
22
+ # @example
23
+ # @customers = session.customers.all(size: 20, page: 0)
24
+ #
25
+ def all(params = {})
26
+ response, status = BeyondApi::Request.get(@session, "/customers", params)
27
+
28
+ handle_response(response, status)
29
+ end
30
+
31
+ #
32
+ # A +POST+ request is used to create a customer.
33
+ #
34
+ # $ curl 'https://api-shop.beyondshop.cloud/api/customers' -i -X POST \
35
+ # -H 'Content-Type: application/json' \
36
+ # -H 'Accept: application/hal+json' \
37
+ # -H 'Authorization: Bearer <Access token>' \
38
+ # -d '{
39
+ # "defaultPaymentMethodId" : "69923864-74a7-4ea9-92c7-0d17181b39f4",
40
+ # "defaultShippingMethodId" : "a5976ec2-d99a-4d16-bd2b-1fa5c48d68aa",
41
+ # "shippingAddress" : {
42
+ # "salutation" : "Mrs",
43
+ # "gender" : "FEMALE",
44
+ # "company" : "Astrid Alster GmbH",
45
+ # "title" : "",
46
+ # "firstName" : "Astrid",
47
+ # "middleName" : "Agnes",
48
+ # "lastName" : "Alster",
49
+ # "street" : "Alsterwasserweg",
50
+ # "houseNumber" : "2",
51
+ # "street2" : "Erdgeschoss",
52
+ # "addressExtension" : "Hinterhof",
53
+ # "postalCode" : "20999",
54
+ # "dependentLocality" : "Seevetal",
55
+ # "city" : "Alsterwasser",
56
+ # "country" : "DE",
57
+ # "state" : "Hamburg",
58
+ # "email" : "a.alsterh@example.com",
59
+ # "phone" : "(800) 555-0102",
60
+ # "mobile" : "(800) 555-0103",
61
+ # "doorCode" : "456",
62
+ # "_id" : null
63
+ # },
64
+ # "email" : "a.alsterh@example.com",
65
+ # "initialPassword" : "MyVeryStrongPassword",
66
+ # "billingAddress" : {
67
+ # "salutation" : "Mrs",
68
+ # "gender" : "FEMALE",
69
+ # "company" : "Astrid Alster GmbH",
70
+ # "title" : "",
71
+ # "firstName" : "Astrid",
72
+ # "middleName" : "Agnes",
73
+ # "lastName" : "Alster",
74
+ # "street" : "Alsterwasserweg",
75
+ # "houseNumber" : "2",
76
+ # "street2" : "Erdgeschoss",
77
+ # "addressExtension" : "Hinterhof",
78
+ # "postalCode" : "20999",
79
+ # "dependentLocality" : "Seevetal",
80
+ # "city" : "Alsterwasser",
81
+ # "country" : "DE",
82
+ # "state" : "Hamburg",
83
+ # "email" : "a.alsterh@example.com",
84
+ # "phone" : "(800) 555-0102",
85
+ # "mobile" : "(800) 555-0103",
86
+ # "vatId" : "DE123456789",
87
+ # "taxNumber" : "HRE 987654/32123/864516",
88
+ # "birthDate" : "1985-05-11",
89
+ # "_id" : "b61ca0e0-411f-485e-83f3-035d717095da"
90
+ # }
91
+ # }'
92
+ #
93
+ # @beyond_api.scopes +cust:c+
94
+ #
95
+ # @param body [Hash] the request body
96
+ #
97
+ # @return [OpenStruct]
98
+ #
99
+ # @example
100
+ # body = {
101
+ # "defaultPaymentMethodId" : "69923864-74a7-4ea9-92c7-0d17181b39f4",
102
+ # "defaultShippingMethodId" : "a5976ec2-d99a-4d16-bd2b-1fa5c48d68aa",
103
+ # "shippingAddress" : {
104
+ # "salutation" : "Mrs",
105
+ # "gender" : "FEMALE",
106
+ # "company" : "Astrid Alster GmbH",
107
+ # "title" : "",
108
+ # "firstName" : "Astrid",
109
+ # "middleName" : "Agnes",
110
+ # "lastName" : "Alster",
111
+ # "street" : "Alsterwasserweg",
112
+ # "houseNumber" : "2",
113
+ # "street2" : "Erdgeschoss",
114
+ # "addressExtension" : "Hinterhof",
115
+ # "postalCode" : "20999",
116
+ # "dependentLocality" : "Seevetal",
117
+ # "city" : "Alsterwasser",
118
+ # "country" : "DE",
119
+ # "state" : "Hamburg",
120
+ # "email" : "a.alsterh@example.com",
121
+ # "phone" : "(800) 555-0102",
122
+ # "mobile" : "(800) 555-0103",
123
+ # "doorCode" : "456",
124
+ # "_id" : null
125
+ # },
126
+ # "email" : "a.alsterh@example.com",
127
+ # "initialPassword" : "MyVeryStrongPassword",
128
+ # "billingAddress" : {
129
+ # "salutation" : "Mrs",
130
+ # "gender" : "FEMALE",
131
+ # "company" : "Astrid Alster GmbH",
132
+ # "title" : "",
133
+ # "firstName" : "Astrid",
134
+ # "middleName" : "Agnes",
135
+ # "lastName" : "Alster",
136
+ # "street" : "Alsterwasserweg",
137
+ # "houseNumber" : "2",
138
+ # "street2" : "Erdgeschoss",
139
+ # "addressExtension" : "Hinterhof",
140
+ # "postalCode" : "20999",
141
+ # "dependentLocality" : "Seevetal",
142
+ # "city" : "Alsterwasser",
143
+ # "country" : "DE",
144
+ # "state" : "Hamburg",
145
+ # "email" : "a.alsterh@example.com",
146
+ # "phone" : "(800) 555-0102",
147
+ # "mobile" : "(800) 555-0103",
148
+ # "vatId" : "DE123456789",
149
+ # "taxNumber" : "HRE 987654/32123/864516",
150
+ # "birthDate" : "1985-05-11",
151
+ # "_id" : "b61ca0e0-411f-485e-83f3-035d717095da"
152
+ # }
153
+ # }
154
+ #
155
+ # @customer = session.customers.create(body)
156
+ #
157
+ def create(body)
158
+ response, status = BeyondApi::Request.post(@session, "/customers", body)
159
+
160
+ handle_response(response, status)
161
+ end
162
+
163
+ #
164
+ # A +DELETE+ request is used to delete a customer.
165
+ #
166
+ # $ curl 'https://api-shop.beyondshop.cloud/api/customers/9e2a61d9-a1ac-4771-bd02-32bf50386392' -i -X DELETE \
167
+ # -H 'Authorization: Bearer <Access token>'
168
+ #
169
+ # @beyond_api.scopes +cust:d+
170
+ #
171
+ # @param customer_id [String] the customer UUID
172
+ #
173
+ # @return true
174
+ #
175
+ # @example
176
+ # session.customers.delete("9e2a61d9-a1ac-4771-bd02-32bf50386392")
177
+ #
178
+ def delete(customer_id)
179
+ response, status = BeyondApi::Request.delete(@session, "/customers/#{customer_id}")
180
+
181
+ handle_response(response, status, respond_with_true: true)
182
+ end
183
+
184
+ #
185
+ # A +GET+ request is used to retrieve the details of a customer.
186
+ #
187
+ # $ curl 'https://api-shop.beyondshop.cloud/api/customers/d6a8132e-29b3-4258-b8c0-aee34df42aa1' -i -X GET \
188
+ # -H 'Authorization: Bearer <Access token>'
189
+ #
190
+ # @beyond_api.scopes +cust:r+
191
+ #
192
+ # @param customer_id [String] the customer UUID
193
+ #
194
+ # @return [OpenStruct]
195
+ #
196
+ # @example
197
+ # @customer = session.customers.find("d6a8132e-29b3-4258-b8c0-aee34df42aa1")
198
+ #
199
+ def find(customer_id)
200
+ response, status = BeyondApi::Request.get(@session, "/customers/#{customer_id}")
201
+
202
+ handle_response(response, status)
203
+ end
204
+
205
+ #
206
+ # A +PUT+ request is used to update a customer.
207
+ #
208
+ # $ curl 'https://api-shop.beyondshop.cloud/api/customers/34c5566b-e82a-486d-9a7d-3c3aafef6901' -i -X PUT \
209
+ # -H 'Content-Type: application/json' \
210
+ # -H 'Accept: application/hal+json' \
211
+ # -H 'Authorization: Bearer <Access token>' \
212
+ # -d '{
213
+ # "defaultPaymentMethodId" : "d94790cd-ec27-4461-85a9-457fffcc0271",
214
+ # "defaultShippingMethodId" : "976e7d66-0eb2-4ca3-8b44-5e6d0aeb9e63",
215
+ # "shippingAddress" : {
216
+ # "salutation" : "Mrs",
217
+ # "gender" : "FEMALE",
218
+ # "company" : "Astrid Alster GmbH",
219
+ # "title" : "",
220
+ # "firstName" : "Astrid",
221
+ # "middleName" : "Agnes",
222
+ # "lastName" : "Alster",
223
+ # "street" : "Alsterwasserweg",
224
+ # "houseNumber" : "2",
225
+ # "street2" : "Erdgeschoss",
226
+ # "addressExtension" : "Hinterhof",
227
+ # "postalCode" : "20999",
228
+ # "dependentLocality" : "Seevetal",
229
+ # "city" : "Alsterwasser",
230
+ # "country" : "DE",
231
+ # "state" : "Hamburg",
232
+ # "email" : "a.alsterh@example.com",
233
+ # "phone" : "(800) 555-0102",
234
+ # "mobile" : "(800) 555-0103",
235
+ # "doorCode" : "456",
236
+ # "_id" : "112d46ff-fc72-4be8-9e48-588b4f5c7829"
237
+ # },
238
+ # "billingAddress" : {
239
+ # "salutation" : "Mrs",
240
+ # "gender" : "FEMALE",
241
+ # "company" : "Astrid Alster GmbH",
242
+ # "title" : "",
243
+ # "firstName" : "Astrid",
244
+ # "middleName" : "Agnes",
245
+ # "lastName" : "Alster",
246
+ # "street" : "Alsterwasserweg",
247
+ # "houseNumber" : "2",
248
+ # "street2" : "Erdgeschoss",
249
+ # "addressExtension" : "Hinterhof",
250
+ # "postalCode" : "20999",
251
+ # "dependentLocality" : "Seevetal",
252
+ # "city" : "Alsterwasser",
253
+ # "country" : "DE",
254
+ # "state" : "Hamburg",
255
+ # "email" : "a.alsterh@example.com",
256
+ # "phone" : "(800) 555-0102",
257
+ # "mobile" : "(800) 555-0103",
258
+ # "vatId" : "DE123456789",
259
+ # "taxNumber" : "HRE 987654/32123/864516",
260
+ # "birthDate" : "1985-05-11",
261
+ # "_id" : "85de80fc-8467-46ca-b20c-55f5d4d1eaec"
262
+ # }
263
+ # }'
264
+ #
265
+ # @beyond_api.scopes +cust:u+
266
+ #
267
+ # @param customer_id [String] the customer UUID
268
+ # @param body [Hash] the request body
269
+ #
270
+ # @return [OpenStruct]
271
+ #
272
+ # @example
273
+ # body = {
274
+ # "defaultPaymentMethodId" : "d94790cd-ec27-4461-85a9-457fffcc0271",
275
+ # "defaultShippingMethodId" : "976e7d66-0eb2-4ca3-8b44-5e6d0aeb9e63",
276
+ # "shippingAddress" : {
277
+ # "salutation" : "Mrs",
278
+ # "gender" : "FEMALE",
279
+ # "company" : "Astrid Alster GmbH",
280
+ # "title" : "",
281
+ # "firstName" : "Astrid",
282
+ # "middleName" : "Agnes",
283
+ # "lastName" : "Alster",
284
+ # "street" : "Alsterwasserweg",
285
+ # "houseNumber" : "2",
286
+ # "street2" : "Erdgeschoss",
287
+ # "addressExtension" : "Hinterhof",
288
+ # "postalCode" : "20999",
289
+ # "dependentLocality" : "Seevetal",
290
+ # "city" : "Alsterwasser",
291
+ # "country" : "DE",
292
+ # "state" : "Hamburg",
293
+ # "email" : "a.alsterh@example.com",
294
+ # "phone" : "(800) 555-0102",
295
+ # "mobile" : "(800) 555-0103",
296
+ # "doorCode" : "456",
297
+ # "_id" : "112d46ff-fc72-4be8-9e48-588b4f5c7829"
298
+ # },
299
+ # "billingAddress" : {
300
+ # "salutation" : "Mrs",
301
+ # "gender" : "FEMALE",
302
+ # "company" : "Astrid Alster GmbH",
303
+ # "title" : "",
304
+ # "firstName" : "Astrid",
305
+ # "middleName" : "Agnes",
306
+ # "lastName" : "Alster",
307
+ # "street" : "Alsterwasserweg",
308
+ # "houseNumber" : "2",
309
+ # "street2" : "Erdgeschoss",
310
+ # "addressExtension" : "Hinterhof",
311
+ # "postalCode" : "20999",
312
+ # "dependentLocality" : "Seevetal",
313
+ # "city" : "Alsterwasser",
314
+ # "country" : "DE",
315
+ # "state" : "Hamburg",
316
+ # "email" : "a.alsterh@example.com",
317
+ # "phone" : "(800) 555-0102",
318
+ # "mobile" : "(800) 555-0103",
319
+ # "vatId" : "DE123456789",
320
+ # "taxNumber" : "HRE 987654/32123/864516",
321
+ # "birthDate" : "1985-05-11",
322
+ # "_id" : "85de80fc-8467-46ca-b20c-55f5d4d1eaec"
323
+ # }
324
+ # }
325
+ # @customer = session.customers.update("34c5566b-e82a-486d-9a7d-3c3aafef6901", body)
326
+ #
327
+ def update(customer_id, body)
328
+ response, status = BeyondApi::Request.put(@session, "/customers/#{customer_id}", body)
329
+
330
+ handle_response(response, status)
331
+ end
332
+ end
333
+ end
@@ -60,7 +60,7 @@ module BeyondApi
60
60
  # @return [OpenStruct]
61
61
  #
62
62
  # @example
63
- # session.newsletter_target.find
63
+ # @newsletter_target = session.newsletter_target.find
64
64
  #
65
65
  def find
66
66
  response, status = BeyondApi::Request.get(@session, "/newsletter-target")