spree_api 4.1.10 → 4.2.0.rc2

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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb +4 -0
  3. data/app/controllers/spree/api/base_controller.rb +1 -3
  4. data/app/controllers/spree/api/errors_controller.rb +1 -1
  5. data/app/controllers/spree/api/v1/taxons_controller.rb +6 -1
  6. data/app/controllers/spree/api/v1/users_controller.rb +35 -9
  7. data/app/controllers/spree/api/v2/base_controller.rb +6 -1
  8. data/app/controllers/spree/api/v2/storefront/account/orders_controller.rb +2 -2
  9. data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +1 -2
  10. data/app/controllers/spree/api/v2/storefront/order_status_controller.rb +1 -1
  11. data/app/controllers/spree/api/v2/storefront/taxons_controller.rb +1 -1
  12. data/app/helpers/spree/api/api_helpers.rb +4 -3
  13. data/app/models/spree/api_dependencies.rb +2 -1
  14. data/app/serializers/spree/v2/storefront/address_serializer.rb +1 -1
  15. data/app/serializers/spree/v2/storefront/cart_serializer.rb +2 -1
  16. data/app/serializers/spree/v2/storefront/line_item_serializer.rb +2 -1
  17. data/app/serializers/spree/v2/storefront/product_serializer.rb +2 -2
  18. data/app/serializers/spree/v2/storefront/shipment_serializer.rb +1 -1
  19. data/app/serializers/spree/v2/storefront/store_serializer.rb +2 -0
  20. data/app/serializers/spree/v2/storefront/variant_serializer.rb +2 -2
  21. data/app/views/spree/api/v1/products/show.rabl +4 -0
  22. data/docs/v2/storefront/index.yaml +198 -12
  23. data/lib/spree/api/controller_setup.rb +0 -1
  24. data/lib/spree/api/testing_support/v2/base.rb +1 -1
  25. data/lib/spree/api/testing_support/v2/current_order.rb +4 -0
  26. data/spree_api.gemspec +1 -1
  27. metadata +12 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '081a59e1e4a0962307541447f46aee0b5aa37996d93063bb9f1a8a48fa7284f4'
4
- data.tar.gz: ce108948d989bd3b6e77811c5ee644459be649923d018ab2b909d7982f90207b
3
+ metadata.gz: 870bda309064df374e65aee63ddd2d7abb72004dbb6d218f0b1b77b7f5b0219f
4
+ data.tar.gz: e8fd20974f60d065473f2fb1303dd86221de56173f6a1e957c7efc8d5dba2aed
5
5
  SHA512:
6
- metadata.gz: f4d6373fde6c57a192903b224a292ed9cffaad0b19e8ddc0c99bff2f74f6dc7409f053bd2c2c4506f71c56af214b6e7cc98b9c9d75e0e7663af69782f60fa2b2
7
- data.tar.gz: 7d9fc0748f73eeba62edb386e55ea4615a13b3add5014cc0131451f6977942087ef8ca0b7a3935dd6412233e1296cc81575f4291d90be24efbaf83c58c55dc5d
6
+ metadata.gz: 37e0a2ef4037067d2ffd5391d70b7c9fd6953d0529721e83ba7935755b1bca9515bc047e16525cae1df3d68e0815082f21e3e5579521f80259c717abe06d0b76
7
+ data.tar.gz: 87d24be4132f732043258a35db7b5398f3a63fe99908141e6bbba92786e5897a2c9c9ddf0c3ed5efa9b3da6b65a73f2ac5e4a895fc4bb69038ab5e597ece2932
@@ -34,6 +34,10 @@ module Spree
34
34
  )
35
35
  end
36
36
 
37
+ def supported_currencies
38
+ current_store.supported_currencies_list
39
+ end
40
+
37
41
  def serialize_order(order)
38
42
  resource_serializer.new(order.reload, include: resource_includes, fields: sparse_fields).serializable_hash
39
43
  end
