beyond_api 0.24.0.pre → 0.24.2.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6da6567d2a64ac33b9c160fccaf6c8cd694b752450517b20ac60a9040c8227b6
4
- data.tar.gz: c88ebfdc202da7b8b17d14031bd1502b319a5754c3f575e96ba258b1641932dc
3
+ metadata.gz: 8d639c8a6307238a7dbc87d0d3a66b0e69c693db6d124cea7f7d89cfa5cc7488
4
+ data.tar.gz: eb19fa1766b92049d2900829a730ccc0fdd78dd18465f8b5ae9d28df384e799b
5
5
  SHA512:
6
- metadata.gz: f954f6572aed87a243514cf798da0550e12013f26b1c0668379662318c959b0697ae74ab26795711298f3b05636cc7293622e6e9e7ef97cf51ad59463fcc4d98
7
- data.tar.gz: f48e8d78fa746d5166faca83e9713456f172626f49c5f2e2af3e6a999a30bdc480d9e48eadeff49ba60cfe0a8f4a1f5120f8b01b215e7ab1ae537a1805fccfb3
6
+ metadata.gz: 7ac1cc1a3e0b046b5add6a53001a2c602741ca62d3acfee1d6db1a59469af38907693918f821688a5d4c31cde5e27048b56ddd9468ed91d14890d49454dffc7c
7
+ data.tar.gz: 5c7468464f88a6513832236edf49939f534d9482edf27668a55b1ef659c5aec03795c40d1775acf3630f37958f17ce356c856e53bbde2ce19e20514389e1347e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ### v0.24.2.pre
2
+
3
+ * features
4
+ * Add `ShippingZones#update_shipping_method`
5
+
6
+ ### v0.24.1.pre
7
+
8
+ * bug-fixes
9
+ * Fix image upload
10
+
1
11
  ### v0.24.0.pre
2
12
 
3
13
  * features
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beyond_api (0.24.0.pre)
4
+ beyond_api (0.24.2.pre)
5
5
  faraday (~> 1.9.0)
6
6
 
7
7
  GEM
@@ -221,7 +221,7 @@ module BeyondApi
221
221
  response, status = BeyondApi::Request.upload_by_form(@session,
222
222
  "/products/#{product_id}/images",
223
223
  images_path,
224
- file_name: images_name)
224
+ file_name: images_name.map { |e| URI.encode_www_form([e]) })
225
225
 
226
226
  handle_response(response, status)
227
227
  end
@@ -108,7 +108,7 @@ module BeyondApi
108
108
  # "amount" => "19.99"
109
109
  # }
110
110
  # }
111
- # @shipping_zone = session.shipping_zones.create_shipping_method("905e981c-1489-45af-9138-0a7dc1f0b085", body)
111
+ # @shipping_method = session.shipping_zones.create_shipping_method("905e981c-1489-45af-9138-0a7dc1f0b085", body)
112
112
  #
113
113
  def create_shipping_method(shipping_zone_id, body)
114
114
  path = "/shipping-zones/#{shipping_zone_id}/shipping-methods"
@@ -360,5 +360,61 @@ module BeyondApi
360
360
 
361
361
  handle_response(response, status)
362
362
  end
363
+
364
+ #
365
+ # A +PUT+ request is used to update a shipping method in a shipping zone.
366
+ #
367
+ # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/c4137d8b-3dd1-4b73-91f0-32f1433c8195/shipping-methods/25df7018-a7a2-4903-85fa-6a3a73ae40b2' -i -X PUT \
368
+ # -H 'Content-Type: application/json' \
369
+ # -H 'Authorization: Bearer <Access token>' \
370
+ # -d '{
371
+ # "name" : "Express",
372
+ # "description" : "Shipping overnight. Delivery on the next day.",
373
+ # "taxClass" : "REGULAR",
374
+ # "freeShippingValue" : {
375
+ # "currency" : "EUR",
376
+ # "amount" : 200
377
+ # },
378
+ # "fixedPrice" : {
379
+ # "taxModel" : "GROSS",
380
+ # "currency" : "EUR",
381
+ # "amount" : 25
382
+ # }
383
+ # }'
384
+ #
385
+ # @beyond_api.scopes +shpz:u+
386
+ #
387
+ # @param shipping_zone_id [String] the shipping zone UUID
388
+ # @param shipping_method_id [String] the shipping method UUID
389
+ # @param body [String] the request body
390
+ #
391
+ # @return [OpenStruct]
392
+ #
393
+ # @example
394
+ # body = {
395
+ # "name" : "Express",
396
+ # "description" : "Shipping overnight. Delivery on the next day.",
397
+ # "taxClass" : "REGULAR",
398
+ # "freeShippingValue" : {
399
+ # "currency" : "EUR",
400
+ # "amount" : 200
401
+ # },
402
+ # "fixedPrice" : {
403
+ # "taxModel" : "GROSS",
404
+ # "currency" : "EUR",
405
+ # "amount" : 25
406
+ # }
407
+ # }
408
+ # @shipping_method = session.shipping_zones.update_shipping_method("c4137d8b-3dd1-4b73-91f0-32f1433c8195", "25df7018-a7a2-4903-85fa-6a3a73ae40b2", body)
409
+ #
410
+ def update_shipping_method(shipping_zone_id, shipping_method_id, body)
411
+ path = "/shipping-zones/#{shipping_zone_id}/shipping-methods/#{shipping_method_id}"
412
+
413
+ response, status = BeyondApi::Request.put(@session,
414
+ path,
415
+ body)
416
+
417
+ handle_response(response, status)
418
+ end
363
419
  end
364
420
  end
@@ -226,7 +226,7 @@ module BeyondApi
226
226
  response, status = BeyondApi::Request.upload_by_form(@session,
227
227
  "/products/#{product_id}/variations/#{variation_id}/images",
228
228
  images_path,
229
- file_name: images_name)
229
+ file_name: images_name.map { |e| URI.encode_www_form([e]) })
230
230
 
231
231
  handle_response(response, status)
232
232
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BeyondApi
4
- VERSION = "0.24.0.pre"
4
+ VERSION = "0.24.2.pre"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0.pre
4
+ version: 0.24.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unai Abrisketa
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2023-10-06 00:00:00.000000000 Z
14
+ date: 2024-03-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler