beyond_api 0.18.0.pre → 0.21.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.template +3 -0
- data/.rubocop.yml +35 -0
- data/CHANGELOG.md +34 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +68 -8
- data/Rakefile +4 -2
- data/beyond_api.gemspec +13 -9
- data/bin/console +2 -1
- data/lib/beyond_api/connection.rb +17 -6
- data/lib/beyond_api/error.rb +6 -6
- data/lib/beyond_api/ext.rb +16 -16
- data/lib/beyond_api/request.rb +25 -6
- data/lib/beyond_api/resources/carts.rb +52 -23
- data/lib/beyond_api/resources/categories_view.rb +16 -6
- data/lib/beyond_api/resources/newsletter_target.rb +10 -4
- data/lib/beyond_api/resources/orders.rb +152 -33
- data/lib/beyond_api/resources/payment_method_definitions.rb +11 -4
- data/lib/beyond_api/resources/product_attribute_definitions.rb +16 -4
- data/lib/beyond_api/resources/products/attachments.rb +0 -2
- data/lib/beyond_api/resources/products/availability.rb +20 -11
- data/lib/beyond_api/resources/products/cross_sells.rb +0 -1
- data/lib/beyond_api/resources/products/custom_attributes.rb +0 -1
- data/lib/beyond_api/resources/products/images.rb +36 -11
- data/lib/beyond_api/resources/products/searches.rb +62 -1
- data/lib/beyond_api/resources/products/variation_properties.rb +0 -1
- data/lib/beyond_api/resources/products/videos.rb +4 -3
- data/lib/beyond_api/resources/products.rb +28 -9
- data/lib/beyond_api/resources/products_view.rb +21 -5
- data/lib/beyond_api/resources/script_tags.rb +21 -5
- data/lib/beyond_api/resources/shipping_zones.rb +53 -12
- data/lib/beyond_api/resources/shop.rb +9 -2
- data/lib/beyond_api/resources/shops/address.rb +0 -1
- data/lib/beyond_api/resources/shops/attributes.rb +0 -1
- data/lib/beyond_api/resources/shops/images.rb +12 -9
- data/lib/beyond_api/resources/shops/legals.rb +14 -7
- data/lib/beyond_api/resources/shops/locations.rb +0 -1
- data/lib/beyond_api/resources/signers.rb +12 -3
- data/lib/beyond_api/resources/token.rb +6 -5
- data/lib/beyond_api/resources/users.rb +73 -15
- data/lib/beyond_api/resources/variations/availability.rb +17 -5
- data/lib/beyond_api/resources/variations/images.rb +92 -18
- data/lib/beyond_api/resources/variations.rb +14 -3
- data/lib/beyond_api/resources/webhook_subscriptions.rb +30 -8
- data/lib/beyond_api/session.rb +7 -1
- data/lib/beyond_api/utils.rb +55 -42
- data/lib/beyond_api/version.rb +3 -1
- data/lib/beyond_api.rb +3 -1
- data/lib/generators/beyond_api/install_generator.rb +1 -1
- metadata +61 -17
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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,
|
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,
|
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,
|
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,
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
@@ -4,7 +4,6 @@ require "beyond_api/utils"
|
|
4
4
|
|
5
5
|
module BeyondApi
|
6
6
|
module ProductAvailability
|
7
|
-
|
8
7
|
#
|
9
8
|
# A +POST+ request is used to adjust the available stock of a product.
|
10
9
|
#
|
@@ -25,7 +24,9 @@ module BeyondApi
|
|
25
24
|
# @availability = session.products.adjust_stock_level("685f483e-cdda-40af-8091-d5bc31249409", -1)
|
26
25
|
#
|
27
26
|
def adjust_stock_level(product_id, relative_amount)
|
28
|
-
response, status = BeyondApi::Request.post(@session,
|
27
|
+
response, status = BeyondApi::Request.post(@session,
|
28
|
+
"/products/#{product_id}/availability/adjust-available-stock",
|
29
|
+
{ relative_amount: relative_amount })
|
29
30
|
|
30
31
|
handle_response(response, status)
|
31
32
|
end
|
@@ -48,7 +49,8 @@ module BeyondApi
|
|
48
49
|
# @availability = session.products.availability("fb22d408-00dc-47e3-ae58-e35769bdb428")
|
49
50
|
#
|
50
51
|
def availability(product_id)
|
51
|
-
response, status = BeyondApi::Request.get(@session,
|
52
|
+
response, status = BeyondApi::Request.get(@session,
|
53
|
+
"/products/#{product_id}/availability")
|
52
54
|
|
53
55
|
handle_response(response, status)
|
54
56
|
end
|
@@ -71,7 +73,8 @@ module BeyondApi
|
|
71
73
|
# session.products.disable_purchasability("6b30255e-650f-475c-b345-e7247f957689")
|
72
74
|
#
|
73
75
|
def disable_purchasability(product_id)
|
74
|
-
response, status = BeyondApi::Request.post(@session,
|
76
|
+
response, status = BeyondApi::Request.post(@session,
|
77
|
+
"/products/#{product_id}/availability/disable-purchasability")
|
75
78
|
|
76
79
|
handle_response(response, status, respond_with_true: true)
|
77
80
|
end
|
@@ -94,7 +97,8 @@ module BeyondApi
|
|
94
97
|
# session.products.disable_stock_management("e966cb17-4047-4b82-ade4-33e7f0978c89")
|
95
98
|
#
|
96
99
|
def disable_stock_management(product_id)
|
97
|
-
response, status = BeyondApi::Request.post(@session,
|
100
|
+
response, status = BeyondApi::Request.post(@session,
|
101
|
+
"/products/#{product_id}/availability/disable-stock-management")
|
98
102
|
|
99
103
|
handle_response(response, status, respond_with_true: true)
|
100
104
|
end
|
@@ -117,7 +121,8 @@ module BeyondApi
|
|
117
121
|
# session.products.enable_purchasability("17e3a92b-6f3b-4415-bd8f-c9c8921a5a73")
|
118
122
|
#
|
119
123
|
def enable_purchasability(product_id)
|
120
|
-
response, status = BeyondApi::Request.post(@session,
|
124
|
+
response, status = BeyondApi::Request.post(@session,
|
125
|
+
"/products/#{product_id}/availability/enable-purchasability")
|
121
126
|
|
122
127
|
handle_response(response, status, respond_with_true: true)
|
123
128
|
end
|
@@ -146,15 +151,17 @@ module BeyondApi
|
|
146
151
|
# @availability = session.products.enable_stock_management("101fa968-9bb8-4dbe-b166-3add1fc1b35e", body)
|
147
152
|
#
|
148
153
|
def enable_stock_management(product_id, body)
|
149
|
-
response, status = BeyondApi::Request.post(@session,
|
154
|
+
response, status = BeyondApi::Request.post(@session,
|
155
|
+
"/products/#{product_id}/availability/enable-stock-management",
|
156
|
+
body)
|
150
157
|
|
151
158
|
handle_response(response, status)
|
152
159
|
end
|
153
160
|
|
154
161
|
#
|
155
|
-
# A +
|
162
|
+
# A +PUT+ request is used to update the reserve stock by changing the +stockThreshold+ value of a product or variation product (incl. all of its variations). Reserve stock refers to an inventory level that indicates that a product needs to be reordered.
|
156
163
|
#
|
157
|
-
# $ curl 'https://api-shop.beyondshop.cloud/api/products/f74b5f57-43cc-4176-97aa-c6eb9fdeb37c/availability/update-stock-threshold' -i -X
|
164
|
+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/f74b5f57-43cc-4176-97aa-c6eb9fdeb37c/availability/update-stock-threshold' -i -X PUT \
|
158
165
|
# -H 'Content-Type: application/json' \
|
159
166
|
# -H 'Accept: application/hal+json' \
|
160
167
|
# -H 'Authorization: Bearer <Access token>' \
|
@@ -168,10 +175,12 @@ module BeyondApi
|
|
168
175
|
# @return [OpenStruct]
|
169
176
|
#
|
170
177
|
# @example
|
171
|
-
# session.products.update_reserve_stock("f74b5f57-43cc-4176-97aa-c6eb9fdeb37c",
|
178
|
+
# session.products.update_reserve_stock("f74b5f57-43cc-4176-97aa-c6eb9fdeb37c", 5)
|
172
179
|
#
|
173
180
|
def update_reserve_stock(product_id, stock_threshold)
|
174
|
-
response, status = BeyondApi::Request.
|
181
|
+
response, status = BeyondApi::Request.put(@session,
|
182
|
+
"/products/#{product_id}/availability/update-stock-threshold",
|
183
|
+
{ stock_threshold: stock_threshold })
|
175
184
|
|
176
185
|
handle_response(response, status)
|
177
186
|
end
|
@@ -4,7 +4,6 @@ require "beyond_api/utils"
|
|
4
4
|
|
5
5
|
module BeyondApi
|
6
6
|
module ProductCustomAttributes
|
7
|
-
|
8
7
|
#
|
9
8
|
# A +POST+ request is used to create a product attribute, which defines the value of a certain {product attribute definition}[http://docs.beyondshop.cloud/#resources-product-attribute-definitions] for a specific {product}[http://docs.beyondshop.cloud/#resources-products].
|
10
9
|
#
|