beyond_api 0.16.0.pre → 0.18.2.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +33 -0
  3. data/CHANGELOG.md +38 -1
  4. data/Gemfile +2 -0
  5. data/Gemfile.lock +30 -2
  6. data/Rakefile +4 -2
  7. data/beyond_api.gemspec +13 -9
  8. data/bin/console +2 -1
  9. data/lib/beyond_api/connection.rb +7 -4
  10. data/lib/beyond_api/error.rb +6 -6
  11. data/lib/beyond_api/ext.rb +16 -16
  12. data/lib/beyond_api/request.rb +4 -4
  13. data/lib/beyond_api/resources/carts.rb +52 -23
  14. data/lib/beyond_api/resources/categories_view.rb +16 -6
  15. data/lib/beyond_api/resources/newsletter_target.rb +10 -4
  16. data/lib/beyond_api/resources/orders.rb +152 -33
  17. data/lib/beyond_api/resources/payment_method_definitions.rb +11 -4
  18. data/lib/beyond_api/resources/product_attribute_definitions.rb +16 -4
  19. data/lib/beyond_api/resources/products/attachments.rb +0 -2
  20. data/lib/beyond_api/resources/products/availability.rb +20 -11
  21. data/lib/beyond_api/resources/products/cross_sells.rb +0 -1
  22. data/lib/beyond_api/resources/products/custom_attributes.rb +0 -1
  23. data/lib/beyond_api/resources/products/images.rb +12 -9
  24. data/lib/beyond_api/resources/products/searches.rb +2 -2
  25. data/lib/beyond_api/resources/products/variation_properties.rb +0 -1
  26. data/lib/beyond_api/resources/products/videos.rb +4 -3
  27. data/lib/beyond_api/resources/products.rb +32 -13
  28. data/lib/beyond_api/resources/products_view.rb +21 -5
  29. data/lib/beyond_api/resources/script_tags.rb +21 -5
  30. data/lib/beyond_api/resources/shipping_zones.rb +53 -12
  31. data/lib/beyond_api/resources/shop.rb +9 -2
  32. data/lib/beyond_api/resources/shops/address.rb +0 -1
  33. data/lib/beyond_api/resources/shops/attributes.rb +0 -1
  34. data/lib/beyond_api/resources/shops/images.rb +12 -9
  35. data/lib/beyond_api/resources/shops/legals.rb +14 -7
  36. data/lib/beyond_api/resources/shops/locations.rb +0 -1
  37. data/lib/beyond_api/resources/signers.rb +12 -3
  38. data/lib/beyond_api/resources/token.rb +20 -18
  39. data/lib/beyond_api/resources/users.rb +73 -15
  40. data/lib/beyond_api/resources/variations/availability.rb +17 -5
  41. data/lib/beyond_api/resources/variations/images.rb +32 -15
  42. data/lib/beyond_api/resources/variations.rb +14 -3
  43. data/lib/beyond_api/resources/webhook_subscriptions.rb +30 -8
  44. data/lib/beyond_api/session.rb +7 -1
  45. data/lib/beyond_api/utils.rb +44 -38
  46. data/lib/beyond_api/version.rb +3 -1
  47. data/lib/beyond_api.rb +6 -2
  48. data/lib/generators/beyond_api/install_generator.rb +1 -1
  49. data/lib/generators/templates/beyond_api_initializer.rb +3 -0
  50. metadata +59 -15
@@ -42,7 +42,8 @@ module BeyondApi
42
42
  # @category = session.categories_view.find("23bb1430-6e82-40e4-9a92-4cb404da74a8")
43
43
  #
44
44
  def find(category_id)
45
- response, status = BeyondApi::Request.get(@session, "/product-view/categories/#{category_id}")
45
+ response, status = BeyondApi::Request.get(@session,
46
+ "/product-view/categories/#{category_id}")
46
47
 
47
48
  handle_response(response, status)
48
49
  end
@@ -64,7 +65,9 @@ module BeyondApi
64
65
  # @products = session.categories_view.products("681beef2-cd3e-4ce3-8034-4d07c1184447", { size: 100, page: 0 })
