beyond_api 0.15.0.pre → 0.16.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 438360193bc7064cbd6591e9dc088aeb81f162aac26bff0ac1f891f45b5b9993
4
- data.tar.gz: 57f358035cc7aa0ee5ee0795eecb3f887b5f534d470342348d70c6e6c6f1ac48
3
+ metadata.gz: a6c559696ebb3e320f0eba53263a1a2e4e1f6122abbee3abb0f9dcdcae0ed51c
4
+ data.tar.gz: aed55ba3c13a04013d7aa4e7c4fcdea9252f1c93623b982eac53fa8557b098d8
5
5
  SHA512:
6
- metadata.gz: 284505c3dc6af706bd3851fe62c885ce2aec79c76a997b2c07f20a23d5745c3a7d16c337177de9579b25c0fe9440b2b9e04f5cfdd2ec377362effb2a98df7b0b
7
- data.tar.gz: eb9168f92793a47673646fcb8ac36bd6c5103596620a1003a143242a938ceba156429fe3760f41672c705a23f367ad2be40d6607c0f112ecdf16be1ead96a0b1
6
+ metadata.gz: 7791a721f9b5e8a27e574d93274249e0a7240f2bb2400de235d8d3ab89a07ac133fe15aad399b9af9b305a28e36091f61d3d1fff493bb02e2b30b720955d0947
7
+ data.tar.gz: 7363458296810b56dbcf80e220a2aad5c04a27c66b1f51e4485a9667ef671368aab1e8ed354b7d8692a4248dfc7ec41fd8bb2c66dc43f2015d5492a14cb8b255
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### v0.16.0.pre
2
+
3
+ * features
4
+ * Add pickup options methods
5
+ * `PickupOptions#delete`
6
+ * `PickupOptions#find`
7
+ * `PickupOptions#sort`
8
+ * `PickupOptions#update`
9
+
1
10
  ### v0.15.0.pre
2
11
 
3
12
  * features
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beyond_api (0.15.0.pre)
4
+ beyond_api (0.16.0.pre)
5
5
  faraday (~> 0.15)
6
6
 
7
7
  GEM
@@ -68,9 +68,9 @@ module BeyondApi
68
68
  # tax_model: "GROSS",
69
69
  # currency: "EUR",
70
70
  # amount: 1
71
- # },
72
- # phone_number_required: true,
73
- # location_id: "cb554eb6-2768-4491-afd2-6bcd0aec0937"
71
+ # },
72
+ # phone_number_required: true,
73
+ # location_id: "cb554eb6-2768-4491-afd2-6bcd0aec0937"
74
74
  # }
75
75
  #
76
76
  # @pickup_option = session.pickup_options.create(body)
@@ -80,5 +80,137 @@ module BeyondApi
80
80
 
81
81
  handle_response(response, status)
82
82
  end
