solidus_api 2.11.17 → 3.0.0.rc2

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: d0ce994839400812318548e8b57fc89433f92a11f4bd70a0d7b6badf10619ed1
4
- data.tar.gz: 9c1ecf10d1b28a6dfecfde9f2c0b42fda33ae88206b1983de97998bf70294d53
3
+ metadata.gz: 03f38abf5a8115d6e8ecc4dd6fee2e3e3b1787aaadd8544ebe5ffc46212b6a73
4
+ data.tar.gz: 692143e952bec18b74fe8531085ce71fb75174c3fa1b943b109002d59464fed0
5
5
  SHA512:
6
- metadata.gz: 3d36b92d151bd9b9ee26bc77fa8ad0b03c684998cae4dd0af4568fbe8120f6967324756ad34c29ff79214232835b1dfddeea1d767d89ceceb619ac3f9bf8c38a
7
- data.tar.gz: 13ef043942cc351923ddc08b6e461751a0312e306c29cf44988f0e77aae9fea9cf8a354a6bd97acb7f50beae0814f9824d1a6267725a73fcb784f0a2de6cec71
6
+ metadata.gz: 10b782a658fb0f721a6115b086a802bea34061c7d8abd7547bb52224f3dee90d37dbfda07e29a7c194a59ec2f4e2b33e6aef1a3c7ff7465339e0c39a8261a96a
7
+ data.tar.gz: a236c9b2003e2e79d79390634ba69c579a8757b20cdf9ca0f06ecb19e93be43f71f8a61888e71d6cf72f5c855197b1edb1a9332a891f3c3fb8dc6ee696fce738
@@ -104,7 +104,7 @@ module Spree
104
104
  end
105
105
 
106
106
  def api_key
107
- bearer_token || spree_token || params[:token]
107
+ bearer_token || params[:token]
108
108
  end
109
109
  helper_method :api_key
110
110
 
@@ -114,17 +114,6 @@ module Spree
114
114
  header.gsub(pattern, '') if header.present? && header.match(pattern)
115
115
  end
116
116
 
117
- def spree_token
118
- token = request.headers["X-Spree-Token"]
119
- return if token.blank?
120
-
121
- Spree::Deprecation.warn(
122
- 'The custom X-Spree-Token request header is deprecated and will be removed in the next release.' \
123
- ' Please use bearer token authorization header instead.'
124
- )
125
- token
126
- end
127
-
128
117
  def order_token
129
118
  request.headers["X-Spree-Order-Token"] || params[:order_token]
130
119
  end
@@ -9,11 +9,10 @@ module Spree
9
9
 
10
10
  rescue_from Spree::Order::InsufficientStock, with: :insufficient_stock_error
11
11
 
12
- include Spree::Core::ControllerHelpers::Order
13
-
14
- # TODO: Remove this after deprecated usage in #update is removed
15
12
  include Spree::Core::ControllerHelpers::PaymentParameters
16
13
 
14
+ include Spree::Core::ControllerHelpers::Order
15
+
17
16
  def next
18
17
  authorize! :update, @order, order_token
19
18
  if !expected_total_ok?(params[:expected_total])
@@ -95,7 +94,7 @@ module Spree
95
94
  massaged_params
96
95
  end
97
96
 
98
- # Should be overriden if you have areas of your checkout that don't match
97
+ # Should be overridden if you have areas of your checkout that don't match
99
98
  # up to a step within checkout_steps, such as a registration step
100
99
  def skip_state_validation?
101
100
  false
@@ -116,17 +115,6 @@ module Spree
116
115
  end
117
116
 
118
117
  def after_update_attributes
119
- if params[:order] && params[:order][:coupon_code].present?
120
- Spree::Deprecation.warn('This method is deprecated. Please use `Spree::Api::CouponCodesController#create` endpoint instead.')
121
- handler = PromotionHandler::Coupon.new(@order)
122
- handler.apply
123
-
124
- if handler.error.present?
125
- @coupon_message = handler.error
126
- respond_with(@order, default_template: 'spree/api/orders/could_not_apply_coupon', status: 422)
127
- return true
128
- end
129
- end
130
118
  false
131
119
  end
132
120
 
@@ -12,8 +12,6 @@ module Spree
12
12
  class_attribute :admin_payment_attributes
13
13
  self.admin_payment_attributes = [:payment_method, :amount, :state, source: {}]
14
14
 