65
66
  #
66
67
  def products(category_id, params = {})
67
- response, status = BeyondApi::Request.get(@session, "/product-view/categories/#{category_id}/products", params)
68
+ response, status = BeyondApi::Request.get(@session,
69
+ "/product-view/categories/#{category_id}/products",
70
+ params)
68
71
 
69
72
  handle_response(response, status)
70
73
  end
@@ -84,7 +87,9 @@ module BeyondApi
84
87
  # @category = session.categories_view.search_by_label("power-bar")
85
88
  #
86
89
  def search_by_label(label)
87
- response, status = BeyondApi::Request.get(@session, "/product-view/categories/search/find-by-label", { label: label })
90
+ response, status = BeyondApi::Request.get(@session,
91
+ "/product-view/categories/search/find-by-label",
92
+ { label: label })
88
93
 
89
94
  handle_response(response, status)
90
95
  end
@@ -104,7 +109,9 @@ module BeyondApi
104
109
  # @category = session.categories_view.search_by_product_id("ba68427f-603c-4741-9185-3b379f7769b5")
105
110
  #
106
111
  def search_by_product_id(product_id, params = {})
107
- response, status = BeyondApi::Request.get(@session, "/product-view/categories/search/find-by-product", params.merge(product_id: product_id))
112
+ response, status = BeyondApi::Request.get(@session,
113
+ "/product-view/categories/search/find-by-product",
114
+ params.merge(product_id: product_id))
108
115
 
109
116
  handle_response(response, status)
110
117
  end
@@ -144,9 +151,12 @@ module BeyondApi
144
151
  # @categories = session.categories_view.search_by_product(body, { size: 100, page: 0 })
145
152
  #
146
153
  def search_by_product(body, params = {})
147
- response, status = BeyondApi::Request.post(@session, "/product-view/categories/search/find-by-product", body, params)
154
+ response, status = BeyondApi::Request.post(@session,
155
+ "/product-view/categories/search/find-by-product",
156
+ body,
157
+ params)
148
158
 
149
- handle_response(response, status = {})
159
+ handle_response(response, status)
150
160
  end
151
161
  end
152
162
  end
@@ -28,7 +28,9 @@ module BeyondApi
28
28
  # session.newsletter_target.create({ submit_url: "https://example.org/cgi-bin/subscribe.php" })
29
29
  #
30
30
  def create(submit_url)
31
- response, status = BeyondApi::Request.post(@session, "/newsletter-target", { submit_url: submit_url})
31
+ response, status = BeyondApi::Request.post(@session,
32
+ "/newsletter-target",
33
+ { submit_url: submit_url })
32
34
 
33
35
  handle_response(response, status)
34
36
  end
@@ -47,7 +49,8 @@ module BeyondApi
47
49
  # session.newsletter_target.delete
48
50
  #
49
51
  def delete
50
- response, status = BeyondApi::Request.delete(@session, "/newsletter-target")
52
+ response, status = BeyondApi::Request.delete(@session,
53
+ "/newsletter-target")
51
54
 
52
55
  handle_response(response, status, respond_with_true: true)
53
56
  end
@@ -63,7 +66,8 @@ module BeyondApi
63
66
  # @newsletter_target = session.newsletter_target.find
64
67
  #
65
68
  def find
66
- response, status = BeyondApi::Request.get(@session, "/newsletter-target")
69
+ response, status = BeyondApi::Request.get(@session,
70
+ "/newsletter-target")
67
71
 
68
72
  handle_response(response, status)
69
73
  end
@@ -89,7 +93,9 @@ module BeyondApi
89
93
  # session.newsletter_target.update({ submit_url: "https://example.org/cgi-bin/subscribe.php" })
90
94
  #
91
95
  def update(submit_url)
92
- response, status = BeyondApi::Request.put(@session, "/newsletter-target", { submit_url: submit_url })
96
+ response, status = BeyondApi::Request.put(@session,
97
+ "/newsletter-target",
98
+ { submit_url: submit_url })
93
99
 
94
100
  handle_response(response, status)
95
101
  end
@@ -24,7 +24,10 @@ module BeyondApi
24
24
  # @payment_process = session.orders.active_payment_process("208e2c1d-6610-43c7-b2f1-20aad6f029b9")
25
25
  #
26
26
  def active_payment_process(order_id)
27
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments/active")
27
+ path = "/orders/#{order_id}/processes/payments/active"
28
+
29
+ response, status = BeyondApi::Request.get(@session,
30
+ path)
28
31
 
29
32
  handle_response(response, status)
30
33
  end
@@ -47,7 +50,10 @@ module BeyondApi
47
50
  # @refund_process = session.orders.active_refund_process("8613295f-4d44-4143-bfd0-6b81fc178618")
48
51
  #
49
52
  def active_refund_process(order_id)
50
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/refunds/active")
53
+ path = "/orders/#{order_id}/processes/refunds/active"
54
+
55
+ response, status = BeyondApi::Request.get(@session,
56
+ path)
51
57
 
52
58
  handle_response(response, status)
53
59
  end
@@ -67,7 +73,9 @@ module BeyondApi
67
73
  # @orders = session.orders.all(size: 100, page: 0)
68
74
  #
69
75
  def all(params = {})
70
- handle_all_request("/orders", :orders, params)
76
+ path = "/orders"
77
+
78
+ handle_all_request(path, :orders, params)
71
79
  end
72
80
 
73
81
  #
@@ -95,7 +103,11 @@ module BeyondApi
95
103
  # @order = session.orders.cancel("e3f9264a-395b-407d-9036-00f38f609be6", body)
96
104
  #
97
105
  def cancel(order_id, body)
98
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/cancel", body)
106
+ path = "/orders/#{order_id}/cancel"
107
+
108
+ response, status = BeyondApi::Request.post(@session,
109
+ path,
110
+ body)
99
111
 
100
112
  handle_response(response, status)
101
113
  end
@@ -119,7 +131,10 @@ module BeyondApi
119
131
  # @pcancelation_process = session.orders.cancelation_process("f16cf0db-7449-4029-a886-76f38b4aa464", "365b4b63-45a8-49f6-94c5-a65e0dee83b5")
120
132
  #
121
133
  def cancelation_process(order_id, cancelation_id)
122
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments/cancelations/#{cancelation_id}")
134
+ path = "/orders/#{order_id}/processes/payments/cancelations/#{cancelation_id}"
135
+
136
+ response, status = BeyondApi::Request.get(@session,
137
+ path)
123
138
 
124
139
  handle_response(response, status)
125
140
  end
@@ -144,7 +159,11 @@ module BeyondApi
144
159
  # @pcancelation_processes = session.orders.cancelation_processes("b8cb904d-4c82-4c39-a3a4-de7cb181a5d3", {page: 0, size: 20})
145
160
  #
146
161
  def cancelation_processes(order_id, params = {})
147
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments/cancelations", params)
162
+ path = "/orders/#{order_id}/processes/payments/cancelations"
163
+
164
+ response, status = BeyondApi::Request.get(@session,
165
+ path,
166
+ params)
148
167
 
149
168
  handle_response(response, status)
150
169
  end
@@ -167,7 +186,10 @@ module BeyondApi
167
186
  # @payment_process = session.orders.capture_payment_process("ebfd99d6-f025-4c97-96d2-d5adbb45d6c2", "2936deca-fd56-4c0d-88e2-8030c897bf90")
168
187
  #
169
188
  def capture_payment_process(order_id, payment_id)
170
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/payments/#{payment_id}/capture")
189
+ path = "/orders/#{order_id}/processes/payments/#{payment_id}/capture"
190
+
191
+ response, status = BeyondApi::Request.post(@session,
192
+ path)
171
193
 
172
194
  handle_response(response, status)
173
195
  end
@@ -205,7 +227,11 @@ module BeyondApi
205
227
  # @cancelation_process = session.orders.create_cancelation_process("9072c00d-1bc7-4fd8-8836-94ada5084e7a", body)
206
228
  #
207
229
  def create_cancelation_process(order_id, body)
