spree_api 4.1.10 → 4.1.11

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: '081a59e1e4a0962307541447f46aee0b5aa37996d93063bb9f1a8a48fa7284f4'
4
- data.tar.gz: ce108948d989bd3b6e77811c5ee644459be649923d018ab2b909d7982f90207b
3
+ metadata.gz: e2baaee4d0e6297e9f2ffba141032c0d641a8d69bc388168d60c4a1d3e39b70b
4
+ data.tar.gz: 3ce601cd7f2acd629800e1caeeac39f7c97dac666a11a0b0210832b9e6a5d025
5
5
  SHA512:
6
- metadata.gz: f4d6373fde6c57a192903b224a292ed9cffaad0b19e8ddc0c99bff2f74f6dc7409f053bd2c2c4506f71c56af214b6e7cc98b9c9d75e0e7663af69782f60fa2b2
7
- data.tar.gz: 7d9fc0748f73eeba62edb386e55ea4615a13b3add5014cc0131451f6977942087ef8ca0b7a3935dd6412233e1296cc81575f4291d90be24efbaf83c58c55dc5d
6
+ metadata.gz: e9487c9126a9dfb16b40dd846649b911c447721af0f29481c515d1aa1660235922c706f396f9ee3e1bff3c8f8f96ee78093e96bd14490fbea94d1d19628ed729
7
+ data.tar.gz: 1402f35f982ea20345aa6b44f78db0d04b99d03eb95ba58c0143c66caf7a776d41d04fb84130cbce46be80b9a5220ec20ae9182839084802955794f160935d23
@@ -53,7 +53,12 @@ module Spree
53
53
  end
54
54
 
55
55
  def spree_current_user
56
- @spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id) if doorkeeper_token
56
+ return nil unless doorkeeper_token
57
+ return @spree_current_user if @spree_current_user
58
+
59
+ doorkeeper_authorize!
60
+
61
+ @spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id)
57
62
  end
58
63
 
59
64
  def spree_authorize!(action, subject, *args)
@@ -125,8 +125,7 @@ module Spree
125
125
  def serialize_shipping_rates(shipments)
126
126
  shipping_rates_serializer.new(
127
127
  shipments,
128
- include: [:shipping_rates, :stock_location],
129
- params: { show_rates: true }
128
+ include: [:shipping_rates, :stock_location]
130
129
  ).serializable_hash
131
130
  end
132
131
  end
@@ -8,7 +8,8 @@ module Spree
8
8
  :updated_at, :completed_at, :included_tax_total, :additional_tax_total, :display_additional_tax_total,
9
9
  :display_included_tax_total, :tax_total, :currency, :state, :token, :email,
10
10
  :display_item_total, :display_ship_total, :display_adjustment_total, :display_tax_total,
11
- :promo_total, :display_promo_total, :item_count, :special_instructions, :display_total
11
+ :promo_total, :display_promo_total, :item_count, :special_instructions, :display_total,
12
+ :pre_tax_item_amount, :display_pre_tax_item_amount, :pre_tax_total, :display_pre_tax_total
12
13
 
13
14
  has_many :line_items
14
15
  has_many :variants
@@ -9,7 +9,8 @@ module Spree
9
9
  :display_adjustment_total, :additional_tax_total,
10
10
  :discounted_amount, :display_discounted_amount,
11
11
  :display_additional_tax_total, :promo_total, :display_promo_total,
12
- :included_tax_total, :display_included_tax_total
12
+ :included_tax_total, :display_included_tax_total,
13
+ :pre_tax_amount, :display_pre_tax_amount
13
14
 
14
15
  belongs_to :variant
15
16
  end
@@ -9,7 +9,7 @@ module Spree
9
9
 
10
10
  attribute :free, &:free?
11
11
 
12
- has_many :shipping_rates, if: proc { |_record, params| params&.dig(:show_rates) }
12
+ has_many :shipping_rates
13
13
 
