Skip to content

Commit 11544e0

Browse files
authored
Release v0.15.0.pre (#35)
* Add pickup options methods * Minor fix
1 parent 8800b05 commit 11544e0

File tree

5 files changed

+101
-5
lines changed

5 files changed

+101
-5
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### v0.15.0.pre
2+
3+
* features
4+
* Add pickup options methods
5+
* `PickupOptions#all`
6+
* `PickupOptions#create`
7+
18
### v0.14.0.pre
29

310
* deprecations

Gemfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
PATH
22
remote: .
33
specs:
4-
beyond_api (0.14.0.pre)
4+
beyond_api (0.15.0.pre)
55
faraday (~> 0.15)
66

77
GEM
88
remote: https://rubygems.org/
99
specs:
1010
coderay (1.1.3)
11-
concurrent-ruby (1.1.8)
11+
concurrent-ruby (1.1.9)
1212
diff-lcs (1.4.4)
1313
dotenv (2.7.6)
14-
faker (2.17.0)
14+
faker (2.18.0)
1515
i18n (>= 1.6, < 2)
1616
faraday (0.17.4)
1717
multipart-post (>= 1.2, < 3)
1818
i18n (1.8.10)
1919
concurrent-ruby (~> 1.0)
2020
method_source (1.0.0)
2121
multipart-post (2.1.1)
22-
pry (0.14.0)
22+
pry (0.14.1)
2323
coderay (~> 1.1)
2424
method_source (~> 1.0)
2525
rake (10.5.0)
+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# frozen_string_literal: true
2+
3+
require "beyond_api/utils"
4+
5+
module BeyondApi
6+
class PickupOptions < Base
7+
include BeyondApi::Utils
8+
9+
#
10+
# A +GET+ request is used to list all pickup options of the shop in a paged way.
11+
#
12+
# $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X GET \
13+
# -H 'Accept: application/hal+json' \
14+
# -H 'Authorization: Bearer <Access token>'
15+
#
16+
# @option params [Boolean] :paginated
17+
# @option params [Integer] :size the page size
18+
# @option params [Integer] :page the page number
19+
#
20+
# @return [OpenStruct]
21+
#
22+
# @example
23+
# @pickup_options = session.pickup_options.all(size: 100, page: 0)
24+
#
25+
def all(params = {})
26+
handle_all_request("/pickup-options", :pickup_options, params)
27+
end
28+
29+
#
30+
# A +POST+ request is used to create a pickup option.
31+
#
32+
# $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X POST \
33+
# -H 'Content-Type: application/json' \
34+
# -H 'Authorization: Bearer <Access token>' \
35+
# -d '{
36+
# "name" : "My little Cornershop - St.Ives",
37+
# "description" : "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.",
38+
# "taxClass" : "REGULAR",
39+
# "freePickupValue" : {
40+
# "currency" : "EUR",
41+
# "amount" : 50
42+
# },
43+
# "fixedPrice" : {
44+
# "taxModel" : "GROSS",
45+
# "currency" : "EUR",
46+
# "amount" : 1
47+
# },
48+
# "phoneNumberRequired" : true,
49+
# "locationId" : "cb554eb6-2768-4491-afd2-6bcd0aec0937"
50+
# }'
51+
#
52+
# @beyond_api.scopes +shpz:c+
53+
#
54+
# @param body [Hash] the request body
55+
#
56+
# @return [OpenStruct]
57+
#
58+
# @example
59+
# body = {
60+
# name: "My little Cornershop - St.Ives",
61+
# description: "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.",
62+
# tax_class: "REGULAR",
63+
# free_pickup_value: {
64+
# currency: "EUR",
65+
# amount: 50
66+
# },
67+
# fixed_price: {
68+
# tax_model: "GROSS",
69+
# currency: "EUR",
70+
# amount: 1
71+
# },
72+
# phone_number_required: true,
73+
# location_id: "cb554eb6-2768-4491-afd2-6bcd0aec0937"
74+
# }
75+
#
76+
# @pickup_option = session.pickup_options.create(body)
77+
#
78+
def create(body)
79+
response, status = BeyondApi::Request.post(@session, "/pickup-options", body)
80+
81+
handle_response(response, status)
82+
end
83+
end
84+
end

lib/beyond_api/session.rb

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module BeyondApi
1111
autoload :OrderSettings, "beyond_api/resources/order_settings"
1212
autoload :Orders, "beyond_api/resources/orders"
1313
autoload :PaymentMethodDefinitions, "beyond_api/resources/payment_method_definitions"
14+
autoload :PickupOptions, "beyond_api/resources/pickup_options"
1415
autoload :PaymentMethods, "beyond_api/resources/payment_methods"
1516
autoload :ProductAttributeDefinitions, "beyond_api/resources/product_attribute_definitions"
1617
autoload :ProductsView, "beyond_api/resources/products_view"
@@ -74,6 +75,10 @@ def payment_methods
7475
BeyondApi::PaymentMethods.new(self)
7576
end
7677

78+
def pickup_options
79+
BeyondApi::PickupOptions.new(self)
80+
end
81+
7782
def product_attribute_definitions
7883
BeyondApi::ProductAttributeDefinitions.new(self)
7984
end

lib/beyond_api/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module BeyondApi
2-
VERSION = "0.14.0.pre".freeze
2+
VERSION = "0.15.0.pre".freeze
33
end

0 commit comments

Comments
 (0)