208
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/payments/cancelations", body)
230
+ path = "/orders/#{order_id}/processes/payments/cancelations"
231
+
232
+ response, status = BeyondApi::Request.post(@session,
233
+ path,
234
+ body)
209
235
 
210
236
  handle_response(response, status)
211
237
  end
@@ -234,7 +260,11 @@ module BeyondApi
234
260
  # @order = session.orders.create_invoice("a5d4d6c6-e77d-4180-8dbf-729f38a698b2", body)
235
261
  #
236
262
  def create_invoice(order_id, body)
237
- response, status = BeyondApi::Request.put(@session, "/orders/#{order_id}/create-invoice", body)
263
+ path = "/orders/#{order_id}/create-invoice"
264
+
265
+ response, status = BeyondApi::Request.put(@session,
266
+ path,
267
+ body)
238
268
 
239
269
  handle_response(response, status)
240
270
  end
@@ -284,7 +314,11 @@ module BeyondApi
284
314
  # @return_process = session.orders.create_return_process("29007bb7-739a-46f5-8c70-4e1029b52fa5", body)
285
315
  #
286
316
  def create_return_process(order_id, body)
287
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/returns", body)
317
+ path = "/orders/#{order_id}/processes/returns"
318
+
319
+ response, status = BeyondApi::Request.post(@session,
320
+ path,
321
+ body)
288
322
 
289
323
  handle_response(response, status)
290
324
  end
@@ -330,7 +364,11 @@ module BeyondApi
330
364
  # @shipping_process = session.orders.create_shipping_process("8df2fe3b-5149-492f-932a-073f012305eb", body)
331
365
  #
332
366
  def create_shipping_process(order_id, body)
333
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/shippings", body)
367
+ path = "/orders/#{order_id}/processes/shippings"
368
+
369
+ response, status = BeyondApi::Request.post(@session,
370
+ path,
371
+ body)
334
372
 
335
373
  handle_response(response, status)
336
374
  end
@@ -354,7 +392,11 @@ module BeyondApi
354
392
  # @events = session.orders.find("66b6aab5-2ed4-4f36-855e-3adb2ea873ee", { size: 100, page: 0 })
355
393
  #
356
394
  def events(order_id, params = {})
357
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/events", params)
395
+ path = "/orders/#{order_id}/events"
396
+
397
+ response, status = BeyondApi::Request.get(@session,
398
+ path,
399
+ params)
358
400
 
359
401
  handle_response(response, status)
360
402
  end
@@ -377,7 +419,10 @@ module BeyondApi
377
419
  # @order = session.orders.find("a27f1019-3690-40d1-bd9d-d60dff4c4cf8")
378
420
  #
379
421
  def find(order_id)
380
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}")
422
+ path = "/orders/#{order_id}"
423
+
424
+ response, status = BeyondApi::Request.get(@session,
425
+ path)
381
426
 
382
427
  handle_response(response, status)
383
428
  end
@@ -421,7 +466,11 @@ module BeyondApi
421
466
  # @payment_process = session.orders.mark_payment_process_as_paid("9a1a1aaa-e37d-4c71-bc95-cbc228463fec", "cb8c9a16-2d81-4ec1-9a4a-84a4c36124ae", body)
422
467
  #
423
468
  def mark_payment_process_as_paid(order_id, payment_id, body)
424
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/payments/#{payment_id}/mark-paid", body)
469
+ path = "/orders/#{order_id}/processes/payments/#{payment_id}/mark-paid"
470
+
471
+ response, status = BeyondApi::Request.post(@session,
472
+ path,
473
+ body)
425
474
 
426
475
  handle_response(response, status)
427
476
  end
@@ -453,7 +502,11 @@ module BeyondApi
453
502
  # @payment_process = session.orders.mark_payment_process_as_voided("a5558b7f-55f4-47d4-b603-9bf7eb59c05b", "5bcc48e7-2641-42a8-a042-189ae92e9901", body)
454
503
  #
455
504
  def mark_payment_process_as_voided(order_id, payment_id, body)