14
14
  belongs_to :stock_location
15
15
  end
@@ -1299,6 +1299,18 @@ components:
1299
1299
  display_tax_total:
1300
1300
  type: string
1301
1301
  example: '$10.00'
1302
+ pre_tax_item_amount:
1303
+ type: string
1304
+ example: '17.00'
1305
+ display_pre_tax_item_amount:
1306
+ type: string
1307
+ example: '$17.00'
1308
+ pre_tax_total:
1309
+ type: string
1310
+ example: '20.00'
1311
+ display_pre_tax_total:
1312
+ type: string
1313
+ example: '$20.00'
1302
1314
  item_count:
1303
1315
  type: number
1304
1316
  example: 2
@@ -1511,6 +1523,12 @@ components:
1511
1523
  display_discounted_amount:
1512
1524
  type: string
1513
1525
  example: '$125.00'
1526
+ pre_tax_amount:
1527
+ type: string
1528
+ example: '125.0'
1529
+ display_pre_tax_amount:
1530
+ type: string
1531
+ example: '$125.00'
1514
1532
  promo_total:
1515
1533
  type: string
1516
1534
  example: '-5.0'
@@ -4,7 +4,7 @@ shared_context 'API v2 tokens' do
4
4
  let(:headers_order_token) { { 'X-Spree-Order-Token' => order.token } }
5
5
  end
6
6
 
7
- [200, 201, 400, 404, 403, 422].each do |status_code|
7
+ [200, 201, 400, 401, 404, 403, 422].each do |status_code|
8
8
  shared_examples "returns #{status_code} HTTP status" do
9
9
  it "returns #{status_code}" do
10
10
  expect(response.status).to eq(status_code)
@@ -48,6 +48,10 @@ shared_examples 'returns valid cart JSON' do
48
48
  expect(json_response['data']).to have_attribute(:promo_total).with_value(order.promo_total.to_s)
49
49
  expect(json_response['data']).to have_attribute(:display_promo_total).with_value(order.display_promo_total.to_s)
50
50
  expect(json_response['data']).to have_attribute(:display_total).with_value(order.display_total.to_s)
51
+ expect(json_response['data']).to have_attribute(:pre_tax_item_amount).with_value(order.pre_tax_item_amount.to_s)
52
+ expect(json_response['data']).to have_attribute(:display_pre_tax_item_amount).with_value(order.display_pre_tax_item_amount.to_s)
53
+ expect(json_response['data']).to have_attribute(:pre_tax_total).with_value(order.pre_tax_total.to_s)
54
+ expect(json_response['data']).to have_attribute(:display_pre_tax_total).with_value(order.display_pre_tax_total.to_s)
51
55
  expect(json_response['data']).to have_relationships(:user, :line_items, :variants, :billing_address, :shipping_address, :payments, :shipments, :promotions)
52
56
  end
53
57
  end
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.1.10
4
+ version: 4.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-23 00:00:00.000000000 Z
11
+ date: 2020-10-14 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.1.10
33
+ version: 4.1.11
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.1.10
40
+ version: 4.1.11
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rabl
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -306,10 +306,10 @@ licenses:
306
306
  - BSD-3-Clause
307
307
  metadata:
308
308
  bug_tracker_uri: https://github.com/spree/spree/issues
309
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.1.10
309
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.1.11
310
310
  documentation_uri: https://guides.spreecommerce.org/
311
- source_code_uri: https://github.com/spree/spree/tree/v4.1.10
312
- post_install_message:
311
+ source_code_uri: https://github.com/spree/spree/tree/v4.1.11
312
+ post_install_message:
313
313
  rdoc_options: []
314
314
  require_paths:
315
315
  - lib
@@ -325,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
325
  version: '0'
326
326
  requirements: []
327
327
  rubygems_version: 3.1.2
328
- signing_key:
328
+ signing_key:
329
329
  specification_version: 4
330
330
  summary: Spree's API
331
331
  test_files: []