@@ -2,9 +2,7 @@ require_dependency 'spree/api/controller_setup'
2
2
 
3
3
  module Spree
4
4
  module Api
5
- class BaseController < ActionController::Base
6
- protect_from_forgery unless: -> { request.format.json? || request.format.xml? }
7
-
5
+ class BaseController < ActionController::API
8
6
  include Spree::Api::ControllerSetup
9
7
  include Spree::Core::ControllerHelpers::Store
10
8
  include Spree::Core::ControllerHelpers::StrongParameters
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  module Api
3
- class ErrorsController < ActionController::Base
3
+ class ErrorsController < ActionController::API
4
4
  def render_404
5
5
  render 'spree/api/errors/not_found', status: 404
6
6
  end
@@ -74,7 +74,12 @@ module Spree
74
74
 
75
75
  def taxonomy
76
76
  if params[:taxonomy_id].present?
77
- @taxonomy ||= Spree::Taxonomy.accessible_by(current_ability, :show).find(params[:taxonomy_id])
77
+ @taxonomy ||=
78
+ if defined?(SpreeGlobalize)
79
+ Spree::Taxonomy.includes(:translations, taxons: [:translations]).accessible_by(current_ability, :show).find(params[:taxonomy_id])
80
+ else
81
+ Spree::Taxonomy.accessible_by(current_ability, :show).find(params[:taxonomy_id])
82
+ end
78
83
  end
79
84
  end
80
85
 
@@ -5,22 +5,48 @@ module Spree
5
5
  rescue_from Spree::Core::DestroyWithOrdersError, with: :error_during_processing
6
6
 
7
7
  def index
8
- @users = Spree.user_class.accessible_by(current_ability, :show)
8
+ users
9
9
 
10
10
  if params[:ids]
11
- @users = @users.where(id: params[:ids])
12
- elsif params[:q]
13
- users_with_ship_address = @users.with_address(params[:q][:ship_address_firstname_start])
14
- users_with_bill_address = @users.with_address(params[:q][:ship_address_firstname_start], :bill_address)
15
-
16
- users_with_addresses_ids = (users_with_ship_address.ids + users_with_bill_address.ids).compact.uniq
17
- @users = @users.with_email_or_addresses_ids(params[:q][:email_start], users_with_addresses_ids)
11
+ load_users_by_ids
12
+ elsif params.dig(:q, :ship_address_firstname_start)
13
+ load_users_by_address
14
+ elsif params.dig(:q, :email_start)
15
+ load_users_by_email
18
16
  end
19
17
 
18
+ prepare_index_response
19
+ respond_with(@users)
20
+ end
21
+
22
+ def users
23
+ @users ||= Spree.user_class.accessible_by(current_ability, :show)
24
+ end
25
+
26
+ def load_users_by_ids
27
+ @users = @users.where(id: params[:ids])
28
+ end
29
+
30
+ def load_users_by_address
31
+ address_params = params[:q][:ship_address_firstname_start] ||
32
+ params[:q][:ship_address_lastname_start] ||
33
+ params[:q][:bill_address_firstname_start] ||
34
+ params[:q][:bill_address_lastname_start]
35
+ @users = @users.with_email_or_address(params[:q][:email_start], address_params)
36
+ end
37
+
38
+ def load_users_by_email
39
+ @users = @users.with_email(params[:q][:email_start])
40
+ end
41
+
42
+ def paginate_users
20
43
  @users = @users.page(params[:page]).per(params[:per_page])
44
+ end
45
+
46
+ def prepare_index_response
47
+ paginate_users
21
48
  expires_in 15.minutes, public: true
22
49
  headers['Surrogate-Control'] = "max-age=#{15.minutes}"
23
- respond_with(@users)
24
50
  end
25
51
 
26
52
  def show
@@ -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)
@@ -35,11 +35,11 @@ module Spree
35
35
  end
36
36
 
37
37
  def collection_serializer
38
- Spree::Api::Dependencies.storefront_cart_serializer.constantize
38
+ Spree::Api::Dependencies.storefront_order_serializer.constantize
39
39
  end
40
40
 
41
41
  def resource_serializer
42
- Spree::Api::Dependencies.storefront_cart_serializer.constantize
42
+ Spree::Api::Dependencies.storefront_order_serializer.constantize
43
43
  end
44
44
 
45
45
  def collection_finder
@@ -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
@@ -29,7 +29,7 @@ module Spree
29
29
  end
30
30
 
31
31
  def ensure_order_token
32
- raise ActiveRecord::RecordNotFound unless order_token
32
+ raise ActiveRecord::RecordNotFound unless order_token.present?
33
33
  end
34
34
  end
35
35
  end
@@ -51,7 +51,7 @@ module Spree
51
51
  children: node_includes,
52
52
  taxonomy: [root: node_includes],
53
53
  products: [],
54
- icon: []
54
+ icon: [attachment_attachment: :blob]
55
55
  }
56
56
  end
57
57
  end
@@ -116,7 +116,7 @@ module Spree
116
116
  @@address_attributes = [
117
117
  :id, :firstname, :lastname, :full_name, :address1, :address2, :city,
118
118
  :zipcode, :phone, :company, :alternative_phone, :country_id, :state_id,
119
- :state_name, :state_text
119
+ :label, :state_name, :state_text
120
120
  ]
121
121
 
122
122
  @@country_attributes = [:id, :iso_name, :iso, :iso3, :name, :numcode]
@@ -161,8 +161,9 @@ module Spree
161
161
 
162
162
  @@store_attributes = [
163
163
  :id, :name, :url, :meta_description, :meta_keywords, :seo_title,
164
- :mail_from_address, :default_currency, :code, :default,
165
- :facebook, :twitter, :instagram
164
+ :mail_from_address, :customer_support_email, :default_currency,
165
+ :code, :default, :facebook, :twitter, :instagram,
166
+ :supported_currencies
166
167
  ]
167
168
 
168
169
  @@tag_attributes = [:id, :name]
@@ -14,7 +14,7 @@ module Spree
14
14
  :storefront_collection_paginator, :storefront_user_serializer, :storefront_products_sorter, :storefront_products_finder,
15
15
  :storefront_product_serializer, :storefront_taxon_serializer, :storefront_taxon_finder, :storefront_find_by_variant_finder,
16
16
  :storefront_cart_update_service, :storefront_cart_estimate_shipping_rates_service, :storefront_estimated_shipment_serializer,
17
- :storefront_store_serializer, :storefront_address_serializer,
17
+ :storefront_store_serializer, :storefront_address_serializer, :storefront_order_serializer,
18
18
  :storefront_account_create_address_service, :storefront_account_update_address_service, :storefront_address_finder
19
19
  ].freeze
20
20
 
@@ -66,6 +66,7 @@ module Spree
66
66
  @storefront_product_serializer = 'Spree::V2::Storefront::ProductSerializer'
67
67
  @storefront_estimated_shipment_serializer = 'Spree::V2::Storefront::EstimatedShippingRateSerializer'
68
68
  @storefront_store_serializer = 'Spree::V2::Storefront::StoreSerializer'
69
+ @storefront_order_serializer = 'Spree::V2::Storefront::CartSerializer'
69
70
 
70
71
  # sorters
71
72
  @storefront_order_sorter = Spree::Dependencies.order_sorter
@@ -5,7 +5,7 @@ module Spree
5
5
  set_type :address
6
6
 
7
7
  attributes :firstname, :lastname, :address1, :address2, :city, :zipcode, :phone, :state_name,
8
- :company, :country_name, :country_iso3, :country_iso
8
+ :company, :country_name, :country_iso3, :country_iso, :label
9
9
 
10
10
  attribute :state_code, &:state_abbr
11
11
  attribute :state_name, &:state_name_text
@@ -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
@@ -5,8 +5,8 @@ module Spree
5
5
  set_type :product
6
6
 
7
7
  attributes :name, :description, :price, :currency, :display_price,
8
- :available_on, :slug, :meta_description, :meta_keywords,
9
- :updated_at
8
+ :compare_at_price, :display_compare_at_price, :available_on,
9
+ :slug, :meta_description, :meta_keywords, :updated_at
10
10
 
11
11
  attribute :purchasable, &:purchasable?
12
12
  attribute :in_stock, &:in_stock?
@@ -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
@@ -7,6 +7,8 @@ module Spree
7
7
  attributes :name, :url, :meta_description, :meta_keywords, :seo_title, :default_currency, :default, :supported_currencies, :facebook,
8
8
  :twitter, :instagram, :default_locale, :customer_support_email, :default_country_id, :description,
9
9
  :address, :contact_phone, :contact_email
10
+
11
+ has_one :default_country, serializer: :country, record_type: :country, id_method_name: :default_country_id
10
12
  end
11
13
  end
12
14
  end
@@ -4,8 +4,8 @@ module Spree
4
4
  class VariantSerializer < BaseSerializer
5
5
  set_type :variant
6
6
 
7
- attributes :name, :sku, :price, :currency, :display_price, :weight, :height,
8
- :width, :depth, :is_master, :options_text, :slug, :description
7
+ attributes :sku, :price, :currency, :display_price, :weight, :height,
8
+ :width, :depth, :is_master, :options_text
9
9
 
10
10
  attribute :purchasable, &:purchasable?
11
11
  attribute :in_stock, &:in_stock?
@@ -6,6 +6,10 @@ attributes *product_attributes
6
6
  node(:display_price) { |p| p.display_price.to_s }
7
7
  node(:has_variants, &:has_variants?)
8
8
  node(:taxon_ids, &:taxon_ids)
9
+ node(:display_current_currency_price) do |product|
10
+ price = product.price_in(current_currency)
11
+ Spree::Money.new(price.amount, currency: current_currency).to_s
12
+ end
9
13
 
10
14
  child master: :master do
11
15
  extends 'spree/api/v1/variants/small'
@@ -49,7 +49,167 @@ paths:
49
49
  $ref: '#/components/responses/403Forbidden'
50
50
  security:
51
51
  - bearerAuth: []
52
+ post:
53
+ description: >-
54
+ Creates a new account
52
55
 
