solidus_api 2.0.3 → 2.1.0.beta1
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.
Potentially problematic release.
This version of solidus_api might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/spree/api/base_controller.rb +10 -0
- data/app/controllers/spree/api/countries_controller.rb +8 -3
- data/app/controllers/spree/api/credit_cards_controller.rb +3 -1
- data/app/controllers/spree/api/orders_controller.rb +5 -14
- data/app/controllers/spree/api/payments_controller.rb +2 -3
- data/app/controllers/spree/api/product_properties_controller.rb +8 -3
- data/app/controllers/spree/api/products_controller.rb +1 -1
- data/app/controllers/spree/api/properties_controller.rb +1 -1
- data/app/controllers/spree/api/resource_controller.rb +1 -1
- data/app/controllers/spree/api/return_authorizations_controller.rb +9 -3
- data/app/controllers/spree/api/shipments_controller.rb +3 -1
- data/app/controllers/spree/api/states_controller.rb +1 -1
- data/app/controllers/spree/api/stock_items_controller.rb +1 -1
- data/app/controllers/spree/api/stock_locations_controller.rb +9 -1
- data/app/controllers/spree/api/stock_movements_controller.rb +1 -1
- data/app/controllers/spree/api/store_credit_events_controller.rb +3 -1
- data/app/controllers/spree/api/taxonomies_controller.rb +8 -4
- data/app/controllers/spree/api/taxons_controller.rb +17 -3
- data/app/controllers/spree/api/variants_controller.rb +3 -1
- data/app/controllers/spree/api/zones_controller.rb +8 -1
- data/app/views/spree/api/products/index.v1.rabl +1 -1
- data/app/views/spree/api/products/show.v1.rabl +26 -15
- data/solidus_api.gemspec +4 -0
- data/spec/controllers/spree/api/checkouts_controller_spec.rb +0 -13
- data/spec/controllers/spree/api/orders_controller_spec.rb +5 -52
- data/spec/controllers/spree/api/payments_controller_spec.rb +0 -11
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d202cbb2d66a818ad824e739704be52b81f63d48
|
4
|
+
data.tar.gz: da186de43c9f9021a1a35c5ad3b4addb89fbac5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea88be5b89fd4e8ab09210ad1a08c8900255492134bf6e072cef9bdb0f2e610bce615f2f622f6c22be9f43fddf3a83657575845e9afc15c576f64a6bb6ac7363
|
7
|
+
data.tar.gz: 1e7bf9f59a65a1df20263f901cafd1793f50cabd4157ef2baf51fa94d24d586abbef35b5881ad343ce87089043360df09a4b5c5e2f98bcc378d92940c0f2fb66
|
@@ -161,6 +161,16 @@ module Spree
|
|
161
161
|
status: 422
|
162
162
|
)
|
163
163
|
end
|
164
|
+
|
165
|
+
def paginate(resource)
|
166
|
+
resource.
|
167
|
+
page(params[:page]).
|
168
|
+
per(params[:per_page] || default_per_page)
|
169
|
+
end
|
170
|
+
|
171
|
+
def default_per_page
|
172
|
+
Kaminari.config.default_per_page
|
173
|
+
end
|
164
174
|
end
|
165
175
|
end
|
166
176
|
end
|
@@ -4,11 +4,16 @@ module Spree
|
|
4
4
|
skip_before_action :authenticate_user
|
5
5
|
|
6
6
|
def index
|
7
|
-
@countries = Country.
|
8
|
-
|
9
|
-
|
7
|
+
@countries = Country.
|
8
|
+
accessible_by(current_ability, :read).
|
9
|
+
ransack(params[:q]).
|
10
|
+
result.
|
11
|
+
order('name ASC')
|
12
|
+
|
10
13
|
country = Country.order("updated_at ASC").last
|
14
|
+
|
11
15
|
if stale?(country)
|
16
|
+
@countries = paginate(@countries)
|
12
17
|
respond_with(@countries)
|
13
18
|
end
|
14
19
|
end
|
@@ -9,7 +9,9 @@ module Spree
|
|
9
9
|
.credit_cards
|
10
10
|
.accessible_by(current_ability, :read)
|
11
11
|
.with_payment_profile
|
12
|
-
.ransack(params[:q]).result
|
12
|
+
.ransack(params[:q]).result
|
13
|
+
|
14
|
+
@credit_cards = paginate(@credit_cards)
|
13
15
|
respond_with(@credit_cards)
|
14
16
|
end
|
15
17
|
|
@@ -27,18 +27,8 @@ module Spree
|
|
27
27
|
|
28
28
|
def create
|
29
29
|
authorize! :create, Order
|
30
|
-
|
31
|
-
|
32
|
-
@order = Spree::Core::Importer::Order.import(determine_order_user, order_params)
|
33
|
-
respond_with(@order, default_template: :show, status: 201)
|
34
|
-
else
|
35
|
-
@order = Spree::Order.create!(user: current_api_user, store: current_store)
|
36
|
-
if OrderUpdateAttributes.new(@order, order_params).apply
|
37
|
-
respond_with(@order, default_template: :show, status: 201)
|
38
|
-
else
|
39
|
-
invalid_resource!(@order)
|
40
|
-
end
|
41
|
-
end
|
30
|
+
@order = Spree::Core::Importer::Order.import(determine_order_user, order_params)
|
31
|
+
respond_with(@order, default_template: :show, status: 201)
|
42
32
|
end
|
43
33
|
|
44
34
|
def empty
|
@@ -49,7 +39,7 @@ module Spree
|
|
49
39
|
|
50
40
|
def index
|
51
41
|
authorize! :index, Order
|
52
|
-
@orders = Order.ransack(params[:q]).result
|
42
|
+
@orders = paginate(Order.ransack(params[:q]).result)
|
53
43
|
respond_with(@orders)
|
54
44
|
end
|
55
45
|
|
@@ -82,7 +72,8 @@ module Spree
|
|
82
72
|
|
83
73
|
def mine
|
84
74
|
if current_api_user
|
85
|
-
@orders = current_api_user.orders.by_store(current_store).reverse_chronological.ransack(params[:q]).result
|
75
|
+
@orders = current_api_user.orders.by_store(current_store).reverse_chronological.ransack(params[:q]).result
|
76
|
+
@orders = paginate(@orders)
|
86
77
|
else
|
87
78
|
render "spree/api/errors/unauthorized", status: :unauthorized
|
88
79
|
end
|
@@ -6,17 +6,16 @@ module Spree
|
|
6
6
|
before_action :find_payment, only: [:update, :show, :authorize, :purchase, :capture, :void, :credit]
|
7
7
|
|
8
8
|
def index
|
9
|
-
@payments = @order.payments.ransack(params[:q]).result
|
9
|
+
@payments = paginate(@order.payments.ransack(params[:q]).result)
|
10
10
|
respond_with(@payments)
|
11
11
|
end
|
12
12
|
|
13
13
|
def new
|
14
|
-
@payment_methods = Spree::PaymentMethod.
|
14
|
+
@payment_methods = Spree::PaymentMethod.available_to_users.available_to_admin
|
15
15
|
respond_with(@payment_method)
|
16
16
|
end
|
17
17
|
|
18
18
|
def create
|
19
|
-
@order.validate_payments_attributes(payment_params)
|
20
19
|
@payment = PaymentCreate.new(@order, payment_params).build
|
21
20
|
if @payment.save
|
22
21
|
respond_with(@payment, status: 201, default_template: :show)
|
@@ -5,9 +5,14 @@ module Spree
|
|
5
5
|
before_action :product_property, only: [:show, :update, :destroy]
|
6
6
|
|
7
7
|
def index
|
8
|
-
@product_properties = @product.
|
9
|
-
|
10
|
-
|
8
|
+
@product_properties = @product.
|
9
|
+
product_properties.
|
10
|
+
accessible_by(current_ability, :read).
|
11
|
+
ransack(params[:q]).
|
12
|
+
result
|
13
|
+
|
14
|
+
@product_properties = paginate(@product_properties)
|
15
|
+
|
11
16
|
respond_with(@product_properties)
|
12
17
|
end
|
13
18
|
|
@@ -9,7 +9,7 @@ module Spree
|
|
9
9
|
@products = product_scope.ransack(params[:q]).result
|
10
10
|
end
|
11
11
|
|
12
|
-
@products = @products.distinct
|
12
|
+
@products = paginate(@products.distinct)
|
13
13
|
expires_in 15.minutes, public: true
|
14
14
|
headers['Surrogate-Control'] = "max-age=#{15.minutes}"
|
15
15
|
respond_with(@products)
|
@@ -10,7 +10,7 @@ class Spree::Api::ResourceController < Spree::Api::BaseController
|
|
10
10
|
collection_scope = collection_scope.ransack(params[:q]).result
|
11
11
|
end
|
12
12
|
|
13
|
-
@collection = collection_scope
|
13
|
+
@collection = paginate(collection_scope)
|
14
14
|
instance_variable_set("@#{controller_name}", @collection)
|
15
15
|
|
16
16
|
respond_with(@collection)
|
@@ -24,9 +24,15 @@ module Spree
|
|
24
24
|
|
25
25
|
def index
|
26
26
|
authorize! :admin, ReturnAuthorization
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
|
28
|
+
@return_authorizations = @order.
|
29
|
+
return_authorizations.
|
30
|
+
accessible_by(current_ability, :read).
|
31
|
+
ransack(params[:q]).
|
32
|
+
result
|
33
|
+
|
34
|
+
@return_authorizations = paginate(@return_authorizations)
|
35
|
+
|
30
36
|
respond_with(@return_authorizations)
|
31
37
|
end
|
32
38
|
|
@@ -14,7 +14,9 @@ module Spree
|
|
14
14
|
.joins(:order)
|
15
15
|
.where(spree_orders: { user_id: current_api_user.id })
|
16
16
|
.includes(mine_includes)
|
17
|
-
.ransack(params[:q]).result
|
17
|
+
.ransack(params[:q]).result
|
18
|
+
|
19
|
+
@shipments = paginate(@shipments)
|
18
20
|
else
|
19
21
|
render "spree/api/errors/unauthorized", status: :unauthorized
|
20
22
|
end
|
@@ -4,7 +4,7 @@ module Spree
|
|
4
4
|
before_action :load_stock_location, only: [:index, :show, :create]
|
5
5
|
|
6
6
|
def index
|
7
|
-
@stock_items = scope.ransack(params[:q]).result
|
7
|
+
@stock_items = paginate(scope.ransack(params[:q]).result)
|
8
8
|
respond_with(@stock_items)
|
9
9
|
end
|
10
10
|
|
@@ -3,7 +3,15 @@ module Spree
|
|
3
3
|
class StockLocationsController < Spree::Api::BaseController
|
4
4
|
def index
|
5
5
|
authorize! :read, StockLocation
|
6
|
-
|
6
|
+
|
7
|
+
@stock_locations = StockLocation.
|
8
|
+
accessible_by(current_ability, :read).
|
9
|
+
order('name ASC').
|
10
|
+
ransack(params[:q]).
|
11
|
+
result
|
12
|
+
|
13
|
+
@stock_locations = paginate(@stock_locations)
|
14
|
+
|
7
15
|
respond_with(@stock_locations)
|
8
16
|
end
|
9
17
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
class Spree::Api::StoreCreditEventsController < Spree::Api::BaseController
|
2
2
|
def mine
|
3
3
|
if current_api_user
|
4
|
-
@store_credit_events =
|
4
|
+
@store_credit_events = paginate(
|
5
|
+
current_api_user.store_credit_events.exposed_events
|
6
|
+
).reverse_chronological
|
5
7
|
else
|
6
8
|
render "spree/api/errors/unauthorized", status: :unauthorized
|
7
9
|
end
|
@@ -2,7 +2,8 @@ module Spree
|
|
2
2
|
module Api
|
3
3
|
class TaxonomiesController < Spree::Api::BaseController
|
4
4
|
def index
|
5
|
-
|
5
|
+
@taxonomies = paginate(taxonomies)
|
6
|
+
respond_with(@taxonomies)
|
6
7
|
end
|
7
8
|
|
8
9
|
def new
|
@@ -45,9 +46,12 @@ module Spree
|
|
45
46
|
private
|
46
47
|
|
47
48
|
def taxonomies
|
48
|
-
@taxonomies = Taxonomy.
|
49
|
-
|
50
|
-
|
49
|
+
@taxonomies = Taxonomy.
|
50
|
+
accessible_by(current_ability, :read).
|
51
|
+
order('name').
|
52
|
+
includes(root: :children).
|
53
|
+
ransack(params[:q]).
|
54
|
+
result
|
51
55
|
end
|
52
56
|
|
53
57
|
def taxonomy
|
@@ -10,7 +10,7 @@ module Spree
|
|
10
10
|
@taxons = Spree::Taxon.accessible_by(current_ability, :read).order(:taxonomy_id, :lft).ransack(params[:q]).result
|
11
11
|
end
|
12
12
|
|
13
|
-
@taxons = @taxons
|
13
|
+
@taxons = paginate(@taxons)
|
14
14
|
respond_with(@taxons)
|
15
15
|
end
|
16
16
|
|
@@ -65,13 +65,27 @@ module Spree
|
|
65
65
|
# Returns the products sorted by their position with the classification
|
66
66
|
# Products#index does not do the sorting.
|
67
67
|
taxon = Spree::Taxon.find(params[:id])
|
68
|
-
@products = taxon.products.ransack(params[:q]).result
|
69
|
-
@products = @products.
|
68
|
+
@products = paginate(taxon.products.ransack(params[:q]).result)
|
69
|
+
@products = @products.includes(master: :default_price)
|
70
|
+
|
71
|
+
if params[:simple]
|
72
|
+
@exclude_data = {
|
73
|
+
variants: true,
|
74
|
+
option_types: true,
|
75
|
+
product_properties: true,
|
76
|
+
classifications: true
|
77
|
+
}
|
78
|
+
@product_attributes = %i(id name display_price)
|
79
|
+
end
|
70
80
|
render "spree/api/products/index"
|
71
81
|
end
|
72
82
|
|
73
83
|
private
|
74
84
|
|
85
|
+
def default_per_page
|
86
|
+
500
|
87
|
+
end
|
88
|
+
|
75
89
|
def taxonomy
|
76
90
|
if params[:taxonomy_id].present?
|
77
91
|
@taxonomy ||= Spree::Taxonomy.accessible_by(current_ability, :read).find(params[:taxonomy_id])
|
@@ -24,7 +24,9 @@ module Spree
|
|
24
24
|
# or removed from the views.
|
25
25
|
def index
|
26
26
|
@variants = scope.includes({ option_values: :option_type }, :product, :default_price, :images, { stock_items: :stock_location })
|
27
|
-
.ransack(params[:q]).result
|
27
|
+
.ransack(params[:q]).result
|
28
|
+
|
29
|
+
@variants = paginate(@variants)
|
28
30
|
respond_with(@variants)
|
29
31
|
end
|
30
32
|
|
@@ -18,7 +18,14 @@ module Spree
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def index
|
21
|
-
@zones = Zone.
|
21
|
+
@zones = Zone.
|
22
|
+
accessible_by(current_ability, :read).
|
23
|
+
order('name ASC').
|
24
|
+
ransack(params[:q]).
|
25
|
+
result
|
26
|
+
|
27
|
+
@zones = paginate(@zones)
|
28
|
+
|
22
29
|
respond_with(@zones)
|
23
30
|
end
|
24
31
|
|
@@ -1,31 +1,42 @@
|
|
1
1
|
object @product
|
2
2
|
cache [I18n.locale, @current_user_roles.include?('admin'), current_pricing_options, root_object]
|
3
3
|
|
4
|
-
|
4
|
+
@product_attributes ||= product_attributes
|
5
|
+
attributes(*@product_attributes)
|
5
6
|
|
6
7
|
node(:display_price) { |p| p.display_price.to_s }
|
7
|
-
node(:has_variants) { |p| p.has_variants? }
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
@exclude_data ||= {}
|
10
|
+
unless @exclude_data[:variants]
|
11
|
+
node(:has_variants) { |p| p.has_variants? }
|
12
|
+
|
13
|
+
child :master => :master do
|
14
|
+
extends "spree/api/variants/small"
|
15
|
+
end
|
12
16
|
|
13
|
-
child :variants => :variants do
|
14
|
-
|
17
|
+
child :variants => :variants do
|
18
|
+
extends "spree/api/variants/small"
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
|
-
|
18
|
-
|
22
|
+
unless @exclude_data[:option_types]
|
23
|
+
child :option_types => :option_types do
|
24
|
+
attributes(*option_type_attributes)
|
25
|
+
end
|
19
26
|
end
|
20
27
|
|
21
|
-
|
22
|
-
|
28
|
+
unless @exclude_data[:product_properties]
|
29
|
+
child :product_properties => :product_properties do
|
30
|
+
attributes(*product_property_attributes)
|
31
|
+
end
|
23
32
|
end
|
24
33
|
|
25
|
-
|
26
|
-
|
34
|
+
unless @exclude_data[:classifications]
|
35
|
+
child :classifications => :classifications do
|
36
|
+
attributes :taxon_id, :position
|
27
37
|
|
28
|
-
|
29
|
-
|
38
|
+
child(:taxon) do
|
39
|
+
extends "spree/api/taxons/show"
|
40
|
+
end
|
30
41
|
end
|
31
42
|
end
|
data/solidus_api.gemspec
CHANGED
@@ -5,6 +5,7 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.author = 'Solidus Team'
|
6
6
|
gem.email = 'contact@solidus.io'
|
7
7
|
gem.homepage = 'http://solidus.io/'
|
8
|
+
gem.license = 'BSD-3-Clause'
|
8
9
|
|
9
10
|
gem.summary = 'REST API for the Solidus e-commerce framework.'
|
10
11
|
gem.description = gem.summary
|
@@ -16,6 +17,9 @@ Gem::Specification.new do |gem|
|
|
16
17
|
gem.require_paths = ["lib"]
|
17
18
|
gem.version = Spree.solidus_version
|
18
19
|
|
20
|
+
gem.required_ruby_version = '>= 2.2.2'
|
21
|
+
gem.required_rubygems_version = '>= 1.8.23'
|
22
|
+
|
19
23
|
gem.add_dependency 'solidus_core', gem.version
|
20
24
|
gem.add_dependency 'rabl', '0.13.0' # FIXME: update for proper rails 5 support
|
21
25
|
gem.add_dependency 'versioncake', '~> 3.0'
|
@@ -163,19 +163,6 @@ module Spree
|
|
163
163
|
expect(response.status).to eq(200)
|
164
164
|
end
|
165
165
|
|
166
|
-
context "with disallowed payment method" do
|
167
|
-
it "returns not found" do
|
168
|
-
order.update_column(:state, "payment")
|
169
|
-
allow_any_instance_of(Spree::Gateway::Bogus).to receive(:source_required?).and_return(false)
|
170
|
-
@payment_method.update!(display_on: "back_end")
|
171
|
-
expect {
|
172
|
-
api_put :update, id: order.to_param, order_token: order.guest_token, order: { payments_attributes: [{ payment_method_id: @payment_method.id }] }
|
173
|
-
}.not_to change { Spree::Payment.count }
|
174
|
-
expect(response.status).to eq(404)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
|
179
166
|
it "returns errors when source is required and missing" do
|
180
167
|
order.update_column(:state, "payment")
|
181
168
|
api_put :update, id: order.to_param, order_token: order.guest_token,
|
@@ -32,9 +32,8 @@ module Spree
|
|
32
32
|
describe "POST create" do
|
33
33
|
let(:target_user) { create :user }
|
34
34
|
let(:date_override) { Time.parse('2015-01-01') }
|
35
|
-
let(:attributes) { { user_id: target_user.id, created_at: date_override, email: target_user.email } }
|
36
35
|
|
37
|
-
subject { api_post :create, order:
|
36
|
+
subject { api_post :create, order: { user_id: target_user.id, created_at: date_override, email: target_user.email } }
|
38
37
|
|
39
38
|
context "when the current user cannot administrate the order" do
|
40
39
|
stub_authorization! do |_|
|
@@ -43,37 +42,12 @@ module Spree
|
|
43
42
|
|
44
43
|
it "does not include unpermitted params, or allow overriding the user", focus: true do
|
45
44
|
subject
|
46
|
-
expect(response).to be_success
|
47
45
|
order = Spree::Order.last
|
48
46
|
expect(order.user).to eq current_api_user
|
49
47
|
expect(order.email).to eq target_user.email
|
50
48
|
end
|
51
49
|
|
52
50
|
it { is_expected.to be_success }
|
53
|
-
|
54
|
-
context 'creating payment' do
|
55
|
-
let(:attributes) { super().merge(payments_attributes: [{ payment_method_id: payment_method.id }]) }
|
56
|
-
|
57
|
-
context "with allowed payment method" do
|
58
|
-
let!(:payment_method) { create(:check_payment_method, name: "allowed" ) }
|
59
|
-
it { is_expected.to be_success }
|
60
|
-
it "creates a payment" do
|
61
|
-
expect {
|
62
|
-
subject
|
63
|
-
}.to change { Spree::Payment.count }.by(1)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context "with disallowed payment method" do
|
68
|
-
let!(:payment_method) { create(:check_payment_method, name: "forbidden", display_on: "back_end") }
|
69
|
-
it { is_expected.to be_not_found }
|
70
|
-
it "creates no payments" do
|
71
|
-
expect {
|
72
|
-
subject
|
73
|
-
}.not_to change { Spree::Payment.count }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
51
|
end
|
78
52
|
|
79
53
|
context "when the current user can administrate the order" do
|
@@ -123,30 +97,6 @@ module Spree
|
|
123
97
|
subject
|
124
98
|
}.to_not change{ order.reload.number }
|
125
99
|
end
|
126
|
-
|
127
|
-
context 'creating payment' do
|
128
|
-
let(:order_params) { super().merge(payments_attributes: [{ payment_method_id: payment_method.id }]) }
|
129
|
-
|
130
|
-
context "with allowed payment method" do
|
131
|
-
let!(:payment_method) { create(:check_payment_method, name: "allowed" ) }
|
132
|
-
it { is_expected.to be_success }
|
133
|
-
it "creates a payment" do
|
134
|
-
expect {
|
135
|
-
subject
|
136
|
-
}.to change { Spree::Payment.count }.by(1)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
context "with disallowed payment method" do
|
141
|
-
let!(:payment_method) { create(:check_payment_method, name: "forbidden", display_on: "back_end") }
|
142
|
-
it { is_expected.to be_not_found }
|
143
|
-
it "creates no payments" do
|
144
|
-
expect {
|
145
|
-
subject
|
146
|
-
}.not_to change { Spree::Payment.count }
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
100
|
end
|
151
101
|
|
152
102
|
context "when the user can administer the order" do
|
@@ -383,7 +333,10 @@ module Spree
|
|
383
333
|
|
384
334
|
# Regression test for https://github.com/spree/spree/issues/3404
|
385
335
|
it "can specify additional parameters for a line item" do
|
386
|
-
|
336
|
+
expect(Order).to receive(:create!).and_return(order = Spree::Order.new)
|
337
|
+
allow(order).to receive(:associate_user!)
|
338
|
+
allow(order).to receive_message_chain(:contents, :add).and_return(line_item = double('LineItem'))
|
339
|
+
expect(line_item).to receive(:update_attributes!).with(hash_including("special" => "foo"))
|
387
340
|
|
388
341
|
allow(controller).to receive_messages(permitted_line_item_attributes: [:id, :variant_id, :quantity, :special])
|
389
342
|
api_post :create, order: {
|
@@ -45,17 +45,6 @@ module Spree
|
|
45
45
|
expect(response.status).to eq(201)
|
46
46
|
expect(json_response).to have_attributes(attributes)
|
47
47
|
end
|
48
|
-
|
49
|
-
context "disallowed payment method" do
|
50
|
-
it "does not create a new payment" do
|
51
|
-
PaymentMethod.first.update!(display_on: "back_end")
|
52
|
-
|
53
|
-
expect {
|
54
|
-
api_post :create, payment: { payment_method_id: PaymentMethod.first.id, amount: 50 }
|
55
|
-
}.not_to change { Spree::Payment.count }
|
56
|
-
expect(response.status).to eq(404)
|
57
|
-
end
|
58
|
-
end
|
59
48
|
end
|
60
49
|
|
61
50
|
context "payment source is required" do
|
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.0.
|
4
|
+
version: 2.1.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.
|
19
|
+
version: 2.1.0.beta1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.
|
26
|
+
version: 2.1.0.beta1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rabl
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,7 +261,8 @@ files:
|
|
261
261
|
- spec/test_views/spree/api/widgets/new.v1.rabl
|
262
262
|
- spec/test_views/spree/api/widgets/show.v1.rabl
|
263
263
|
homepage: http://solidus.io/
|
264
|
-
licenses:
|
264
|
+
licenses:
|
265
|
+
- BSD-3-Clause
|
265
266
|
metadata: {}
|
266
267
|
post_install_message:
|
267
268
|
rdoc_options: []
|
@@ -271,15 +272,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
271
272
|
requirements:
|
272
273
|
- - ">="
|
273
274
|
- !ruby/object:Gem::Version
|
274
|
-
version:
|
275
|
+
version: 2.2.2
|
275
276
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
276
277
|
requirements:
|
277
278
|
- - ">="
|
278
279
|
- !ruby/object:Gem::Version
|
279
|
-
version:
|
280
|
+
version: 1.8.23
|
280
281
|
requirements: []
|
281
282
|
rubyforge_project:
|
282
|
-
rubygems_version: 2.
|
283
|
+
rubygems_version: 2.5.2
|
283
284
|
signing_key:
|
284
285
|
specification_version: 4
|
285
286
|
summary: REST API for the Solidus e-commerce framework.
|