456
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/payments/#{payment_id}/mark-voided", body)
505
+ path = "/orders/#{order_id}/processes/payments/#{payment_id}/mark-voided"
506
+
507
+ response, status = BeyondApi::Request.post(@session,
508
+ path,
509
+ body)
457
510
 
458
511
  handle_response(response, status)
459
512
  end
@@ -494,7 +547,10 @@ module BeyondApi
494
547
  # @refund_process = session.orders.mark_refund_process_as_paid("60baa84c-9e11-4d55-97a9-1a7b00a0691c", body)
495
548
  #
496
549
  def mark_refund_process_as_paid(order_id)
497
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/refunds/active/mark-paid")
550
+ path = "/orders/#{order_id}/processes/refunds/active/mark-paid"
551
+
552
+ response, status = BeyondApi::Request.post(@session,
553
+ path)
498
554
 
499
555
  handle_response(response, status)
500
556
  end
@@ -526,7 +582,11 @@ module BeyondApi
526
582
  # @shipping_process = session.orders.mark_shipping_process_as_delivered("b5642d1f-0f7f-444e-96d5-1c1d1642ea5e", "619d06d8-0077-4efd-b341-5103f71bfb2d", body)
527
583
  #
528
584
  def mark_shipping_process_as_delivered(order_id, shipping_process_id, body)
529
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/shippings/#{shipping_process_id}/mark-delivered", body)
585
+ path = "/orders/#{order_id}/processes/shippings/#{shipping_process_id}/mark-delivered"
586
+
587
+ response, status = BeyondApi::Request.post(@session,
588
+ path,
589
+ body)
530
590
 
531
591
  handle_response(response, status)
532
592
  end
@@ -568,7 +628,11 @@ module BeyondApi
568
628
  # @shipping_process = session.orders.mark_shipping_process_as_shipped("dd6a7e20-16be-4509-bf83-fb8ee072ddad", "a0b0c4a5-0c80-47f4-98c3-0f55f4161176", body)
569
629
  #
570
630
  def mark_shipping_process_as_shipped(order_id, shipping_id, body)
571
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/processes/shippings/#{shipping_id}/mark-shipped", body)
631
+ path = "/orders/#{order_id}/processes/shippings/#{shipping_id}/mark-shipped"
632
+
633
+ response, status = BeyondApi::Request.post(@session,
634
+ path,
635
+ body)
572
636
 
573
637
  handle_response(response, status)
574
638
  end
@@ -592,7 +656,10 @@ module BeyondApi
592
656
  # @payment_process = session.orders.payment_process("d44ed295-6a08-47ba-a288-90d4f3ba9fff", "be56bfbd-af95-45b9-8b0e-cb0c184aaf60")
593
657
  #
594
658
  def payment_process(order_id, payment_id)
595
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments/#{payment_id}")
659
+ path = "/orders/#{order_id}/processes/payments/#{payment_id}"
660
+
661
+ response, status = BeyondApi::Request.get(@session,
662
+ path)
596
663
 
597
664
  handle_response(response, status)
598
665
  end
@@ -617,7 +684,11 @@ module BeyondApi
617
684
  # @payment_processes = session.orders.payment_processes("2012b775-a706-41e0-b0f9-5142864ca4a0", {page: 0, size: 20})
618
685
  #
619
686
  def payment_processes(order_id, params = {})
620
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/payments", params)
687
+ path = "/orders/#{order_id}/processes/payments"
688
+
689
+ response, status = BeyondApi::Request.get(@session,
690
+ path,
691
+ params)
621
692
 
622
693
  handle_response(response, status)
623
694
  end
@@ -640,7 +711,10 @@ module BeyondApi
640
711
  # @processes = session.orders.processes("934ece52-055c-4896-8d16-560f1461ea56")
641
712
  #
642
713
  def processes(order_id)
643
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes")
714
+ path = "/orders/#{order_id}/processes"
715
+
716
+ response, status = BeyondApi::Request.get(@session,
717
+ path)
644
718
 
645
719
  handle_response(response, status)
646
720
  end