15
- skip_before_action :authenticate_user, only: :apply_coupon_code
16
-
17
15
  before_action :find_order, except: [:create, :mine, :current, :index]
18
16
  around_action :lock_order, except: [:create, :mine, :current, :index, :show]
19
17
 
@@ -104,20 +102,6 @@ module Spree
104
102
  end
105
103
  end
106
104
 
107
- def apply_coupon_code
108
- Spree::Deprecation.warn('This method is deprecated. Please use `Spree::Api::CouponCodesController#create` endpoint instead.')
109
-
110
- authorize! :update, @order, order_token
111
- @order.coupon_code = params[:coupon_code]
112
- @handler = PromotionHandler::Coupon.new(@order).apply
113
- if @handler.successful?
114
- render "spree/api/promotions/handler", status: 200
115
- else
116
- logger.error("apply_coupon_code_error=#{@handler.error.inspect}")
117
- render "spree/api/promotions/handler", status: 422
118
- end
119
- end
120
-
121
105
  private
122
106
 
123
107
  def order_params
@@ -15,12 +15,6 @@ module Spree
15
15
  respond_with(taxonomy)
16
16
  end
17
17
 
18
- # Because JSTree wants parameters in a *slightly* different format
19
- def jstree
20
- Spree::Deprecation.warn("Please don't use `/api/taxonomies/:taxonomy_id/jstree` endpoint. It is deprecated and will be removed in the next future.", caller)
21
- show
22
- end
23
-
24
18
  def create
25
19
  authorize! :create, Taxonomy
26
20
  @taxonomy = Spree::Taxonomy.new(taxonomy_params)
@@ -29,11 +29,6 @@ module Spree
29
29
  respond_with(@taxon)
30
30
  end
31
31
 
32
- def jstree
33
- Spree::Deprecation.warn("Please don't use `/api/taxonomies/:taxonomy_id/taxons/:taxon_id/jstree` endpoint. It is deprecated and will be removed in the next future.", caller)
34
- show
35
- end
36
-
37
32
  def create
38
33
  authorize! :create, Taxon
39
34
  @taxon = Spree::Taxon.new(taxon_params)
@@ -126,19 +126,12 @@ module Spree
126
126
  :id, :number, :state, :order_id, :memo, :created_at, :updated_at
127
127
  ]
128
128
 
129
- @@address_base_attributes = [
129
+ @@address_attributes = [
130
130
  :id, :name, :address1, :address2, :city, :zipcode, :phone, :company,
131
131
  :alternative_phone, :country_id, :country_iso, :state_id, :state_name,
132
132
  :state_text
133
133
  ]
134
134
 
135
- @@address_attributes = if Spree::Config.use_combined_first_and_last_name_in_address
136
- @@address_base_attributes
137
- else
138
- @@address_base_attributes +
139
- Spree::Address::LEGACY_NAME_ATTRS.map(&:to_sym)
140
- end
141
-
142
135
  @@country_attributes = [:id, :iso_name, :iso, :iso3, :name, :numcode]
143
136
 
144
137
  @@state_attributes = [:id, :name, :abbr, :country_id]
@@ -1,4 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- json.default_country_id(Spree::Country.default.id)
4
3
  json.default_country_iso(Spree::Config[:default_country_iso])
data/config/routes.rb CHANGED
@@ -4,11 +4,6 @@ Spree::Core::Engine.routes.draw do
4
4
  namespace :admin do
5
5
  resources :users do
6
6
  resource :api_key, controller: 'users/api_key', only: [:create, :destroy]
7
-
8
- member do
9
- put :generate_api_key # Deprecated
10
- put :clear_api_key # Deprecated
11
- end
12
7
  end
13
8
  end
14
9
 
@@ -68,7 +63,6 @@ Spree::Core::Engine.routes.draw do
68
63
  member do
69
64
  put :cancel
70
65
  put :empty
71
- put :apply_coupon_code
72
66
  end
73
67
 
74
68
  resources :coupon_codes, only: [:create, :destroy]
@@ -99,14 +93,7 @@ Spree::Core::Engine.routes.draw do
99
93
  resources :states, only: [:index, :show]
100
94
 
101
95
  resources :taxonomies do
102
- member do
103
- get :jstree
104
- end
105
- resources :taxons do
106
- member do
107
- get :jstree
108
- end
109
- end
96
+ resources :taxons
110
97
  end
111
98
 
112
99
  resources :taxons, only: [:index]
@@ -8,7 +8,7 @@ module Spree
8
8
  isolate_namespace Spree
9
9
  engine_name 'spree_api'
10
10
 
11
- # Leave initializer empty for backwards-compatability. Other apps
11
+ # Leave initializer empty for backwards-compatibility. Other apps
12
12
  # might still rely on this event.
13
13
  initializer "spree.api.environment", before: :load_config_initializers do; end
14
14
  end
@@ -16,8 +16,6 @@ module Spree
16
16
  options[:default_template]
17
17
  end
18
18
  end
19
-
20
- RablTemplate = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('RablTemplate', 'JbuilderTemplate')
21
19
  end
22
20
  end
23
21
  end
@@ -27,7 +27,7 @@ module Spree
27
27
  allow(Spree.user_class).to receive(:find_by).with(hash_including(:spree_api_key)) { current_api_user }
28
28
  end
29
29
 
30
- # This method can be overriden (with a let block) inside a context
30
+ # This method can be overridden (with a let block) inside a context
31
31
  # For instance, if you wanted to have an admin user instead.
32
32
  def current_api_user
33
33
  @current_api_user ||= stub_model(Spree::LegacyUser, email: "solidus@example.com", spree_roles: [])
@@ -1,7 +1,7 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
3
  title: Solidus API
4
- version: "1.0"
4
+ version: '1.0'
5
5
  description: The standard Solidus API.
6
6
  contact:
7
7
  name: Solidus
@@ -1067,12 +1067,10 @@ paths:
1067
1067
  '422':
1068
1068
  $ref: '#/components/responses/delete-restriction'
1069
1069
  summary: Remove address from user address book
1070
- description: >-
1070
+ description: |-
1071
1071
  Removes an address from a user's address book.
1072
1072
 
1073
-
1074
- **Note:** Rather than delete a `Spree::UserAddress` record this action
1075
- set its `archived` attribute to `true`.
1073
+ **Note:** Rather than delete a `Spree::UserAddress` record this action set its `archived` attribute to `true`.
1076
1074
  operationId: remove-address-from-user-address-book
1077
1075
  tags:
1078
1076
  - Address books
@@ -1101,16 +1099,10 @@ paths:
1101
1099
  operationId: update-user-address-book
1102
1100
  tags:
1103
1101
  - Address books
1104
- description: >-
1102
+ description: |-
1105
1103
  Updates a user's address book.
1106
1104
 
1107
-
1108
- **Note:** if the passed `id` matches an existing `address` a new
1109
- `Spree::Address` record will be created and the matched `address`
1110
- `archived` on `Spree::UserAddress`. For a similar logic, if the passed
1111
- `id` matches an existing `address` which is in `archived` state, the
1112
- `Spree::UserAddress#archived` record will be restored to `false`.
1113
-
1105
+ **Note:** if the passed `id` matches an existing `address` a new `Spree::Address` record will be created and the matched `address` `archived` on `Spree::UserAddress`. For a similar logic, if the passed `id` matches an existing `address` which is in `archived` state, the `Spree::UserAddress#archived` record will be restored to `false`.
1114
1106
  See `user_address_book.rb` for further information.
1115
1107
  security:
1116
1108
  - api-key: []
@@ -1521,7 +1513,7 @@ paths:
1521
1513
  '422':
1522
1514
  $ref: '#/components/responses/unprocessable-entity'
1523
1515
  summary: Update order customer return
1524
- description: "Updates an orders customer return."
1516
+ description: Updates an orders customer return.
1525
1517
  operationId: update-order-customer-return
1526
1518
  tags:
1527
1519
  - Customer returns
@@ -1897,8 +1889,6 @@ paths:
1897
1889
  schema:
1898
1890
  type: object
1899
1891
  properties:
1900
- default_country_id:
1901
- type: integer
1902
1892
  default_country_iso:
1903
1893
  type: string
1904
1894
  '401':
@@ -3502,65 +3492,6 @@ paths:
3502
3492
  - api-key: []
3503
3493
  requestBody:
3504
3494
  $ref: '#/components/requestBodies/zone-input'
3505
- '/taxonomies/{taxonomy_id}/jstree':
3506
- get:
3507
- responses:
3508
- '200':
3509
- description: ''
3510
- content:
3511
- application/json:
3512
- schema:
3513
- $ref: '#/components/schemas/jstree'
3514
- '401':
3515
- $ref: '#/components/responses/invalid-api-key'
3516
- '404':
3517
- $ref: '#/components/responses/not-found'
3518
- summary: Get taxonomy jsTree
3519
- description: Builds a taxonomy's jsTree.
3520
- operationId: get-taxonomy-jstree
3521
- tags:
3522
- - Taxonomies
3523
- security:
3524
- - api-key: []
3525
- parameters:
3526
- - name: taxonomy_id
3527
- in: path
3528
- required: true
3529
- schema:
3530
- type: string
3531
- '/taxonomies/{taxonomy_id}/taxons/{taxon_id}/jstree':
3532
- get:
3533
- responses:
3534
- '200':
3535
- description: ''
3536
- content:
3537
- application/json:
3538
- schema:
3539
- type: array
3540
- items:
3541
- $ref: '#/components/schemas/jstree'
3542
- '401':
3543
- $ref: '#/components/responses/invalid-api-key'
3544
- '404':
3545
- $ref: '#/components/responses/not-found'
3546
- summary: Get taxon jsTree
3547
- description: Builds a taxon's jsTree.
3548
- operationId: get-taxon-jstree
3549
- tags:
3550
- - Taxons
3551
- security:
3552
- - api-key: []
3553
- parameters:
3554
- - name: taxonomy_id
3555
- in: path
3556
- required: true
3557
- schema:
3558
- type: string
3559
- - name: taxon_id
3560
- in: path
3561
- required: true
3562
- schema:
3563
- type: string
3564
3495
  '/promotions/{id}':
3565
3496
  get:
3566
3497
  responses:
@@ -3844,13 +3775,10 @@ paths:
3844
3775
  '422':
3845
3776
  $ref: '#/components/responses/unprocessable-entity'
3846
3777
  summary: Update checkout
3847
- description: >-
3778
+ description: |-
3848
3779
  Updates a checkout.
3849
3780
 
3850
-
3851
- **Note:** In addition to the order update, this action always attempts
3852
- to perform an order state machine transition which results in a `422`
3853
- response if it cannot be transitioned.
3781
+ **Note:** In addition to the order update, this action always attempts to perform an order state machine transition which results in a `422` response if it cannot be transitioned.
3854
3782
  operationId: update-checkout
3855
3783
  tags:
3856
3784
  - Checkouts
@@ -4268,42 +4196,6 @@ paths:
4268
4196
  type: integer
4269
4197
  position:
4270
4198
  type: integer
4271
- '/orders/{order_number}/apply_coupon_code':
4272
- put:
4273
- responses:
4274
- '200':
4275
- description: ''
4276
- content:
4277
- application/json:
4278
- schema:
4279
- $ref: '#/components/schemas/coupon-code-handler'
4280
- '401':
4281
- $ref: '#/components/responses/invalid-api-key'
4282
- '404':
4283
- $ref: '#/components/responses/not-found'
4284
- '422':
4285
- $ref: '#/components/responses/unprocessable-entity'
4286
- summary: Apply order coupon code
4287
- deprecated: true
4288
- description: >-
4289
- **Deprecated:** This method is deprecated. Please use
4290
- `Spree::Api::CouponCodesController#create` endpoint instead.
4291
-
4292
- Applies a coupon code on the order.
4293
- operationId: apply-order-coupon-code
4294
- tags:
4295
- - Coupon codes
4296
- security:
4297
- - api-key: []
4298
- - order-token: []
4299
- requestBody:
4300
- $ref: '#/components/requestBodies/coupon-code-input'
4301
- parameters:
4302
- - name: order_number
4303
- in: path
4304
- required: true
4305
- schema:
4306
- type: string
4307
4199
  '/orders/{order_number}/cancel':
4308
4200
  put:
4309
4201
  responses:
@@ -4983,7 +4875,7 @@ paths:
4983
4875
  '404':
4984
4876
  $ref: '#/components/responses/not-found'
4985
4877
  summary: List order customer returns
4986
- description: "Lists an order's customer returns."
4878
+ description: Lists an order's customer returns.
4987
4879
  operationId: list-order-customer-returns
4988
4880
  tags:
4989
4881
  - Customer returns
@@ -5675,20 +5567,8 @@ components:
5675
5567
  type: integer
5676
5568
  country_iso:
5677
5569
  type: string
5678
- firstname:
5679
- type: string
5680
- deprecated: true
5681
- description: '*Deprecated: will be removed in Solidus 3.0, please use `name` property*'
5682
- full_name:
5683
- type: string
5684
- deprecated: true
5685
- description: '*Deprecated: will be removed in Solidus 3.0, please use `name` property*'
5686
5570
  id:
5687
5571
  type: integer
5688
- lastname:
5689
- type: string
5690
- deprecated: true
5691
- description: '*Deprecated: will be removed in Solidus 3.0, please use `name` property*'
5692
5572
  name:
5693
5573
  type: string
5694
5574
  phone:
@@ -6117,23 +5997,6 @@ components:
6117
5997
  root:
6118
5998
  $ref: '#/components/schemas/taxon'
6119
5999
  title: Taxonomy
6120
- jstree:
6121
- type: array
6122
- items:
6123
- type: object
6124
- properties:
6125
- attr:
6126
- type: object
6127
- properties:
6128
- id:
6129
- type: integer
6130
- name:
6131
- type: string
6132
- data:
6133
- type: string
6134
- state:
6135
- type: string
6136
- title: jsTree
6137
6000
  promotion:
6138
6001
  type: object
6139
6002
  properties:
@@ -6225,14 +6088,6 @@ components:
6225
6088
  type: integer
6226
6089
  name:
6227
6090
  type: string
6228
- firstname:
6229
- type: string
6230
- deprecated: true
6231
- description: '*Deprecated: will be removed in Solidus 3.0, please use `name` property*'
6232
- lastname:
6233
- type: string
6234
- deprecated: true
6235
- description: '*Deprecated: will be removed in Solidus 3.0, please use `name` property*'
6236
6091
  address1:
6237
6092
  type: string
6238
6093
  address2:
@@ -6282,10 +6137,7 @@ components:
6282
6137
  description: 'Passing `0`, the line item will be removed.'
6283
6138
  options:
6284
6139
  type: object
6285
- description: >-
6286
- This field can be used to pass custom line item attributes. When
6287
- used, it will force a new price calculation, unless `price` is one
6288
- of the options.
6140
+ description: 'This field can be used to pass custom line item attributes. When used, it will force a new price calculation, unless `price` is one of the options.'
6289
6141
  id:
6290
6142
  type: integer
6291
6143
  description: Required for existing line items only.
@@ -6399,8 +6251,6 @@ components:
6399
6251
  type: string
6400
6252
  encrypted_data:
6401
6253
  type: string
6402
- existing_card_id:
6403
- type: integer
6404
6254
  wallet_payment_source_id:
6405
6255
  type: integer
6406
6256
  address_attributes:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.17
4
+ version: 3.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-15 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jbuilder
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 2.11.17
61
+ version: 3.0.0.rc2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 2.11.17
68
+ version: 3.0.0.rc2
69
69
  description: REST API for the Solidus e-commerce framework.
70
70
  email: contact@solidus.io
71
71
  executables: []
@@ -151,7 +151,6 @@ files:
151
151
  - app/views/spree/api/orders/_big.json.jbuilder
152
152
  - app/views/spree/api/orders/_order.json.jbuilder
153
153
  - app/views/spree/api/orders/could_not_apply_coupon.json.jbuilder
154
- - app/views/spree/api/orders/could_not_transition.json.jbuilder
155
154
  - app/views/spree/api/orders/expected_total_mismatch.json.jbuilder
156
155
  - app/views/spree/api/orders/index.json.jbuilder
157
156
  - app/views/spree/api/orders/invalid_shipping_method.json.jbuilder
@@ -257,7 +256,7 @@ homepage: http://solidus.io
257
256
  licenses:
258
257
  - BSD-3-Clause
259
258
  metadata: {}
260
- post_install_message:
259
+ post_install_message:
261
260
  rdoc_options: []
262
261
  require_paths:
263
262
  - lib
@@ -272,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
271
  - !ruby/object:Gem::Version
273
272
  version: 1.8.23
274
273
  requirements: []
275
- rubygems_version: 3.1.2
276
- signing_key:
274
+ rubygems_version: 3.1.4
275
+ signing_key:
277
276
  specification_version: 4
278
277
  summary: REST API for the Solidus e-commerce framework.
279
278
  test_files: []
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Spree::Deprecation.warn(
4
- 'spree/api/orders/could_not_transition is deprecated.' \
5
- ' Please use spree/api/errors/could_not_transition'
6
- )
7
-
8
- json.error(I18n.t(:could_not_transition, scope: "spree.api.order"))
9
- json.errors(@order.errors.to_hash)