56
+ This endpoint requires [Spree Auth Devise](https://github.com/spree/spree_auth_devise) gem installed
57
+ tags:
58
+ - Account
59
+ operationId: 'Account Creation'
60
+ requestBody:
61
+ required: true
62
+ content:
63
+ application/vnd.api+json:
64
+ schema:
65
+ type: object
66
+ properties:
67
+ user:
68
+ type: object
69
+ properties:
70
+ email:
71
+ type: string
72
+ example: 'john@snow.org'
73
+ password:
74
+ type: string
75
+ example: 'spree123'
76
+ password_confirmation:
77
+ type: string
78
+ example: 'spree123'
79
+ responses:
80
+ '200':
81
+ description: ok
82
+ content:
83
+ application/vnd.api+json:
84
+ schema:
85
+ $ref: '#/components/schemas/Account'
86
+ '422':
87
+ description: Validation errors
88
+ content:
89
+ application/vnd.api+json:
90
+ schema:
91
+ $ref: '#/components/schemas/Error'
92
+ patch:
93
+ description: >-
94
+ Updates user account
95
+
96
+ This endpoint requires [Spree Auth Devise](https://github.com/spree/spree_auth_devise) gem installed
97
+ tags:
98
+ - Account
99
+ operationId: 'Account Updates'
100
+ requestBody:
101
+ required: true
102
+ content:
103
+ application/vnd.api+json:
104
+ schema:
105
+ type: object
106
+ properties:
107
+ user:
108
+ type: object
109
+ properties:
110
+ email:
111
+ type: string
112
+ example: 'john@snow.org'
113
+ password:
114
+ type: string
115
+ example: 'spree123'
116
+ password_confirmation:
117
+ type: string
118
+ example: 'spree123'
119
+ responses:
120
+ '200':
121
+ description: ok
122
+ content:
123
+ application/vnd.api+json:
124
+ schema:
125
+ $ref: '#/components/schemas/Account'
126
+ '422':
127
+ description: Validation errors
128
+ content:
129
+ application/vnd.api+json:
130
+ schema:
131
+ $ref: '#/components/schemas/Error'
132
+ security:
133
+ - bearerAuth: []
134
+ '/account/addresses':
135
+ get:
136
+ description: >-
137
+ Returns a list of Addresses for the signed in User
138
+ tags:
139
+ - Account
140
+ operationId: 'Addresses list'
141
+ responses:
142
+ '200':
143
+ description: Listing user addresses.
144
+ content:
145
+ application/vnd.api+json:
146
+ schema:
147
+ $ref: '#/components/schemas/AddressList'
148
+ '403':
149
+ $ref: '#/components/responses/403Forbidden'
150
+ security:
151
+ - bearerAuth: []
152
+ post:
153
+ description: >-
154
+ Create a new Address for the signed in User
155
+ tags:
156
+ - Account
157
+ operationId: 'Create Address'
158
+ requestBody:
159
+ required: true
160
+ content:
161
+ application/vnd.api+json:
162
+ schema:
163
+ type: object
164
+ properties:
165
+ address:
166
+ $ref: '#/components/schemas/AddressPayload'
167
+ responses:
168
+ '200':
169
+ description: Created Address.
170
+ content:
171
+ application/vnd.api+json:
172
+ schema:
173
+ $ref: '#/components/schemas/AddressList'
174
+ '403':
175
+ $ref: '#/components/responses/403Forbidden'
176
+ security:
177
+ - bearerAuth: []
178
+ '/account/addresses/{id}':
179
+ patch:
180
+ description: >-
181
+ Update selected Address for the signed in User
182
+ tags:
183
+ - Account
184
+ operationId: 'Update Address'
185
+ parameters:
186
+ - name: id
187
+ in: path
188
+ required: true
189
+ description: Selected Address for update
190
+ schema:
191
+ type: string
192
+ example: '1'
193
+ requestBody:
194
+ required: true
195
+ content:
196
+ application/vnd.api+json:
197
+ schema:
198
+ type: object
199
+ properties:
200
+ address:
201
+ $ref: '#/components/schemas/AddressPayload'
202
+ responses:
203
+ '200':
204
+ description: Updated Address.
205
+ content:
206
+ application/vnd.api+json:
207
+ schema:
208
+ $ref: '#/components/schemas/AddressList'
209
+ '403':
210
+ $ref: '#/components/responses/403Forbidden'
211
+ security:
212
+ - bearerAuth: []
53
213
  '/account/credit_cards':
54
214
  get:
55
215
  description: >-
@@ -1299,6 +1459,18 @@ components:
1299
1459
  display_tax_total:
1300
1460
  type: string
1301
1461
  example: '$10.00'
1462
+ pre_tax_item_amount:
1463
+ type: string
1464
+ example: '17.00'
1465
+ display_pre_tax_item_amount:
1466
+ type: string
1467
+ example: '$17.00'
1468
+ pre_tax_total:
1469
+ type: string
1470
+ example: '20.00'
1471
+ display_pre_tax_total:
1472
+ type: string
1473
+ example: '$20.00'
1302
1474
  item_count:
1303
1475
  type: number
1304
1476
  example: 2
@@ -1511,6 +1683,12 @@ components:
1511
1683
  display_discounted_amount:
1512
1684
  type: string
1513
1685
  example: '$125.00'
1686
+ pre_tax_amount:
1687
+ type: string
1688
+ example: '125.0'
1689
+ display_pre_tax_amount:
1690
+ type: string
1691
+ example: '$125.00'
1514
1692
  promo_total:
1515
1693
  type: string
1516
1694
  example: '-5.0'
@@ -2011,10 +2189,6 @@ components:
2011
2189
  VariantAttributes:
2012
2190
  type: object
2013
2191
  properties:
2014
- name:
2015
- type: string
2016
- example: 'Example product'
2017
- description: 'Product name'
2018
2192
  sku:
2019
2193
  type: string
2020
2194
  example: 'SKU-1001'
@@ -2046,14 +2220,6 @@ components:
2046
2220
  options_text:
2047
2221
  type: string
2048
2222
  example: 'Size: small, Color: red'
2049
- slug:
2050
- type: string
2051
- example: 'example-product'
2052
- description: 'Product slug'
2053
- description:
2054
- type: string
2055
- example: 'Example description'
2056
- description: 'Product description'
2057
2223
  purchasable:
2058
2224
  type: boolean
2059
2225
  example: true
@@ -2226,6 +2392,11 @@ components:
2226
2392
  $ref: '#/components/schemas/ShipmentAttributes'
2227
2393
  relationships:
2228
2394
  properties:
2395
+ stock_location:
2396
+ type: object
2397
+ properties:
2398
+ data:
2399
+ $ref: '#/components/schemas/Relation'
2229
2400
  shipping_rates:
2230
2401
  properties:
2231
2402
  data:
@@ -2281,6 +2452,7 @@ components:
2281
2452
  items:
2282
2453
  oneOf:
2283
2454
  - $ref: '#/components/schemas/ShippingRate'
2455
+ - $ref: '#/components/schemas/StockLocation'
2284
2456
  EstimateShippingRatesList:
2285
2457
  required:
2286
2458
  - data
@@ -2335,6 +2507,20 @@ components:
2335
2507
  type: integer
2336
2508
  example: 1
2337
2509
  description: 'ID of a Shipping Method. You will need this for the Checkout Update action'
2510
+ StockLocation:
2511
+ properties:
2512
+ id:
2513
+ type: string
2514
+ example: '1'
2515
+ type:
2516
+ type: string
2517
+ default: 'stock_location'
2518
+ attributes:
2519
+ type: object
2520
+ properties:
2521
+ name:
2522
+ type: string
2523
+ example: 'Main Warehouse'
2338
2524
  Account:
2339
2525
  required:
2340
2526
  - data
@@ -6,7 +6,6 @@ module Spree
6
6
  def self.included(klass)
7
7
  klass.class_eval do
8
8
  include CanCan::ControllerAdditions
9
- include Spree::Core::ControllerHelpers::Auth
10
9
 
11
10
  prepend_view_path Rails.root + 'app/views'
12
11
  append_view_path File.expand_path('../../../app/views', File.dirname(__FILE__))
@@ -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
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.email = ["ryan@spreecommerce.com"]
9
9
  s.summary = %q{Spree's API}
10
10
  s.description = %q{Spree's API}
11
- s.homepage = 'http://spreecommerce.org'
11
+ s.homepage = 'https://spreecommerce.org'
12
12
  s.license = 'BSD-3-Clause'
13
13
 
14
14
  s.metadata = {
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.2.0.rc2
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-11-10 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.2.0.rc2
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.2.0.rc2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rabl
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -301,15 +301,15 @@ files:
301
301
  - script/rails
302
302
  - spec/fixtures/thinking-cat.jpg
303
303
  - spree_api.gemspec
304
- homepage: http://spreecommerce.org
304
+ homepage: https://spreecommerce.org
305
305
  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.2.0.rc2
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.2.0.rc2
312
+ post_install_message:
313
313
  rdoc_options: []
314
314
  require_paths:
315
315
  - lib
@@ -320,12 +320,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
320
320
  version: 2.5.0
321
321
  required_rubygems_version: !ruby/object:Gem::Requirement
322
322
  requirements:
323
- - - ">="
323
+ - - ">"
324
324
  - !ruby/object:Gem::Version
325
- version: '0'
325
+ version: 1.3.1
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: []