@@ -664,7 +738,10 @@ module BeyondApi
664
738
  # @refund_process = session.orders.refund_process("801885c8-0b25-44a2-a1a4-60cbf3f9ecca", "4c02883f-be31-4fb2-ad0d-ccbc3678a9f5")
665
739
  #
666
740
  def refund_process(order_id, refund_id)
667
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/refunds/#{refund_id}")
741
+ path = "/orders/#{order_id}/processes/refunds/#{refund_id}"
742
+
743
+ response, status = BeyondApi::Request.get(@session,
744
+ path)
668
745
 
669
746
  handle_response(response, status)
670
747
  end
@@ -689,7 +766,11 @@ module BeyondApi
689
766
  # @refund_processes = session.orders.refund_processes("6f86e42f-763e-4514-a37d-fb8f88cdc14c", {page: 0, size: 20})
690
767
  #
691
768
  def refund_processes(order_id, params = {})
692
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/refunds", params)
769
+ path = "/orders/#{order_id}/processes/refunds"
770
+
771
+ response, status = BeyondApi::Request.get(@session,
772
+ path,
773
+ params)
693
774
 
694
775
  handle_response(response, status)
695
776
  end
@@ -713,7 +794,10 @@ module BeyondApi
713
794
  # @return_process = session.orders.return_process("cb9927e4-60d1-4a90-b40c-f5a8e2b25301", "910a3fde-cb23-418f-876a-694ce42245ef")
714
795
  #
715
796
  def return_process(order_id, return_process_id)
716
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/returns/#{return_process_id}")
797
+ path = "/orders/#{order_id}/processes/returns/#{return_process_id}"
798
+
799
+ response, status = BeyondApi::Request.get(@session,
800
+ path)
717
801
 
718
802
  handle_response(response, status)
719
803
  end
@@ -738,7 +822,11 @@ module BeyondApi
738
822
  # @return_processes = session.orders.return_processes("9e26232f-aa7a-408b-8041-9439999268c5", {page: 0, size: 20})
739
823
  #
740
824
  def return_processes(order_id, params = {})
741
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/returns", params)
825
+ path = "/orders/#{order_id}/processes/returns"
826
+
827
+ response, status = BeyondApi::Request.get(@session,
828
+ path,
829
+ params)
742
830
 
743
831
  handle_response(response, status)
744
832
  end
@@ -761,7 +849,11 @@ module BeyondApi
761
849
  # @order = session.orders.search_by_cart_id("82e859a8-7f70-4c19-83c1-ed03457b2ceb")
762
850
  #
763
851
  def search_by_cart_id(cart_id)
764
- response, status = BeyondApi::Request.get(@session, "/orders/search/find-by-cart-id", { cart_id: cart_id })
852
+ path = "/orders/search/find-by-cart-id"
853
+
854
+ response, status = BeyondApi::Request.get(@session,
855
+ path,
856
+ { cart_id: cart_id })
765
857
 
766
858
  handle_response(response, status)
767
859
  end
@@ -784,7 +876,11 @@ module BeyondApi
784
876
  # @order = session.orders.search_order_number_by_cart_id("7f1cf6c8-7780-430f-9de0-91cbe31c4bf6")
785
877
  #
786
878
  def search_order_number_by_cart_id(cart_id)
787
- response, status = BeyondApi::Request.get(@session, "/orders/search/find-order-number-by-cart-id", {"cartId": cart_id})
879
+ path = "/orders/search/find-order-number-by-cart-id"
880
+
881
+ response, status = BeyondApi::Request.get(@session,
882
+ path,
883
+ { cart_id: cart_id })
788
884
 
789
885
  handle_response(response, status)
790
886
  end
@@ -811,7 +907,11 @@ module BeyondApi
811
907
  # "https://myshop.com/api/pdf-storage/attachments/invoice_10003.pdf?hash=9e5e2631c6f5877d64cb3d40db46ec6eb48a3a92")
812
908
  #
813
909
  def send_order_document(order_id, order_document_uri)
814
- response, status = BeyondApi::Request.post(@session, "/orders/#{order_id}/send-order-document", { order_document_uri: order_document_uri })
910
+ path = "/orders/#{order_id}/send-order-document"
911
+
912
+ response, status = BeyondApi::Request.post(@session,
913
+ path,
914
+ { order_document_uri: order_document_uri })
815
915
 
816
916
  handle_response(response, status)
817
917
  end
@@ -835,7 +935,10 @@ module BeyondApi
835
935
  # @shipping_process = session.orders.refund_process("af42860f-2813-4130-85d9-2d315a4f802e", "80ebe96b-bcd5-4a34-a428-8a67ed114ce6")
836
936
  #
837
937
  def shipping_process(order_id, shipping_process_id)
838
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/shippings/#{shipping_process_id}")
938
+ path = "/orders/#{order_id}/processes/shippings/#{shipping_process_id}"
939
+
940
+ response, status = BeyondApi::Request.get(@session,
941
+ path)
839
942
 
840
943
  handle_response(response, status)
841
944
  end
@@ -860,7 +963,11 @@ module BeyondApi
860
963
  # @shipping_processes = session.orders.shipping_processes("268a8629-55cd-4890-9013-936b9b5ea14c", {page: 0, size: 20})
861
964
  #
862
965
  def shipping_processes(order_id, params = {})
863
- response, status = BeyondApi::Request.get(@session, "/orders/#{order_id}/processes/shippings", params)
966
+ path = "/orders/#{order_id}/processes/shippings"
967
+
968
+ response, status = BeyondApi::Request.get(@session,
969
+ path,
970
+ params)
864
971
 
865
972
  handle_response(response, status)
866
973
  end
@@ -942,7 +1049,11 @@ module BeyondApi
942
1049
  # @order = session.orders.update_billing_address("6c36e5e3-dc4c-4d00-b4e8-3fbf9a4bed14", body)
943
1050
  #
944
1051
  def update_billing_address(order_id, body)
945
- response, status = BeyondApi::Request.put(@session, "/orders/#{order_id}/billing-address", body)
1052
+ path = "/orders/#{order_id}/billing-address"
1053
+
1054
+ response, status = BeyondApi::Request.put(@session,
1055
+ path,
1056
+ body)
946
1057
 
947
1058
  handle_response(response, status)
948
1059
  end
@@ -968,7 +1079,11 @@ module BeyondApi
968
1079
  # @order = session.orders.update_order_note("58545e43-f4ba-48e2-b0bf-e340fd64f7b8", "not paid yet" )
969
1080
  #
970
1081
  def update_order_note(order_id, order_note)
971
- response, status = BeyondApi::Request.put(@session, "/orders/#{order_id}/order-note", { order_note: order_note })
1082
+ path = "/orders/#{order_id}/order-note"
1083
+
1084
+ response, status = BeyondApi::Request.put(@session,
1085
+ path,
1086
+ { order_note: order_note })
972
1087
 
973
1088
  handle_response(response, status)
974
1089
  end
@@ -1047,7 +1162,11 @@ module BeyondApi
1047
1162
  # @order = session.orders.update_shipping_address("30327fed-812f-4b70-8931-43e34d8c8181", body)
1048
1163
  #
1049
1164
  def update_shipping_address(order_id, body)
1050
- response, status = BeyondApi::Request.put(@session, "/orders/#{order_id}/shipping-address", body)
1165
+ path = "/orders/#{order_id}/shipping-address"
1166
+
1167
+ response, status = BeyondApi::Request.put(@session,
1168
+ path,
1169
+ body)
1051
1170
 
1052
1171
  handle_response(response, status)
1053
1172
  end
@@ -53,7 +53,9 @@ module BeyondApi
53
53
  # @payment_method_definitions = session.payment_method_definitions.create(body)
54
54
  #
55
55
  def create(body)
56
- response, status = BeyondApi::Request.post(@session, "/payment-method-definitions", body)
56
+ response, status = BeyondApi::Request.post(@session,
57
+ "/payment-method-definitions",
58
+ body)
57
59
 
58
60
  handle_response(response, status)
59
61
  end
@@ -97,7 +99,8 @@ module BeyondApi
97
99
  # @payment_method_definition = session.payment_methods.find("credit-card")
98
100
  #
99
101
  def find(payment_method_definition_id)
100
- response, status = BeyondApi::Request.get(@session, "/payment-method-definitions/#{payment_method_definition_id}")
102
+ response, status = BeyondApi::Request.get(@session,
103
+ "/payment-method-definitions/#{payment_method_definition_id}")
101
104
 
102
105
  handle_response(response, status)
103
106
  end
@@ -149,7 +152,9 @@ module BeyondApi
149
152
  # @payment_method_definition = session.payment_method_definitions.update("credit_card", body)
150
153
  #
151
154
  def update(payment_method_definition_id, body)
152
- response, status = BeyondApi::Request.put(@session, "/payment-method-definitions/#{payment_method_definition_id}")
155
+ response, status = BeyondApi::Request.put(@session,
156
+ "/payment-method-definitions/#{payment_method_definition_id}",
157
+ body)
153
158
 
154
159
  handle_response(response, status)
155
160
  end
@@ -167,7 +172,9 @@ module BeyondApi
167
172
  # session.payment_method_definitions.delete("credit-card")
168
173
  #
169
174
  def delete(payment_method_definition_id)
170
- response, status = BeyondApi::Request.delete(@session, "/payment-method-definitions/#{payment_method_definition_id}", body)
175
+ response, status = BeyondApi::Request.delete(@session,
176
+ "/payment-method-definitions/#{payment_method_definition_id}",
177
+ body)
171
178
 
172
179
  handle_response(response, status, respond_with_true: true)
173
180
  end
@@ -24,7 +24,9 @@ module BeyondApi
24
24
  # @product_attribute_definitions = session.product_attribute_definitions.all(size: 100, page: 0)
25
25
  #
26
26
  def all(params = {})
27
- handle_all_request("/product-attribute-definitions", :product_attribute_definitions, params)
27
+ path = "/product-attribute-definitions"
28
+
29
+ handle_all_request(path, :product_attribute_definitions, params)
28
30
  end
29
31
 
30
32
  #
@@ -56,7 +58,11 @@ module BeyondApi
56
58
  # @product_attribute_definition = session.product_attribute_definitions.create(body)
57
59
  #
58
60
  def create(body)
59
- response, status = BeyondApi::Request.post(@session, "/product-attribute-definitions", body)
61
+ path = "/product-attribute-definitions"
62
+
63
+ response, status = BeyondApi::Request.post(@session,
64
+ path,
65
+ body)
60
66
 
61
67
  handle_response(response, status)
62
68
  end
@@ -77,7 +83,10 @@ module BeyondApi
77
83
  # session.product_attribute_definitions.delete("color")
78
84
  #
79
85
  def delete(product_attribute_name)
80
- response, status = BeyondApi::Request.delete(@session, "/product-attribute-definitions/#{product_attribute_name}")
86
+ path = "/product-attribute-definitions/#{product_attribute_name}"
87
+
88
+ response, status = BeyondApi::Request.delete(@session,
89
+ path)
81
90
 
82
91
  handle_response(response, status, respond_with_true: true)
83
92
  end
@@ -98,7 +107,10 @@ module BeyondApi
98
107
  # @product_attribute_definition = session.product_attribute_definitions.find("filling_capacity")
99
108
  #
100
109
  def find(product_attribute_name)
101
- response, status = BeyondApi::Request.get(@session, "/product-attribute-definitions/#{product_attribute_name}")
110
+ path = "/product-attribute-definitions/#{product_attribute_name}"
111
+
112
+ response, status = BeyondApi::Request.get(@session,
113
+ path)
102
114
 
103
115
  handle_response(response, status)
104
116
  end
@@ -4,7 +4,6 @@ require "beyond_api/utils"
4
4
 
5
5
  module BeyondApi
6
6
  module ProductAttachments
7
-
8
7
  #
9
8
  # A +POST+ request is used to create an attachment and add it to a product.
10
9
  #
@@ -113,6 +112,5 @@ module BeyondApi
113
112
 
114
113
  handle_response(response, status, respond_with_true: true)
115
114
  end
116
-
117
115
  end
118
116
  end