spree_api 4.2.1 → 4.2.2

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: 3f0d9c08ae94f0dd6c0b5b36f3f52e0cfef1d1aefed538ef3bdeac3c67298ad8
4
- data.tar.gz: 90665fe4860ccd6de2bbf69eeb2a7f461df86e20338e32455666e8b14637ae48
3
+ metadata.gz: c06616261ed0cce0d2551640447d3c430c953ed35e37431301c61bae2e3dac8a
4
+ data.tar.gz: 81a74ac3a07b00a30f37340a9dde83c1af165eaa975f2d02db199b24ac5a4463
5
5
  SHA512:
6
- metadata.gz: 0b9ca0a68ea05ee7ca88d56ea683aee49bbf8aec2b0521511c71aec8cc9b448e67192b67722e8dc70824de21d140f6df4b512af3a206e437e8ce000362a7fb3a
7
- data.tar.gz: 1a86d97639ff8a1b31fb0a823b4dfb75e70b1dc605e98537facd3fe9c3138d17f8dae90aae827811700c74b33f27f82a18f3e755de44925f4bb771aa27b2066f
6
+ metadata.gz: 87aa9550f3cdb1e7512451e458a55890f69f66c82f688ab45cc6a235b99b47713ac6baf93edc6db7e4605b6c06f34ebf66d63be033567534d2e78d5b3c4440c9
7
+ data.tar.gz: 9ec6f55ed3f69115f2dce5e6e1d88c650047b15aec26c95a892c1a86ada28b46084070cc9d1f96752ac54f7bd1bcd7553d2ce7c8d7abe88a0b1ea816e61429ce
@@ -11,6 +11,9 @@ module Spree
11
11
  rescue_from CanCan::AccessDenied, with: :access_denied
12
12
  rescue_from Spree::Core::GatewayError, with: :gateway_error
13
13
  rescue_from ActionController::ParameterMissing, with: :error_during_processing
14
+ if defined?(JSONAPI::Serializer::UnsupportedIncludeError)
15
+ rescue_from JSONAPI::Serializer::UnsupportedIncludeError, with: :error_during_processing
16
+ end
14
17
  rescue_from ArgumentError, with: :error_during_processing
15
18
 
16
19
  def content_type
@@ -7,15 +7,29 @@ module Spree
7
7
  before_action :require_spree_current_user
8
8
 
9
9
  def create
10
+ spree_authorize! :create, model_class
11
+
10
12
  result = create_service.call(user: spree_current_user, address_params: address_params)
11
13
  render_result(result)
12
14
  end
13
15
 
14
16
  def update
17
+ spree_authorize! :update, resource
18
+
15
19
  result = update_service.call(address: resource, address_params: address_params)
16
20
  render_result(result)
17
21
  end
18
22
 
23
+ def destroy
24
+ spree_authorize! :destroy, resource
25
+
26
+ if resource.destroy
27
+ head 204
28
+ else
29
+ render_error_payload(resource.errors)
30
+ end
31
+ end
32
+
19
33
  private
20
34
 
21
35
  def collection
data/config/routes.rb CHANGED
@@ -152,7 +152,7 @@ Spree::Core::Engine.add_routes do
152
152
  resource :account, controller: :account, only: %i[show]
153
153
 
154
154
  namespace :account do
155
- resources :addresses, controller: :addresses, only: %i[index create update]
155
+ resources :addresses, controller: :addresses
156
156
  resources :credit_cards, controller: :credit_cards, only: %i[index show]
157
157
  resources :orders, controller: :orders, only: %i[index show]
158
158
  end
@@ -239,6 +239,21 @@ paths:
239
239
  security:
240
240
  - bearerAuth: []
241
241
  '/api/v2/storefront/account/addresses/{id}':
242
+ delete:
243
+ description: 'Removes selected Address for the signed in User. It uses soft-delete for addresses with shipments and orders.'
244
+ tags:
245
+ - Account
246
+ operationId: Remove Address
247
+ parameters:
248
+ - $ref: '#/components/parameters/AddressId'
249
+ responses:
250
+ '204':
251
+ description: Requested Address has been removed from the User Account
252
+ '404':
253
+ $ref: '#/components/responses/404NotFound'
254
+ security:
255
+ - bearerAuth: []
256
+ summary: Remove Address
242
257
  patch:
243
258
  description: >-
244
259
  Update selected Address for the signed in User
@@ -247,13 +262,7 @@ paths:
247
262
  - Account
248
263
  operationId: 'Update Address'
249
264
  parameters:
250
- - name: id
251
- in: path
252
- required: true
253
- description: Selected Address for update
254
- schema:
255
- type: string
256
- example: '1'
265
+ - $ref: '#/components/parameters/AddressId'
257
266
  requestBody:
258
267
  required: true
259
268
  content:
@@ -5246,6 +5255,14 @@ components:
5246
5255
  - state_name
5247
5256
  - country_iso
5248
5257
  parameters:
5258
+ AddressId:
5259
+ name: address_id
5260
+ in: path
5261
+ required: true
5262
+ description: Address ID
5263
+ schema:
5264
+ type: string
5265
+ example: '1'
5249
5266
  CreditCardIncludeParam:
5250
5267
  name: include
5251
5268
  in: query
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-05 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-rspec
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.2.1
33
+ version: 4.2.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.2.1
40
+ version: 4.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rabl
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -310,9 +310,9 @@ licenses:
310
310
  - BSD-3-Clause
311
311
  metadata:
312
312
  bug_tracker_uri: https://github.com/spree/spree/issues
313
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.1
313
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.2
314
314
  documentation_uri: https://guides.spreecommerce.org/
315
- source_code_uri: https://github.com/spree/spree/tree/v4.2.1
315
+ source_code_uri: https://github.com/spree/spree/tree/v4.2.2
316
316
  post_install_message:
317
317
  rdoc_options: []
318
318
  require_paths:
@@ -328,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
328
  - !ruby/object:Gem::Version
329
329
  version: '0'
330
330
  requirements: []
331
- rubygems_version: 3.2.3
331
+ rubygems_version: 3.1.4
332
332
  signing_key:
333
333
  specification_version: 4
334
334
  summary: Spree's API