solidus_api 2.10.0.beta1 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_api might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a9540c2c04dd060a437f426c70d637fd6bc681a625f66ab535f6f6940299071
4
- data.tar.gz: 3ae3c6861ffb7a0d95bb3ebe3f3e01c7cfee7efe2b1b10b7ddb1bff09387230d
3
+ metadata.gz: 52356cf1d1f31ef45efb1c26bcb53d2a16242caa83a4d2cd470306091cbc7cc2
4
+ data.tar.gz: de67c0bae8ab9426ab9e85c3f5b76bf88a762afd04517ec7130cbcdb3690247e
5
5
  SHA512:
6
- metadata.gz: f08e8ffc5e36133c43d57082f717817b78c462cafbd2ba87019835d156d92df88c7c875b6739808744d9c0dca86939f38ac7792802ecf72e53831271d7d8830d
7
- data.tar.gz: d74356f3fd6de4f1d540ed6232e0bc91f9b1ec5999ed278e4f107357ca26411d4a0bfdca28b5585d856205fe96db1ce631b73f5bc46e2747f537bf596363e2ce
6
+ metadata.gz: a10fbcebaa7d767adc2a3339d7d8d125fad76d19706da8bd523582a61c96e3391cc7cc9408f42e63f66552ce1a51c6604d76dd5d4679994faf37dca4fd3c3af6
7
+ data.tar.gz: 3a36ab01bbbecdbfb8a43329fcacea21fa6eb11b4dbdecb18af92f70d001f6ea6ba8ca5b67fb29987f6bfd66dd2c0997c0c5e72a44bd3a090c8d5c13effc0c6a
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # solidus\_api
1
+ # solidus_api
2
2
 
3
- API contains the controllers and rabl views implementing the REST API of Solidus.
3
+ API contains the controllers and Jbuilder views implementing the REST API of
4
+ Solidus.
4
5
 
5
6
  ## Testing
6
7
 
@@ -12,14 +13,32 @@ bundle exec rspec
12
13
 
13
14
  ## Documentation
14
15
 
15
- The API documentation is in the [openapi](https://github.com/solidusio/solidus/tree/master/api/openapi)
16
- directory. It follows the OpenAPI specification and it is hosted on
17
- [Stoplight](https://solidus.docs.stoplight.io/).
16
+ The API documentation is in the [openapi][docs-dir] directory. It follows the
17
+ OpenAPI specification and it is hosted on [Stoplight Docs][live-docs].
18
18
 
19
- If you want to contribute, you can use [Stoplight Studio](https://stoplight.io/p/studio),
20
- an OpenAPI editor, to edit the files visually, and copy-paste the
21
- resulting code into the `openapi` directory.
19
+ If you want to contribute, you can use [Stoplight Studio][studio]. Simply
20
+ follow these steps:
22
21
 
23
- CircleCI automatically syncs our Git repo with Stoplight when a PR is
24
- merged, and automatically publishes a new version on Stoplight when
25
- a new Solidus version is released.
22
+ 1. Create a new Stoplight Studio project
23
+ 2. Copy-paste the content of `openapi/api.oas2.yml` into your project
24
+ 3. Edit the endpoints and models as needed
25
+ 4. Copy-paste the result back into `openapi/api.oas2.yml`
26
+ 5. Open a PR!
27
+
28
+ **Note: Only use embedded models in Stoplight Studio, as Stoplight Docs is
29
+ not compatible with externally-defined models!**
30
+
31
+ CircleCI automatically syncs our Git repo with Stoplight Docs when a PR is
32
+ merged, and automatically publishes a new version on Docs when a new Solidus
33
+ version is released.
34
+
35
+ ## Related projects
36
+
37
+ - [solidus-sdk](https://gitlab.com/deseretbook/packages/solidus-sdk): created
38
+ by Joel Saupe at [Deseret Book](https://deseretbook.com/), this is a JS SDK
39
+ that allows you to use the Solidus API. It even supports plug-ins, so you can
40
+ easily extend it with the endpoints provided by your Solidus extensions!
41
+
42
+ [docs-dir]: https://github.com/solidusio/solidus/tree/master/api/openapi
43
+ [live-docs]: https://solidus.docs.stoplight.io
44
+ [studio]: https://stoplight.io/p/studio
@@ -49,9 +49,9 @@ module Spree
49
49
  def authenticate_user
50
50
  unless @current_api_user
51
51
  if requires_authentication? && api_key.blank? && order_token.blank?
52
- render "spree/api/errors/must_specify_api_key", status: 401
52
+ render "spree/api/errors/must_specify_api_key", status: :unauthorized
53
53
  elsif order_token.blank? && (requires_authentication? || api_key.present?)
54
- render "spree/api/errors/invalid_api_key", status: 401
54
+ render "spree/api/errors/invalid_api_key", status: :unauthorized
55
55
  end
56
56
  end
57
57
  end
@@ -65,7 +65,7 @@ module Spree
65
65
  end
66
66
 
67
67
  def unauthorized
68
- render "spree/api/errors/unauthorized", status: 401
68
+ render "spree/api/errors/unauthorized", status: :unauthorized
69
69
  end
70
70
 
71
71
  def gateway_error(exception)
@@ -78,7 +78,7 @@ module Spree
78
78
  exception: exception.message,
79
79
  error: exception.message,
80
80
  missing_param: exception.param
81
- }, status: 422
81
+ }, status: :unprocessable_entity
82
82
  end
83
83
 
84
84
  def requires_authentication?
@@ -86,7 +86,7 @@ module Spree
86
86
  end
87
87
 
88
88
  def not_found
89
- render "spree/api/errors/not_found", status: 404
89
+ render "spree/api/errors/not_found", status: :not_found
90
90
  end
91
91
 
92
92
  def current_ability
@@ -96,7 +96,7 @@ module Spree
96
96
  def invalid_resource!(resource)
97
97
  Rails.logger.error "invalid_resouce_errors=#{resource.errors.full_messages}"
98
98
  @resource = resource
99
- render "spree/api/errors/invalid_resource", status: 422
99
+ render "spree/api/errors/invalid_resource", status: :unprocessable_entity
100
100
  end
101
101
 
102
102
  def api_key
@@ -112,7 +112,7 @@ module Spree
112
112
 
113
113
  def spree_token
114
114
  token = request.headers["X-Spree-Token"]
115
- return unless token.present?
115
+ return if token.blank?
116
116
 
117
117
  Spree::Deprecation.warn(
118
118
  'The custom X-Spree-Token request header is deprecated and will be removed in the next release.' \
@@ -164,8 +164,8 @@ module Spree
164
164
 
165
165
  def lock_order
166
166
  OrderMutex.with_lock!(@order) { yield }
167
- rescue Spree::OrderMutex::LockFailed => e
168
- render plain: e.message, status: 409
167
+ rescue Spree::OrderMutex::LockFailed => error
168
+ render plain: error.message, status: :conflict
169
169
  end
170
170
 
171
171
  def insufficient_stock_error(exception)
@@ -175,7 +175,7 @@ module Spree
175
175
  errors: [I18n.t(:quantity_is_not_available, scope: "spree.api.order")],
176
176
  type: 'insufficient_stock'
177
177
  },
178
- status: 422
178
+ status: :unprocessable_entity
179
179
  )
180
180
  end
181
181
 
@@ -23,8 +23,8 @@ module Spree
23
23
  authorize! :update, @order, order_token
24
24
  @order.next!
25
25
  respond_with(@order, default_template: 'spree/api/orders/show', status: 200)
26
- rescue StateMachines::InvalidTransition => e
27
- logger.error("invalid_transition #{e.event} from #{e.from} for #{e.object.class.name}. Error: #{e.inspect}")
26
+ rescue StateMachines::InvalidTransition => error
27
+ logger.error("invalid_transition #{error.event} from #{error.from} for #{error.object.class.name}. Error: #{error.inspect}")
28
28
  respond_with(@order, default_template: 'spree/api/orders/could_not_transition', status: 422)
29
29
  end
30
30
 
@@ -42,8 +42,8 @@ module Spree
42
42
  @order.complete!
43
43
  respond_with(@order, default_template: 'spree/api/orders/show', status: 200)
44
44
  end
45
- rescue StateMachines::InvalidTransition => e
46
- logger.error("invalid_transition #{e.event} from #{e.from} for #{e.object.class.name}. Error: #{e.inspect}")
45
+ rescue StateMachines::InvalidTransition => error
46
+ logger.error("invalid_transition #{error.event} from #{error.from} for #{error.object.class.name}. Error: #{error.inspect}")
47
47
  respond_with(@order, default_template: 'spree/api/orders/could_not_transition', status: 422)
48
48
  end
49
49
 
@@ -55,10 +55,9 @@ module Spree
55
55
  def index
56
56
  authorize! :index, Order
57
57
  orders_includes = [
58
- :user,
59
- :payments,
60
- :adjustments,
61
- :line_items
58
+ { user: :store_credits },
59
+ :line_items,
60
+ :valid_store_credit_payments
62
61
  ]
63
62
  @orders = paginate(
64
63
  Spree::Order
@@ -168,7 +167,13 @@ module Spree
168
167
  end
169
168
 
170
169
  def find_order(_lock = false)
171
- @order = Spree::Order.find_by!(number: params[:id])
170
+ @order = Spree::Order.
171
+ includes(line_items: [:adjustments, { variant: :images }],
172
+ payments: :payment_method,
173
+ shipments: {
174
+ shipping_rates: { shipping_method: :zones, taxes: :tax_rate }
175
+ }).
176
+ find_by!(number: params[:id])
172
177
  end
173
178
 
174
179
  def order_id
@@ -58,7 +58,9 @@ module Spree
58
58
  end
59
59
 
60
60
  def taxonomy
61
- @taxonomy ||= Spree::Taxonomy.accessible_by(current_ability, :read).find(params[:id])
61
+ @taxonomy ||= Spree::Taxonomy.accessible_by(current_ability, :read).
62
+ includes(root: :children).
63
+ find(params[:id])
62
64
  end
63
65
 
64
66
  def taxonomy_params
@@ -40,7 +40,7 @@ module Spree
40
40
 
41
41
  def required_fields_for(model)
42
42
  required_fields = model._validators.select do |_field, validations|
43
- validations.any? { |v| v.is_a?(ActiveModel::Validations::PresenceValidator) }
43
+ validations.any? { |validation| validation.is_a?(ActiveModel::Validations::PresenceValidator) }
44
44
  end.map(&:first) # get fields that are invalid
45
45
  # Permalinks presence is validated, but are really automatically generated
46
46
  # Therefore we shouldn't tell API clients that they MUST send one through
@@ -2,6 +2,6 @@
2
2
 
3
3
  json.(image, *image_attributes)
4
4
  json.(image, :viewable_type, :viewable_id)
5
- Spree::Image.attachment_definitions[:attachment][:styles].each do |k, _v|
6
- json.set! "#{k}_url", image.attachment.url(k)
5
+ Spree::Image.attachment_definitions[:attachment][:styles].each do |key, _value|
6
+ json.set! "#{key}_url", image.attachment.url(key)
7
7
  end
@@ -3,7 +3,7 @@
3
3
  json.cache! [I18n.locale, order] do
4
4
  json.(order, *order_attributes)
5
5
  json.display_item_total(order.display_item_total.to_s)
6
- json.total_quantity(order.line_items.sum(:quantity))
6
+ json.total_quantity(order.line_items.to_a.sum(&:quantity))
7
7
  json.display_total(order.display_total.to_s)
8
8
  json.display_ship_total(order.display_ship_total)
9
9
  json.display_tax_total(order.display_tax_total)
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'responders'
4
- require 'spree/api/responders/rabl_template'
4
+ require 'spree/api/responders/jbuilder_template'
5
5
 
6
6
  module Spree
7
7
  module Api
8
8
  module Responders
9
9
  class AppResponder < ActionController::Responder
10
- include RablTemplate
10
+ include JbuilderTemplate
11
11
  end
12
12
  end
13
13
  end
@@ -3,7 +3,7 @@
3
3
  module Spree
4
4
  module Api
5
5
  module Responders
6
- module RablTemplate
6
+ module JbuilderTemplate
7
7
  def to_format
8
8
  if template
9
9
  render template, status: options[:status] || 200
@@ -16,6 +16,8 @@ module Spree
16
16
  options[:default_template]
17
17
  end
18
18
  end
19
+
20
+ RablTemplate = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('RablTemplate', 'JbuilderTemplate')
19
21
  end
20
22
  end
21
23
  end
@@ -50,7 +50,7 @@ paths:
50
50
  '422':
51
51
  $ref: '#/responses/unprocessable-entity'
52
52
  summary: Create product
53
- description: Creaets a product.
53
+ description: Creates a product.
54
54
  operationId: create-product
55
55
  tags:
56
56
  - Products
@@ -4353,12 +4353,7 @@ paths:
4353
4353
  - in: body
4354
4354
  name: body
4355
4355
  schema:
4356
- allOf:
4357
- - $ref: '#/definitions/line-item-input'
4358
- - type: object
4359
- properties:
4360
- variant_id:
4361
- type: integer
4356
+ $ref: '#/definitions/line-item-input'
4362
4357
  security:
4363
4358
  - api-key: []
4364
4359
  - order-token: []
@@ -4420,12 +4415,7 @@ paths:
4420
4415
  - in: body
4421
4416
  name: body
4422
4417
  schema:
4423
- allOf:
4424
- - type: object
4425
- properties:
4426
- variant_id:
4427
- type: integer
4428
- - $ref: '#/definitions/line-item-input'
4418
+ $ref: '#/definitions/line-item-input'
4429
4419
  security:
4430
4420
  - api-key: []
4431
4421
  - order-token: []
@@ -5638,8 +5628,16 @@ definitions:
5638
5628
  properties:
5639
5629
  quantity:
5640
5630
  type: integer
5631
+ description: 'Passing `0`, the line item will be removed.'
5641
5632
  options:
5642
5633
  type: object
5634
+ 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.'
5635
+ id:
5636
+ type: integer
5637
+ description: Required for existing line items only.
5638
+ variant_id:
5639
+ type: integer
5640
+ description: Required for new line items only.
5643
5641
  option-type-input:
5644
5642
  type: object
5645
5643
  title: Option type input
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
  gem.version = Spree.solidus_version
20
20
 
21
- gem.required_ruby_version = '>= 2.2.2'
21
+ gem.required_ruby_version = '>= 2.4.0'
22
22
  gem.required_rubygems_version = '>= 1.8.23'
23
23
 
24
24
  gem.add_dependency 'jbuilder', '~> 2.8'
@@ -25,10 +25,10 @@ module Spree
25
25
  end
26
26
 
27
27
  with_model 'Widget', scope: :all do
28
- table do |t|
29
- t.string :name
30
- t.integer :position
31
- t.timestamps null: false
28
+ table do |widget|
29
+ widget.string :name
30
+ widget.integer :position
31
+ widget.timestamps null: false
32
32
  end
33
33
 
34
34
  model do
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ describe "Spree Api Responders" do
6
+ it "RablTemplate is deprecated Use JbuilderTemplate" do
7
+ warning_message = /DEPRECATION WARNING: RablTemplate is deprecated! Use JbuilderTemplate instead/
8
+ expect{ Spree::Api::Responders::RablTemplate.methods }.to output(warning_message).to_stderr
9
+ end
10
+ end
@@ -80,7 +80,7 @@ module Spree
80
80
  user_address = UserAddress.last
81
81
 
82
82
  expect(response.status).to eq(200)
83
- update_target_ids = JSON.parse(response.body).select { |a| a['update_target'] }.map { |a| a['id'] }
83
+ update_target_ids = JSON.parse(response.body).select { |target| target['update_target'] }.map { |location| location['id'] }
84
84
  expect(update_target_ids).to eq([user_address.address_id])
85
85
  end
86
86
  end
@@ -97,7 +97,7 @@ module Spree
97
97
  }.to_not change { UserAddress.count }
98
98
 
99
99
  expect(response.status).to eq(200)
100
- update_target_ids = JSON.parse(response.body).select { |a| a['update_target'] }.map { |a| a['id'] }
100
+ update_target_ids = JSON.parse(response.body).select { |target| target['update_target'] }.map { |location| location['id'] }
101
101
  expect(update_target_ids).to eq([address.id])
102
102
  end
103
103
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe "Rabl Cache", type: :request, caching: true do
5
+ describe "Jbuilder Cache", type: :request, caching: true do
6
6
  let!(:user) { create(:admin_user) }
7
7
 
8
8
  before do
@@ -11,7 +11,7 @@ describe "Rabl Cache", type: :request, caching: true do
11
11
  expect(Spree::Product.count).to eq(1)
12
12
  end
13
13
 
14
- it "doesn't create a cache key collision for models with different rabl templates" do
14
+ it "doesn't create a cache key collision for models with different jbuilder templates" do
15
15
  get "/api/variants", params: { token: user.spree_api_key }
16
16
  expect(response.status).to eq(200)
17
17
 
@@ -132,9 +132,9 @@ module Spree
132
132
  put spree.api_checkout_path(order.to_param), params: { order_token: order.guest_token, order: { shipments_attributes: { "0" => { selected_shipping_rate_id: shipping_rate.id, id: shipment.id } } } }
133
133
  expect(response.status).to eq(200)
134
134
  # Find the correct shipment...
135
- json_shipment = json_response['shipments'].detect { |s| s["id"] == shipment.id }
135
+ json_shipment = json_response['shipments'].detect { |value| value["id"] == shipment.id }
136
136
  # Find the correct shipping rate for that shipment...
137
- json_shipping_rate = json_shipment['shipping_rates'].detect { |sr| sr["id"] == shipping_rate.id }
137
+ json_shipping_rate = json_shipment['shipping_rates'].detect { |value| value["id"] == shipping_rate.id }
138
138
  # ... And finally ensure that it's selected
139
139
  expect(json_shipping_rate['selected']).to be true
140
140
  # Order should automatically transfer to payment because all criteria are met
@@ -34,9 +34,9 @@ module Spree
34
34
  end
35
35
 
36
36
  it "can retrieve a list of specific option types" do
37
- option_type_1 = create(:option_type)
37
+ option_type_one = create(:option_type)
38
38
  create(:option_type)
39
- get spree.api_option_types_path, params: { ids: "#{option_type.id},#{option_type_1.id}" }
39
+ get spree.api_option_types_path, params: { ids: "#{option_type.id},#{option_type_one.id}" }
40
40
  expect(json_response.count).to eq(2)
41
41
 
42
42
  check_option_values(json_response.first["option_values"])
@@ -48,9 +48,9 @@ module Spree
48
48
  end
49
49
 
50
50
  it "can retrieve a list of option types" do
51
- option_value_1 = create(:option_value, option_type: option_type)
51
+ option_value_one = create(:option_value, option_type: option_type)
52
52
  create(:option_value, option_type: option_type)
53
- get spree.api_option_values_path, params: { ids: [option_value.id, option_value_1.id] }
53
+ get spree.api_option_values_path, params: { ids: [option_value.id, option_value_one.id] }
54
54
  expect(json_response.count).to eq(2)
55
55
  end
56
56
 
@@ -246,12 +246,12 @@ module Spree
246
246
  it "returns orders in reverse chronological order by completed_at" do
247
247
  order.update_columns completed_at: Time.current, created_at: 3.days.ago
248
248
 
249
- order2 = Order.create user: order.user, completed_at: Time.current - 1.day, created_at: 2.day.ago, store: store
250
- expect(order2.created_at).to be > order.created_at
251
- order3 = Order.create user: order.user, completed_at: nil, created_at: 1.day.ago, store: store
252
- expect(order3.created_at).to be > order2.created_at
253
- order4 = Order.create user: order.user, completed_at: nil, created_at: 0.days.ago, store: store
254
- expect(order4.created_at).to be > order3.created_at
249
+ order_two = Order.create user: order.user, completed_at: Time.current - 1.day, created_at: 2.days.ago, store: store
250
+ expect(order_two.created_at).to be > order.created_at
251
+ order_three = Order.create user: order.user, completed_at: nil, created_at: 1.day.ago, store: store
252
+ expect(order_three.created_at).to be > order_two.created_at
253
+ order_four = Order.create user: order.user, completed_at: nil, created_at: 0.days.ago, store: store
254
+ expect(order_four.created_at).to be > order_three.created_at
255
255
 
256
256
  get spree.api_my_orders_path, headers: { 'SERVER_NAME' => store.url }
257
257
  expect(response.status).to eq(200)
@@ -259,8 +259,8 @@ module Spree
259
259
  orders = json_response["orders"]
260
260
  expect(orders.length).to eq(4)
261
261
  expect(orders[0]["number"]).to eq(order.number)
262
- expect(orders[1]["number"]).to eq(order2.number)
263
- expect([orders[2]["number"], orders[3]["number"]]).to match_array([order3.number, order4.number])
262
+ expect(orders[1]["number"]).to eq(order_two.number)
263
+ expect([orders[2]["number"], orders[3]["number"]]).to match_array([order_three.number, order_four.number])
264
264
  end
265
265
  end
266
266
 
@@ -502,18 +502,18 @@ module Spree
502
502
  end
503
503
 
504
504
  it "adds an extra line item" do
505
- variant2 = create(:variant)
505
+ variant_two = create(:variant)
506
506
  put spree.api_order_path(order), params: { order: {
507
507
  line_items: {
508
508
  "0" => { id: line_item.id, quantity: 10 },
509
- "1" => { variant_id: variant2.id, quantity: 1 }
509
+ "1" => { variant_id: variant_two.id, quantity: 1 }
510
510
  }
511
511
  } }
512
512
 
513
513
  expect(response.status).to eq(200)
514
514
  expect(json_response['line_items'].count).to eq(2)
515
515
  expect(json_response['line_items'][0]['quantity']).to eq(10)
516
- expect(json_response['line_items'][1]['variant_id']).to eq(variant2.id)
516
+ expect(json_response['line_items'][1]['variant_id']).to eq(variant_two.id)
517
517
  expect(json_response['line_items'][1]['quantity']).to eq(1)
518
518
  end
519
519
 
@@ -727,7 +727,7 @@ module Spree
727
727
 
728
728
  orders = json_response[:orders]
729
729
  expect(orders.count).to be >= 3
730
- expect(orders.map { |o| o[:id] }).to match_array Order.pluck(:id)
730
+ expect(orders.map { |order| order[:id] }).to match_array Order.pluck(:id)
731
731
  end
732
732
 
733
733
  after { ActionController::Base.perform_caching = false }
@@ -17,8 +17,8 @@ module Spree
17
17
  shipping_category_id: create(:shipping_category).id }
18
18
  end
19
19
  let(:attributes_for_variant) do
20
- h = attributes_for(:variant).except(:option_values, :product)
21
- h.merge({
20
+ attributes = attributes_for(:variant).except(:option_values, :product)
21
+ attributes.merge({
22
22
  options: [
23
23
  { name: "size", value: "small" },
24
24
  { name: "color", value: "black" }
@@ -40,7 +40,7 @@ module Spree
40
40
 
41
41
  it "returns unique products" do
42
42
  get spree.api_products_path
43
- product_ids = json_response["products"].map { |p| p["id"] }
43
+ product_ids = json_response["products"].map { |product| product["id"] }
44
44
  expect(product_ids.uniq.count).to eq(product_ids.count)
45
45
  end
46
46
 
@@ -361,8 +361,8 @@ module Spree
361
361
  expect(response.status).to eq 200
362
362
  expect(json_response['variants'].count).to eq(2) # 2 variants
363
363
 
364
- variants = json_response['variants'].reject { |v| v['is_master'] }
365
- size_option_value = variants.last['option_values'].detect{ |x| x['option_type_name'] == 'size' }
364
+ variants = json_response['variants'].reject { |variant| variant['is_master'] }
365
+ size_option_value = variants.last['option_values'].detect{ |value| value['option_type_name'] == 'size' }
366
366
  expect(size_option_value['name']).to eq('small')
367
367
 
368
368
  expect(json_response['option_types'].count).to eq(2) # size, color
@@ -385,7 +385,7 @@ module Spree
385
385
  } }
386
386
 
387
387
  expect(json_response['variants'].count).to eq(1)
388
- variants = json_response['variants'].reject { |v| v['is_master'] }
388
+ variants = json_response['variants'].reject { |variant| variant['is_master'] }
389
389
  expect(variants.last['option_values'][0]['name']).to eq('large')
390
390
  expect(variants.last['sku']).to eq('456')
391
391
  expect(variants.count).to eq(1)
@@ -93,9 +93,9 @@ module Spree
93
93
  it 'returns only requested ids' do
94
94
  # We need a completly new branch to avoid having parent that can be preloaded from the rails ancestors
95
95
  python = create(:taxon, name: "Python", parent: taxonomy.root, taxonomy: taxonomy)
96
- python_3 = create(:taxon, name: "3.0", parent: python, taxonomy: taxonomy)
96
+ python_three = create(:taxon, name: "3.0", parent: python, taxonomy: taxonomy)
97
97
 
98
- get spree.api_taxons_path, params: { ids: [rails_v3_2_2.id, python_3.id] }
98
+ get spree.api_taxons_path, params: { ids: [rails_v3_2_2.id, python_three.id] }
99
99
 
100
100
  expect(json_response['taxons'].size).to eq 2
101
101
  end
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.10.0.beta1
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-19 00:00:00.000000000 Z
11
+ date: 2020-01-15 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.10.0.beta1
61
+ version: 2.10.0
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.10.0.beta1
68
+ version: 2.10.0
69
69
  description: REST API for the Solidus e-commerce framework.
70
70
  email: contact@solidus.io
71
71
  executables: []
@@ -232,7 +232,7 @@ files:
232
232
  - lib/spree/api/config.rb
233
233
  - lib/spree/api/engine.rb
234
234
  - lib/spree/api/responders.rb
235
- - lib/spree/api/responders/rabl_template.rb
235
+ - lib/spree/api/responders/jbuilder_template.rb
236
236
  - lib/spree/api/testing_support/caching.rb
237
237
  - lib/spree/api/testing_support/helpers.rb
238
238
  - lib/spree/api/testing_support/setup.rb
@@ -253,9 +253,10 @@ files:
253
253
  - spec/controllers/spree/api/resource_controller_spec.rb
254
254
  - spec/features/checkout_spec.rb
255
255
  - spec/fixtures/thinking-cat.jpg
256
+ - spec/lib/spree_api_responders_spec.rb
256
257
  - spec/models/spree/legacy_user_spec.rb
257
258
  - spec/requests/api/address_books_spec.rb
258
- - spec/requests/rabl_cache_spec.rb
259
+ - spec/requests/jbuilder_cache_spec.rb
259
260
  - spec/requests/ransackable_attributes_spec.rb
260
261
  - spec/requests/spree/api/addresses_controller_spec.rb
261
262
  - spec/requests/spree/api/checkouts_controller_spec.rb
@@ -312,14 +313,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
312
313
  requirements:
313
314
  - - ">="
314
315
  - !ruby/object:Gem::Version
315
- version: 2.2.2
316
+ version: 2.4.0
316
317
  required_rubygems_version: !ruby/object:Gem::Requirement
317
318
  requirements:
318
319
  - - ">="
319
320
  - !ruby/object:Gem::Version
320
321
  version: 1.8.23
321
322
  requirements: []
322
- rubygems_version: 3.0.6
323
+ rubygems_version: 3.0.3
323
324
  signing_key:
324
325
  specification_version: 4
325
326
  summary: REST API for the Solidus e-commerce framework.
@@ -328,9 +329,10 @@ test_files:
328
329
  - spec/controllers/spree/api/resource_controller_spec.rb
329
330
  - spec/features/checkout_spec.rb
330
331
  - spec/fixtures/thinking-cat.jpg
332
+ - spec/lib/spree_api_responders_spec.rb
331
333
  - spec/models/spree/legacy_user_spec.rb
332
334
  - spec/requests/api/address_books_spec.rb
333
- - spec/requests/rabl_cache_spec.rb
335
+ - spec/requests/jbuilder_cache_spec.rb
334
336
  - spec/requests/ransackable_attributes_spec.rb
335
337
  - spec/requests/spree/api/addresses_controller_spec.rb
336
338
  - spec/requests/spree/api/checkouts_controller_spec.rb