83
+
84
+ #
85
+ # A +DELETE+ request is used to delete a pickup option.
86
+ #
87
+ # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/d253a31b-3892-4196-ae16-c5d8d6b05791' -i -X DELETE
88
+ #
89
+ # @beyond_api.scopes +shpz:d+
90
+ #
91
+ # @param pickup_option_id [String] the pickup option UUID
92
+ #
93
+ # @return true
94
+ #
95
+ # @example
96
+ # session.pickup_options.delete("d253a31b-3892-4196-ae16-c5d8d6b05791")
97
+ #
98
+ def delete(pickup_option_id)
99
+ response, status = BeyondApi::Request.delete(@session, "/pickup-options/#{pickup_option_id}")
100
+
101
+ handle_response(response, status, respond_with_true: true)
102
+ end
103
+
104
+ #
105
+ # A +GET+ request is used to retrieve the details of a pickup option.
106
+ #
107
+ # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/76302c10-761f-43c1-9d18-52ad16bd52e8' -i -X GET \
108
+ # -H 'Content-Type: application/json' \
109
+ # -H 'Accept: application/hal+json' \
110
+ # -H 'Authorization: Bearer <Access token>'
111
+ #
112
+ # @beyond_api.scopes +shpz:r+
113
+ #
114
+ # @param pickup_option_id [String] the pickup option UUID
115
+ #
116
+ # @return [OpenStruct]
117
+ #
118
+ # @example
119
+ # @pickup_option = session.pickup_options.find("76302c10-761f-43c1-9d18-52ad16bd52e8")
120
+ #
121
+ def find(pickup_option_id)
122
+ response, status = BeyondApi::Request.get(@session, "/pickup-options/#{pickup_option_id}")
123
+
124
+ handle_response(response, status)
125
+ end
126
+
127
+ #
128
+ # A +PUT+ request is used to sort the pickup options. This is done by passing the self-links of the pickup options in the desired order. The request must contain URIs for all pickup options of the given page.
129
+ #
130
+ # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X PUT \
131
+ # -H 'Content-Type: text/uri-list' \
132
+ # -H 'Authorization: Bearer <Access token>' \
133
+ # -d 'https://api-shop.beyondshop.cloud/api/pickup-options/bff3673f-91c1-4e09-a8ab-562a3a553fac
134
+ # https://api-shop.beyondshop.cloud/api/pickup-options/7b4d36fc-ac0f-44a3-8655-f2bd05c2a42d
135
+ # https://api-shop.beyondshop.cloud/api/pickup-options/630b63ee-c7d8-4953-9b7c-c874fd795154'
136
+ #
137
+ # @beyond_api.scopes +shpz:u+
138
+ #
139
+ # @param pickup_option_ids [Array] the pickup option UUIDs
140
+ #
141
+ # @return [OpenStruct]
142
+ #
143
+ # @example
144
+ # pickup_option_ids = [
145
+ # "bff3673f-91c1-4e09-a8ab-562a3a553fac",
146
+ # "7b4d36fc-ac0f-44a3-8655-f2bd05c2a42d",
147
+ # "630b63ee-c7d8-4953-9b7c-c874fd795154"
148
+ # ]
149
+ #
150
+ # session.pickup_options.sort(pickup_option_ids)
151
+ #
152
+ def sort(pickup_option_ids)
153
+ body = pickup_option_ids.map { |id| "#{@session.api_url}/pickup-options/#{id}" }
154
+ response, status = BeyondApi::Request.put(@session, "/pickup-options", body)
155
+
156
+ handle_response(response, status, respond_with_true: true)
157
+ end
158
+
159
+ #
160
+ # A +PUT+ request is used to update a pickup option.
161
+ #
162
+ # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/5765b837-db5b-49a9-a659-68d00376e42a' -i -X PUT \
163
+ # -H 'Content-Type: application/json' \
164
+ # -H 'Accept: application/hal+json' \
165
+ # -H 'Authorization: Bearer <Access token>' \
166
+ # -d '{
167
+ # "name" : "New name",
168
+ # "description" : "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.",
169
+ # "taxClass" : "REGULAR",
170
+ # "freePickupValue" : {
171
+ # "currency" : "EUR",
172
+ # "amount" : 50
173
+ # },
174
+ # "fixedPrice" : {
175
+ # "taxModel" : "GROSS",
176
+ # "currency" : "EUR",
177
+ # "amount" : 1
178
+ # },
179
+ # "phoneNumberRequired" : true,
180
+ # "locationId" : "c9179393-abcc-450a-8cf4-875b39647ab6"
181
+ # }'
182
+ #
183
+ # @beyond_api.scopes +shpz:u+
184
+ #
185
+ # @param pickup_option_id [String] the pickup option UUID
186
+ # @param body [Hash] the request body
187
+ #
188
+ # @return [OpenStruct]
189
+ #
190
+ # @example
191
+ # body = {
192
+ # name: "New name",
193
+ # description: "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.",
194
+ # tax_class: "REGULAR",
195
+ # free_pickup_value: {
196
+ # currency: "EUR",
197
+ # amount: 50
198
+ # },
199
+ # fixed_price: {
200
+ # tax_model: "GROSS",
201
+ # currency: "EUR",
202
+ # amount: 1
203
+ # },
204
+ # phone_number_required: true,
205
+ # location_id: "c9179393-abcc-450a-8cf4-875b39647ab6"
206
+ # }
207
+ #
208
+ # @pickup_option = session.pickup_options.update("5765b837-db5b-49a9-a659-68d00376e42a", body)
209
+ #
210
+ def update(pickup_option_id, body)
211
+ response, status = BeyondApi::Request.put(@session, "/pickup-options/#{pickup_option_id}", body)
212
+
213
+ handle_response(response, status)
214
+ end
83
215
  end
84
216
  end
@@ -1,3 +1,3 @@
1
1
  module BeyondApi
2
- VERSION = "0.15.0.pre".freeze
2
+ VERSION = "0.16.0.pre".freeze
3
3
  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.15.0.pre
4
+ version: 0.16.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unai Abrisketa
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-06-18 00:00:00.000000000 Z
13
+ date: 2021-06-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler