solidus_api 1.0.0.pre
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 +7 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +5 -0
- data/LICENSE +27 -0
- data/Rakefile +16 -0
- data/app/controllers/spree/api/addresses_controller.rb +43 -0
- data/app/controllers/spree/api/base_controller.rb +189 -0
- data/app/controllers/spree/api/checkouts_controller.rb +133 -0
- data/app/controllers/spree/api/classifications_controller.rb +18 -0
- data/app/controllers/spree/api/config_controller.rb +6 -0
- data/app/controllers/spree/api/countries_controller.rb +23 -0
- data/app/controllers/spree/api/credit_cards_controller.rb +25 -0
- data/app/controllers/spree/api/images_controller.rb +47 -0
- data/app/controllers/spree/api/inventory_units_controller.rb +52 -0
- data/app/controllers/spree/api/line_items_controller.rb +74 -0
- data/app/controllers/spree/api/option_types_controller.rb +49 -0
- data/app/controllers/spree/api/option_values_controller.rb +58 -0
- data/app/controllers/spree/api/orders_controller.rb +155 -0
- data/app/controllers/spree/api/payments_controller.rb +81 -0
- data/app/controllers/spree/api/product_properties_controller.rb +72 -0
- data/app/controllers/spree/api/products_controller.rb +129 -0
- data/app/controllers/spree/api/promotions_controller.rb +26 -0
- data/app/controllers/spree/api/properties_controller.rb +71 -0
- data/app/controllers/spree/api/return_authorizations_controller.rb +71 -0
- data/app/controllers/spree/api/shipments_controller.rb +172 -0
- data/app/controllers/spree/api/states_controller.rb +35 -0
- data/app/controllers/spree/api/stock_items_controller.rb +84 -0
- data/app/controllers/spree/api/stock_locations_controller.rb +50 -0
- data/app/controllers/spree/api/stock_movements_controller.rb +42 -0
- data/app/controllers/spree/api/stock_transfers_controller.rb +19 -0
- data/app/controllers/spree/api/store_credit_events_controller.rb +9 -0
- data/app/controllers/spree/api/stores_controller.rb +55 -0
- data/app/controllers/spree/api/taxonomies_controller.rb +64 -0
- data/app/controllers/spree/api/taxons_controller.rb +93 -0
- data/app/controllers/spree/api/transfer_items_controller.rb +42 -0
- data/app/controllers/spree/api/users_controller.rb +56 -0
- data/app/controllers/spree/api/variants_controller.rb +75 -0
- data/app/controllers/spree/api/zones_controller.rb +50 -0
- data/app/helpers/spree/api/api_helpers.rb +190 -0
- data/app/models/spree/api_configuration.rb +5 -0
- data/app/models/spree/option_value_decorator.rb +9 -0
- data/app/views/spree/api/addresses/show.v1.rabl +10 -0
- data/app/views/spree/api/adjustments/show.v1.rabl +4 -0
- data/app/views/spree/api/config/money.v1.rabl +2 -0
- data/app/views/spree/api/config/show.v1.rabl +2 -0
- data/app/views/spree/api/countries/index.v1.rabl +7 -0
- data/app/views/spree/api/countries/show.v1.rabl +5 -0
- data/app/views/spree/api/credit_cards/index.v1.rabl +7 -0
- data/app/views/spree/api/credit_cards/show.v1.rabl +3 -0
- data/app/views/spree/api/errors/gateway_error.v1.rabl +2 -0
- data/app/views/spree/api/errors/invalid_api_key.v1.rabl +2 -0
- data/app/views/spree/api/errors/invalid_resource.v1.rabl +3 -0
- data/app/views/spree/api/errors/must_specify_api_key.v1.rabl +2 -0
- data/app/views/spree/api/errors/not_found.v1.rabl +2 -0
- data/app/views/spree/api/errors/unauthorized.v1.rabl +2 -0
- data/app/views/spree/api/errors/variant_not_in_stock_transfer.v1.rabl +2 -0
- data/app/views/spree/api/images/index.v1.rabl +4 -0
- data/app/views/spree/api/images/show.v1.rabl +6 -0
- data/app/views/spree/api/inventory_units/show.rabl +2 -0
- data/app/views/spree/api/line_items/new.v1.rabl +3 -0
- data/app/views/spree/api/line_items/show.v1.rabl +15 -0
- data/app/views/spree/api/option_types/index.v1.rabl +3 -0
- data/app/views/spree/api/option_types/show.v1.rabl +5 -0
- data/app/views/spree/api/option_values/index.v1.rabl +3 -0
- data/app/views/spree/api/option_values/show.v1.rabl +2 -0
- data/app/views/spree/api/orders/address.v1.rabl +0 -0
- data/app/views/spree/api/orders/canceled.v1.rabl +0 -0
- data/app/views/spree/api/orders/cart.v1.rabl +0 -0
- data/app/views/spree/api/orders/complete.v1.rabl +0 -0
- data/app/views/spree/api/orders/could_not_apply_coupon.v1.rabl +2 -0
- data/app/views/spree/api/orders/could_not_transition.v1.rabl +3 -0
- data/app/views/spree/api/orders/expected_total_mismatch.v1.rabl +2 -0
- data/app/views/spree/api/orders/index.v1.rabl +7 -0
- data/app/views/spree/api/orders/invalid_shipping_method.v1.rabl +2 -0
- data/app/views/spree/api/orders/mine.v1.rabl +9 -0
- data/app/views/spree/api/orders/order.v1.rabl +9 -0
- data/app/views/spree/api/orders/payment.v1.rabl +3 -0
- data/app/views/spree/api/orders/show.v1.rabl +52 -0
- data/app/views/spree/api/payments/credit_over_limit.v1.rabl +2 -0
- data/app/views/spree/api/payments/index.v1.rabl +7 -0
- data/app/views/spree/api/payments/new.v1.rabl +5 -0
- data/app/views/spree/api/payments/show.v1.rabl +2 -0
- data/app/views/spree/api/payments/update_forbidden.v1.rabl +2 -0
- data/app/views/spree/api/product_properties/index.v1.rabl +7 -0
- data/app/views/spree/api/product_properties/new.v1.rabl +2 -0
- data/app/views/spree/api/product_properties/show.v1.rabl +2 -0
- data/app/views/spree/api/products/index.v1.rabl +9 -0
- data/app/views/spree/api/products/new.v1.rabl +3 -0
- data/app/views/spree/api/products/product.v1.rabl +1 -0
- data/app/views/spree/api/products/show.v1.rabl +31 -0
- data/app/views/spree/api/promotions/handler.v1.rabl +5 -0
- data/app/views/spree/api/promotions/show.v1.rabl +2 -0
- data/app/views/spree/api/properties/index.v1.rabl +7 -0
- data/app/views/spree/api/properties/new.v1.rabl +2 -0
- data/app/views/spree/api/properties/show.v1.rabl +2 -0
- data/app/views/spree/api/return_authorizations/index.v1.rabl +7 -0
- data/app/views/spree/api/return_authorizations/new.v1.rabl +3 -0
- data/app/views/spree/api/return_authorizations/show.v1.rabl +2 -0
- data/app/views/spree/api/shared/stock_location_required.v1.rabl +2 -0
- data/app/views/spree/api/shipments/big.v1.rabl +48 -0
- data/app/views/spree/api/shipments/cannot_ready_shipment.v1.rabl +2 -0
- data/app/views/spree/api/shipments/mine.v1.rabl +9 -0
- data/app/views/spree/api/shipments/show.v1.rabl +32 -0
- data/app/views/spree/api/shipments/small.v1.rabl +37 -0
- data/app/views/spree/api/shipping_rates/show.v1.rabl +2 -0
- data/app/views/spree/api/states/index.v1.rabl +14 -0
- data/app/views/spree/api/states/show.v1.rabl +2 -0
- data/app/views/spree/api/stock_items/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_items/show.v1.rabl +5 -0
- data/app/views/spree/api/stock_locations/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_locations/show.v1.rabl +8 -0
- data/app/views/spree/api/stock_movements/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_movements/show.v1.rabl +5 -0
- data/app/views/spree/api/stock_transfers/receive.v1.rabl +5 -0
- data/app/views/spree/api/store_credit_events/mine.v1.rabl +10 -0
- data/app/views/spree/api/stores/index.v1.rabl +4 -0
- data/app/views/spree/api/stores/show.v1.rabl +2 -0
- data/app/views/spree/api/taxonomies/index.v1.rabl +7 -0
- data/app/views/spree/api/taxonomies/jstree.rabl +8 -0
- data/app/views/spree/api/taxonomies/nested.v1.rabl +11 -0
- data/app/views/spree/api/taxonomies/new.v1.rabl +3 -0
- data/app/views/spree/api/taxonomies/show.v1.rabl +15 -0
- data/app/views/spree/api/taxons/index.v1.rabl +12 -0
- data/app/views/spree/api/taxons/jstree.rabl +8 -0
- data/app/views/spree/api/taxons/new.v1.rabl +3 -0
- data/app/views/spree/api/taxons/show.v1.rabl +6 -0
- data/app/views/spree/api/taxons/taxons.v1.rabl +5 -0
- data/app/views/spree/api/transfer_items/show.v1.rabl +6 -0
- data/app/views/spree/api/users/index.v1.rabl +7 -0
- data/app/views/spree/api/users/new.v1.rabl +3 -0
- data/app/views/spree/api/users/show.v1.rabl +10 -0
- data/app/views/spree/api/variants/big.v1.rabl +17 -0
- data/app/views/spree/api/variants/index.v1.rabl +9 -0
- data/app/views/spree/api/variants/new.v1.rabl +2 -0
- data/app/views/spree/api/variants/show.v1.rabl +3 -0
- data/app/views/spree/api/variants/small.v1.rabl +17 -0
- data/app/views/spree/api/zones/index.v1.rabl +7 -0
- data/app/views/spree/api/zones/show.v1.rabl +6 -0
- data/config/initializers/metal_load_paths.rb +1 -0
- data/config/locales/en.yml +29 -0
- data/config/routes.rb +139 -0
- data/db/migrate/20100107141738_add_api_key_to_spree_users.rb +7 -0
- data/db/migrate/20120411123334_resize_api_key_field.rb +7 -0
- data/db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb +7 -0
- data/db/migrate/20131017162334_add_index_to_user_spree_api_key.rb +7 -0
- data/lib/solidus_api.rb +1 -0
- data/lib/spree/api/engine.rb +38 -0
- data/lib/spree/api/responders/rabl_template.rb +31 -0
- data/lib/spree/api/responders.rb +11 -0
- data/lib/spree/api/testing_support/caching.rb +10 -0
- data/lib/spree/api/testing_support/helpers.rb +44 -0
- data/lib/spree/api/testing_support/setup.rb +16 -0
- data/lib/spree/api.rb +10 -0
- data/lib/spree_api.rb +3 -0
- data/script/rails +9 -0
- data/solidus_api.gemspec +21 -0
- data/spec/controllers/spree/api/addresses_controller_spec.rb +56 -0
- data/spec/controllers/spree/api/base_controller_spec.rb +164 -0
- data/spec/controllers/spree/api/checkouts_controller_spec.rb +386 -0
- data/spec/controllers/spree/api/classifications_controller_spec.rb +48 -0
- data/spec/controllers/spree/api/config_controller_spec.rb +23 -0
- data/spec/controllers/spree/api/countries_controller_spec.rb +48 -0
- data/spec/controllers/spree/api/credit_cards_controller_spec.rb +80 -0
- data/spec/controllers/spree/api/images_controller_spec.rb +93 -0
- data/spec/controllers/spree/api/inventory_units_controller_spec.rb +50 -0
- data/spec/controllers/spree/api/line_items_controller_spec.rb +186 -0
- data/spec/controllers/spree/api/option_types_controller_spec.rb +116 -0
- data/spec/controllers/spree/api/option_values_controller_spec.rb +135 -0
- data/spec/controllers/spree/api/orders_controller_spec.rb +759 -0
- data/spec/controllers/spree/api/payments_controller_spec.rb +254 -0
- data/spec/controllers/spree/api/product_properties_controller_spec.rb +116 -0
- data/spec/controllers/spree/api/products_controller_spec.rb +454 -0
- data/spec/controllers/spree/api/promotion_application_spec.rb +50 -0
- data/spec/controllers/spree/api/promotions_controller_spec.rb +64 -0
- data/spec/controllers/spree/api/properties_controller_spec.rb +102 -0
- data/spec/controllers/spree/api/return_authorizations_controller_spec.rb +173 -0
- data/spec/controllers/spree/api/shipments_controller_spec.rb +252 -0
- data/spec/controllers/spree/api/states_controller_spec.rb +82 -0
- data/spec/controllers/spree/api/stock_items_controller_spec.rb +307 -0
- data/spec/controllers/spree/api/stock_locations_controller_spec.rb +172 -0
- data/spec/controllers/spree/api/stock_movements_controller_spec.rb +84 -0
- data/spec/controllers/spree/api/stock_transfers_controller_spec.rb +83 -0
- data/spec/controllers/spree/api/store_credit_events_controller_spec.rb +68 -0
- data/spec/controllers/spree/api/stores_controller_spec.rb +133 -0
- data/spec/controllers/spree/api/taxonomies_controller_spec.rb +114 -0
- data/spec/controllers/spree/api/taxons_controller_spec.rb +177 -0
- data/spec/controllers/spree/api/transfer_items_controller_spec.rb +152 -0
- data/spec/controllers/spree/api/unauthenticated_products_controller_spec.rb +26 -0
- data/spec/controllers/spree/api/users_controller_spec.rb +153 -0
- data/spec/controllers/spree/api/variants_controller_spec.rb +235 -0
- data/spec/controllers/spree/api/zones_controller_spec.rb +115 -0
- data/spec/features/checkout_spec.rb +187 -0
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/models/spree/legacy_user_spec.rb +45 -0
- data/spec/requests/rabl_cache_spec.rb +32 -0
- data/spec/shared_examples/protect_product_actions.rb +17 -0
- data/spec/spec_helper.rb +60 -0
- data/spec/support/controller_hacks.rb +38 -0
- data/spec/support/database_cleaner.rb +14 -0
- data/spec/support/have_attributes_matcher.rb +13 -0
- metadata +334 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
describe LegacyUser, :type => :model do
|
5
|
+
let(:user) { LegacyUser.new }
|
6
|
+
|
7
|
+
it "can generate an API key" do
|
8
|
+
expect(user).to receive(:save!)
|
9
|
+
user.generate_spree_api_key!
|
10
|
+
expect(user.spree_api_key).not_to be_blank
|
11
|
+
end
|
12
|
+
|
13
|
+
it "can clear an API key" do
|
14
|
+
expect(user).to receive(:save!)
|
15
|
+
user.clear_spree_api_key!
|
16
|
+
expect(user.spree_api_key).to be_blank
|
17
|
+
end
|
18
|
+
|
19
|
+
context "admin role auto-api-key grant" do # so the admin user can do admin api actions
|
20
|
+
let(:user) { create(:user) }
|
21
|
+
before { expect(user.spree_roles).to be_blank }
|
22
|
+
subject { user.spree_roles << role }
|
23
|
+
|
24
|
+
context "admin role" do
|
25
|
+
let(:role) { create(:role, name: "admin") }
|
26
|
+
|
27
|
+
context "the user has no api key" do
|
28
|
+
before { user.clear_spree_api_key! }
|
29
|
+
it { expect { subject }.to change { user.reload.spree_api_key }.from(nil) }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "the user already has an api key" do
|
33
|
+
before { user.generate_spree_api_key! }
|
34
|
+
it { expect { subject }.not_to change { user.reload.spree_api_key } }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "non-admin role" do
|
39
|
+
let(:role) { create(:role, name: "foo") }
|
40
|
+
before { user.clear_spree_api_key! }
|
41
|
+
it { expect { subject }.not_to change { user.reload.spree_api_key } }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Rabl Cache", :type => :request, :caching => true do
|
4
|
+
let!(:user) { create(:admin_user) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
create(:variant)
|
8
|
+
user.generate_spree_api_key!
|
9
|
+
expect(Spree::Product.count).to eq(1)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "doesn't create a cache key collision for models with different rabl templates" do
|
13
|
+
get "/api/variants", :token => user.spree_api_key
|
14
|
+
expect(response.status).to eq(200)
|
15
|
+
|
16
|
+
# Make sure we get a non master variant
|
17
|
+
variant_a = JSON.parse(response.body)['variants'].select do |v|
|
18
|
+
!v['is_master']
|
19
|
+
end.first
|
20
|
+
|
21
|
+
expect(variant_a['is_master']).to be false
|
22
|
+
expect(variant_a['stock_items']).not_to be_nil
|
23
|
+
|
24
|
+
get "/api/products/#{Spree::Product.first.id}", :token => user.spree_api_key
|
25
|
+
expect(response.status).to eq(200)
|
26
|
+
variant_b = JSON.parse(response.body)['variants'].last
|
27
|
+
expect(variant_b['is_master']).to be false
|
28
|
+
|
29
|
+
expect(variant_a['id']).to eq(variant_b['id'])
|
30
|
+
expect(variant_b['stock_items']).to be_nil
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
shared_examples "modifying product actions are restricted" do
|
2
|
+
it "cannot create a new product if not an admin" do
|
3
|
+
api_post :create, :product => { :name => "Brand new product!" }
|
4
|
+
assert_unauthorized!
|
5
|
+
end
|
6
|
+
|
7
|
+
it "cannot update a product" do
|
8
|
+
api_put :update, :id => product.to_param, :product => { :name => "I hacked your store!" }
|
9
|
+
assert_unauthorized!
|
10
|
+
end
|
11
|
+
|
12
|
+
it "cannot delete a product" do
|
13
|
+
api_delete :destroy, :id => product.to_param
|
14
|
+
assert_unauthorized!
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
if ENV["COVERAGE"]
|
2
|
+
# Run Coverage report
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start do
|
5
|
+
add_group 'Controllers', 'app/controllers'
|
6
|
+
add_group 'Helpers', 'app/helpers'
|
7
|
+
add_group 'Mailers', 'app/mailers'
|
8
|
+
add_group 'Models', 'app/models'
|
9
|
+
add_group 'Views', 'app/views'
|
10
|
+
add_group 'Libraries', 'lib'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
15
|
+
ENV["RAILS_ENV"] ||= 'test'
|
16
|
+
|
17
|
+
begin
|
18
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
19
|
+
rescue LoadError
|
20
|
+
puts "Could not load dummy application. Please ensure you have run `bundle exec rake test_app`"
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'rspec/rails'
|
25
|
+
require 'ffaker'
|
26
|
+
|
27
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
28
|
+
# in spec/support/ and its subdirectories.
|
29
|
+
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
30
|
+
|
31
|
+
require 'spree/testing_support/factories'
|
32
|
+
require 'spree/testing_support/rspec-activemodel-mocks_patch'
|
33
|
+
require 'spree/testing_support/preferences'
|
34
|
+
require 'spree/testing_support/mail'
|
35
|
+
|
36
|
+
require 'spree/api/testing_support/caching'
|
37
|
+
require 'spree/api/testing_support/helpers'
|
38
|
+
require 'spree/api/testing_support/setup'
|
39
|
+
|
40
|
+
RSpec.configure do |config|
|
41
|
+
config.backtrace_exclusion_patterns = [/gems\/activesupport/, /gems\/actionpack/, /gems\/rspec/]
|
42
|
+
config.color = true
|
43
|
+
config.infer_spec_type_from_file_location!
|
44
|
+
|
45
|
+
config.include FactoryGirl::Syntax::Methods
|
46
|
+
config.include Spree::Api::TestingSupport::Helpers, :type => :controller
|
47
|
+
config.extend Spree::Api::TestingSupport::Setup, :type => :controller
|
48
|
+
config.include Spree::TestingSupport::Preferences
|
49
|
+
config.include Spree::TestingSupport::Mail
|
50
|
+
|
51
|
+
config.fail_fast = ENV['FAIL_FAST'] || false
|
52
|
+
|
53
|
+
config.before(:each) do
|
54
|
+
Rails.cache.clear
|
55
|
+
reset_spree_preferences
|
56
|
+
Spree::Api::Config[:requires_authentication] = true
|
57
|
+
end
|
58
|
+
|
59
|
+
config.use_transactional_fixtures = true
|
60
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'active_support/all'
|
2
|
+
|
3
|
+
module ControllerHacks
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
routes { Spree::Core::Engine.routes }
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_get(action, params={}, session=nil, flash=nil)
|
11
|
+
api_process(action, params, session, flash, "GET")
|
12
|
+
end
|
13
|
+
|
14
|
+
def api_post(action, params={}, session=nil, flash=nil)
|
15
|
+
api_process(action, params, session, flash, "POST")
|
16
|
+
end
|
17
|
+
|
18
|
+
def api_put(action, params={}, session=nil, flash=nil)
|
19
|
+
api_process(action, params, session, flash, "PUT")
|
20
|
+
end
|
21
|
+
|
22
|
+
def api_patch(action, params={}, session=nil, flash=nil)
|
23
|
+
api_process(action, params, session, flash, "PATCH")
|
24
|
+
end
|
25
|
+
|
26
|
+
def api_delete(action, params={}, session=nil, flash=nil)
|
27
|
+
api_process(action, params, session, flash, "DELETE")
|
28
|
+
end
|
29
|
+
|
30
|
+
def api_process(action, params={}, session=nil, flash=nil, method="get")
|
31
|
+
scoping = respond_to?(:resource_scoping) ? resource_scoping : {}
|
32
|
+
process(action, method, params.merge(scoping).reverse_merge!(format: :json), session, flash)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec.configure do |config|
|
37
|
+
config.include ControllerHacks, type: :controller
|
38
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.before(:suite) do
|
3
|
+
DatabaseCleaner.strategy = :transaction
|
4
|
+
DatabaseCleaner.clean_with(:truncation)
|
5
|
+
end
|
6
|
+
|
7
|
+
config.before(:each) do
|
8
|
+
DatabaseCleaner.start
|
9
|
+
end
|
10
|
+
|
11
|
+
config.after(:each) do
|
12
|
+
DatabaseCleaner.clean
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
RSpec::Matchers.define :have_attributes do |expected_attributes|
|
6
|
+
match do |actual|
|
7
|
+
# actual is a Hash object representing an object, like this:
|
8
|
+
# { "name" => "Product #1" }
|
9
|
+
actual_attributes = actual.keys.map(&:to_sym)
|
10
|
+
expected_attributes.map(&:to_sym).all? { |attr| actual_attributes.include?(attr) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
metadata
ADDED
@@ -0,0 +1,334 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: solidus_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.pre
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Solidus Team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: solidus_core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0.pre
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0.pre
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rabl
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.4.pre1
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.12.0
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.9.4.pre1
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.12.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: versioncake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.3.1
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.3.1
|
61
|
+
description: Spree's API
|
62
|
+
email: contact@solidus.io
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- ".gitignore"
|
68
|
+
- CHANGELOG.md
|
69
|
+
- Gemfile
|
70
|
+
- LICENSE
|
71
|
+
- Rakefile
|
72
|
+
- app/controllers/spree/api/addresses_controller.rb
|
73
|
+
- app/controllers/spree/api/base_controller.rb
|
74
|
+
- app/controllers/spree/api/checkouts_controller.rb
|
75
|
+
- app/controllers/spree/api/classifications_controller.rb
|
76
|
+
- app/controllers/spree/api/config_controller.rb
|
77
|
+
- app/controllers/spree/api/countries_controller.rb
|
78
|
+
- app/controllers/spree/api/credit_cards_controller.rb
|
79
|
+
- app/controllers/spree/api/images_controller.rb
|
80
|
+
- app/controllers/spree/api/inventory_units_controller.rb
|
81
|
+
- app/controllers/spree/api/line_items_controller.rb
|
82
|
+
- app/controllers/spree/api/option_types_controller.rb
|
83
|
+
- app/controllers/spree/api/option_values_controller.rb
|
84
|
+
- app/controllers/spree/api/orders_controller.rb
|
85
|
+
- app/controllers/spree/api/payments_controller.rb
|
86
|
+
- app/controllers/spree/api/product_properties_controller.rb
|
87
|
+
- app/controllers/spree/api/products_controller.rb
|
88
|
+
- app/controllers/spree/api/promotions_controller.rb
|
89
|
+
- app/controllers/spree/api/properties_controller.rb
|
90
|
+
- app/controllers/spree/api/return_authorizations_controller.rb
|
91
|
+
- app/controllers/spree/api/shipments_controller.rb
|
92
|
+
- app/controllers/spree/api/states_controller.rb
|
93
|
+
- app/controllers/spree/api/stock_items_controller.rb
|
94
|
+
- app/controllers/spree/api/stock_locations_controller.rb
|
95
|
+
- app/controllers/spree/api/stock_movements_controller.rb
|
96
|
+
- app/controllers/spree/api/stock_transfers_controller.rb
|
97
|
+
- app/controllers/spree/api/store_credit_events_controller.rb
|
98
|
+
- app/controllers/spree/api/stores_controller.rb
|
99
|
+
- app/controllers/spree/api/taxonomies_controller.rb
|
100
|
+
- app/controllers/spree/api/taxons_controller.rb
|
101
|
+
- app/controllers/spree/api/transfer_items_controller.rb
|
102
|
+
- app/controllers/spree/api/users_controller.rb
|
103
|
+
- app/controllers/spree/api/variants_controller.rb
|
104
|
+
- app/controllers/spree/api/zones_controller.rb
|
105
|
+
- app/helpers/spree/api/api_helpers.rb
|
106
|
+
- app/models/spree/api_configuration.rb
|
107
|
+
- app/models/spree/option_value_decorator.rb
|
108
|
+
- app/views/spree/api/addresses/show.v1.rabl
|
109
|
+
- app/views/spree/api/adjustments/show.v1.rabl
|
110
|
+
- app/views/spree/api/config/money.v1.rabl
|
111
|
+
- app/views/spree/api/config/show.v1.rabl
|
112
|
+
- app/views/spree/api/countries/index.v1.rabl
|
113
|
+
- app/views/spree/api/countries/show.v1.rabl
|
114
|
+
- app/views/spree/api/credit_cards/index.v1.rabl
|
115
|
+
- app/views/spree/api/credit_cards/show.v1.rabl
|
116
|
+
- app/views/spree/api/errors/gateway_error.v1.rabl
|
117
|
+
- app/views/spree/api/errors/invalid_api_key.v1.rabl
|
118
|
+
- app/views/spree/api/errors/invalid_resource.v1.rabl
|
119
|
+
- app/views/spree/api/errors/must_specify_api_key.v1.rabl
|
120
|
+
- app/views/spree/api/errors/not_found.v1.rabl
|
121
|
+
- app/views/spree/api/errors/unauthorized.v1.rabl
|
122
|
+
- app/views/spree/api/errors/variant_not_in_stock_transfer.v1.rabl
|
123
|
+
- app/views/spree/api/images/index.v1.rabl
|
124
|
+
- app/views/spree/api/images/show.v1.rabl
|
125
|
+
- app/views/spree/api/inventory_units/show.rabl
|
126
|
+
- app/views/spree/api/line_items/new.v1.rabl
|
127
|
+
- app/views/spree/api/line_items/show.v1.rabl
|
128
|
+
- app/views/spree/api/option_types/index.v1.rabl
|
129
|
+
- app/views/spree/api/option_types/show.v1.rabl
|
130
|
+
- app/views/spree/api/option_values/index.v1.rabl
|
131
|
+
- app/views/spree/api/option_values/show.v1.rabl
|
132
|
+
- app/views/spree/api/orders/address.v1.rabl
|
133
|
+
- app/views/spree/api/orders/canceled.v1.rabl
|
134
|
+
- app/views/spree/api/orders/cart.v1.rabl
|
135
|
+
- app/views/spree/api/orders/complete.v1.rabl
|
136
|
+
- app/views/spree/api/orders/could_not_apply_coupon.v1.rabl
|
137
|
+
- app/views/spree/api/orders/could_not_transition.v1.rabl
|
138
|
+
- app/views/spree/api/orders/expected_total_mismatch.v1.rabl
|
139
|
+
- app/views/spree/api/orders/index.v1.rabl
|
140
|
+
- app/views/spree/api/orders/invalid_shipping_method.v1.rabl
|
141
|
+
- app/views/spree/api/orders/mine.v1.rabl
|
142
|
+
- app/views/spree/api/orders/order.v1.rabl
|
143
|
+
- app/views/spree/api/orders/payment.v1.rabl
|
144
|
+
- app/views/spree/api/orders/show.v1.rabl
|
145
|
+
- app/views/spree/api/payments/credit_over_limit.v1.rabl
|
146
|
+
- app/views/spree/api/payments/index.v1.rabl
|
147
|
+
- app/views/spree/api/payments/new.v1.rabl
|
148
|
+
- app/views/spree/api/payments/show.v1.rabl
|
149
|
+
- app/views/spree/api/payments/update_forbidden.v1.rabl
|
150
|
+
- app/views/spree/api/product_properties/index.v1.rabl
|
151
|
+
- app/views/spree/api/product_properties/new.v1.rabl
|
152
|
+
- app/views/spree/api/product_properties/show.v1.rabl
|
153
|
+
- app/views/spree/api/products/index.v1.rabl
|
154
|
+
- app/views/spree/api/products/new.v1.rabl
|
155
|
+
- app/views/spree/api/products/product.v1.rabl
|
156
|
+
- app/views/spree/api/products/show.v1.rabl
|
157
|
+
- app/views/spree/api/promotions/handler.v1.rabl
|
158
|
+
- app/views/spree/api/promotions/show.v1.rabl
|
159
|
+
- app/views/spree/api/properties/index.v1.rabl
|
160
|
+
- app/views/spree/api/properties/new.v1.rabl
|
161
|
+
- app/views/spree/api/properties/show.v1.rabl
|
162
|
+
- app/views/spree/api/return_authorizations/index.v1.rabl
|
163
|
+
- app/views/spree/api/return_authorizations/new.v1.rabl
|
164
|
+
- app/views/spree/api/return_authorizations/show.v1.rabl
|
165
|
+
- app/views/spree/api/shared/stock_location_required.v1.rabl
|
166
|
+
- app/views/spree/api/shipments/big.v1.rabl
|
167
|
+
- app/views/spree/api/shipments/cannot_ready_shipment.v1.rabl
|
168
|
+
- app/views/spree/api/shipments/mine.v1.rabl
|
169
|
+
- app/views/spree/api/shipments/show.v1.rabl
|
170
|
+
- app/views/spree/api/shipments/small.v1.rabl
|
171
|
+
- app/views/spree/api/shipping_rates/show.v1.rabl
|
172
|
+
- app/views/spree/api/states/index.v1.rabl
|
173
|
+
- app/views/spree/api/states/show.v1.rabl
|
174
|
+
- app/views/spree/api/stock_items/index.v1.rabl
|
175
|
+
- app/views/spree/api/stock_items/show.v1.rabl
|
176
|
+
- app/views/spree/api/stock_locations/index.v1.rabl
|
177
|
+
- app/views/spree/api/stock_locations/show.v1.rabl
|
178
|
+
- app/views/spree/api/stock_movements/index.v1.rabl
|
179
|
+
- app/views/spree/api/stock_movements/show.v1.rabl
|
180
|
+
- app/views/spree/api/stock_transfers/receive.v1.rabl
|
181
|
+
- app/views/spree/api/store_credit_events/mine.v1.rabl
|
182
|
+
- app/views/spree/api/stores/index.v1.rabl
|
183
|
+
- app/views/spree/api/stores/show.v1.rabl
|
184
|
+
- app/views/spree/api/taxonomies/index.v1.rabl
|
185
|
+
- app/views/spree/api/taxonomies/jstree.rabl
|
186
|
+
- app/views/spree/api/taxonomies/nested.v1.rabl
|
187
|
+
- app/views/spree/api/taxonomies/new.v1.rabl
|
188
|
+
- app/views/spree/api/taxonomies/show.v1.rabl
|
189
|
+
- app/views/spree/api/taxons/index.v1.rabl
|
190
|
+
- app/views/spree/api/taxons/jstree.rabl
|
191
|
+
- app/views/spree/api/taxons/new.v1.rabl
|
192
|
+
- app/views/spree/api/taxons/show.v1.rabl
|
193
|
+
- app/views/spree/api/taxons/taxons.v1.rabl
|
194
|
+
- app/views/spree/api/transfer_items/show.v1.rabl
|
195
|
+
- app/views/spree/api/users/index.v1.rabl
|
196
|
+
- app/views/spree/api/users/new.v1.rabl
|
197
|
+
- app/views/spree/api/users/show.v1.rabl
|
198
|
+
- app/views/spree/api/variants/big.v1.rabl
|
199
|
+
- app/views/spree/api/variants/index.v1.rabl
|
200
|
+
- app/views/spree/api/variants/new.v1.rabl
|
201
|
+
- app/views/spree/api/variants/show.v1.rabl
|
202
|
+
- app/views/spree/api/variants/small.v1.rabl
|
203
|
+
- app/views/spree/api/zones/index.v1.rabl
|
204
|
+
- app/views/spree/api/zones/show.v1.rabl
|
205
|
+
- config/initializers/metal_load_paths.rb
|
206
|
+
- config/locales/en.yml
|
207
|
+
- config/routes.rb
|
208
|
+
- db/migrate/20100107141738_add_api_key_to_spree_users.rb
|
209
|
+
- db/migrate/20120411123334_resize_api_key_field.rb
|
210
|
+
- db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb
|
211
|
+
- db/migrate/20131017162334_add_index_to_user_spree_api_key.rb
|
212
|
+
- lib/solidus_api.rb
|
213
|
+
- lib/spree/api.rb
|
214
|
+
- lib/spree/api/engine.rb
|
215
|
+
- lib/spree/api/responders.rb
|
216
|
+
- lib/spree/api/responders/rabl_template.rb
|
217
|
+
- lib/spree/api/testing_support/caching.rb
|
218
|
+
- lib/spree/api/testing_support/helpers.rb
|
219
|
+
- lib/spree/api/testing_support/setup.rb
|
220
|
+
- lib/spree_api.rb
|
221
|
+
- script/rails
|
222
|
+
- solidus_api.gemspec
|
223
|
+
- spec/controllers/spree/api/addresses_controller_spec.rb
|
224
|
+
- spec/controllers/spree/api/base_controller_spec.rb
|
225
|
+
- spec/controllers/spree/api/checkouts_controller_spec.rb
|
226
|
+
- spec/controllers/spree/api/classifications_controller_spec.rb
|
227
|
+
- spec/controllers/spree/api/config_controller_spec.rb
|
228
|
+
- spec/controllers/spree/api/countries_controller_spec.rb
|
229
|
+
- spec/controllers/spree/api/credit_cards_controller_spec.rb
|
230
|
+
- spec/controllers/spree/api/images_controller_spec.rb
|
231
|
+
- spec/controllers/spree/api/inventory_units_controller_spec.rb
|
232
|
+
- spec/controllers/spree/api/line_items_controller_spec.rb
|
233
|
+
- spec/controllers/spree/api/option_types_controller_spec.rb
|
234
|
+
- spec/controllers/spree/api/option_values_controller_spec.rb
|
235
|
+
- spec/controllers/spree/api/orders_controller_spec.rb
|
236
|
+
- spec/controllers/spree/api/payments_controller_spec.rb
|
237
|
+
- spec/controllers/spree/api/product_properties_controller_spec.rb
|
238
|
+
- spec/controllers/spree/api/products_controller_spec.rb
|
239
|
+
- spec/controllers/spree/api/promotion_application_spec.rb
|
240
|
+
- spec/controllers/spree/api/promotions_controller_spec.rb
|
241
|
+
- spec/controllers/spree/api/properties_controller_spec.rb
|
242
|
+
- spec/controllers/spree/api/return_authorizations_controller_spec.rb
|
243
|
+
- spec/controllers/spree/api/shipments_controller_spec.rb
|
244
|
+
- spec/controllers/spree/api/states_controller_spec.rb
|
245
|
+
- spec/controllers/spree/api/stock_items_controller_spec.rb
|
246
|
+
- spec/controllers/spree/api/stock_locations_controller_spec.rb
|
247
|
+
- spec/controllers/spree/api/stock_movements_controller_spec.rb
|
248
|
+
- spec/controllers/spree/api/stock_transfers_controller_spec.rb
|
249
|
+
- spec/controllers/spree/api/store_credit_events_controller_spec.rb
|
250
|
+
- spec/controllers/spree/api/stores_controller_spec.rb
|
251
|
+
- spec/controllers/spree/api/taxonomies_controller_spec.rb
|
252
|
+
- spec/controllers/spree/api/taxons_controller_spec.rb
|
253
|
+
- spec/controllers/spree/api/transfer_items_controller_spec.rb
|
254
|
+
- spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
|
255
|
+
- spec/controllers/spree/api/users_controller_spec.rb
|
256
|
+
- spec/controllers/spree/api/variants_controller_spec.rb
|
257
|
+
- spec/controllers/spree/api/zones_controller_spec.rb
|
258
|
+
- spec/features/checkout_spec.rb
|
259
|
+
- spec/fixtures/thinking-cat.jpg
|
260
|
+
- spec/models/spree/legacy_user_spec.rb
|
261
|
+
- spec/requests/rabl_cache_spec.rb
|
262
|
+
- spec/shared_examples/protect_product_actions.rb
|
263
|
+
- spec/spec_helper.rb
|
264
|
+
- spec/support/controller_hacks.rb
|
265
|
+
- spec/support/database_cleaner.rb
|
266
|
+
- spec/support/have_attributes_matcher.rb
|
267
|
+
homepage: ''
|
268
|
+
licenses: []
|
269
|
+
metadata: {}
|
270
|
+
post_install_message:
|
271
|
+
rdoc_options: []
|
272
|
+
require_paths:
|
273
|
+
- lib
|
274
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - ">="
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '0'
|
279
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
|
+
requirements:
|
281
|
+
- - ">"
|
282
|
+
- !ruby/object:Gem::Version
|
283
|
+
version: 1.3.1
|
284
|
+
requirements: []
|
285
|
+
rubyforge_project:
|
286
|
+
rubygems_version: 2.2.0
|
287
|
+
signing_key:
|
288
|
+
specification_version: 4
|
289
|
+
summary: Spree's API
|
290
|
+
test_files:
|
291
|
+
- spec/controllers/spree/api/addresses_controller_spec.rb
|
292
|
+
- spec/controllers/spree/api/base_controller_spec.rb
|
293
|
+
- spec/controllers/spree/api/checkouts_controller_spec.rb
|
294
|
+
- spec/controllers/spree/api/classifications_controller_spec.rb
|
295
|
+
- spec/controllers/spree/api/config_controller_spec.rb
|
296
|
+
- spec/controllers/spree/api/countries_controller_spec.rb
|
297
|
+
- spec/controllers/spree/api/credit_cards_controller_spec.rb
|
298
|
+
- spec/controllers/spree/api/images_controller_spec.rb
|
299
|
+
- spec/controllers/spree/api/inventory_units_controller_spec.rb
|
300
|
+
- spec/controllers/spree/api/line_items_controller_spec.rb
|
301
|
+
- spec/controllers/spree/api/option_types_controller_spec.rb
|
302
|
+
- spec/controllers/spree/api/option_values_controller_spec.rb
|
303
|
+
- spec/controllers/spree/api/orders_controller_spec.rb
|
304
|
+
- spec/controllers/spree/api/payments_controller_spec.rb
|
305
|
+
- spec/controllers/spree/api/product_properties_controller_spec.rb
|
306
|
+
- spec/controllers/spree/api/products_controller_spec.rb
|
307
|
+
- spec/controllers/spree/api/promotion_application_spec.rb
|
308
|
+
- spec/controllers/spree/api/promotions_controller_spec.rb
|
309
|
+
- spec/controllers/spree/api/properties_controller_spec.rb
|
310
|
+
- spec/controllers/spree/api/return_authorizations_controller_spec.rb
|
311
|
+
- spec/controllers/spree/api/shipments_controller_spec.rb
|
312
|
+
- spec/controllers/spree/api/states_controller_spec.rb
|
313
|
+
- spec/controllers/spree/api/stock_items_controller_spec.rb
|
314
|
+
- spec/controllers/spree/api/stock_locations_controller_spec.rb
|
315
|
+
- spec/controllers/spree/api/stock_movements_controller_spec.rb
|
316
|
+
- spec/controllers/spree/api/stock_transfers_controller_spec.rb
|
317
|
+
- spec/controllers/spree/api/store_credit_events_controller_spec.rb
|
318
|
+
- spec/controllers/spree/api/stores_controller_spec.rb
|
319
|
+
- spec/controllers/spree/api/taxonomies_controller_spec.rb
|
320
|
+
- spec/controllers/spree/api/taxons_controller_spec.rb
|
321
|
+
- spec/controllers/spree/api/transfer_items_controller_spec.rb
|
322
|
+
- spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
|
323
|
+
- spec/controllers/spree/api/users_controller_spec.rb
|
324
|
+
- spec/controllers/spree/api/variants_controller_spec.rb
|
325
|
+
- spec/controllers/spree/api/zones_controller_spec.rb
|
326
|
+
- spec/features/checkout_spec.rb
|
327
|
+
- spec/fixtures/thinking-cat.jpg
|
328
|
+
- spec/models/spree/legacy_user_spec.rb
|
329
|
+
- spec/requests/rabl_cache_spec.rb
|
330
|
+
- spec/shared_examples/protect_product_actions.rb
|
331
|
+
- spec/spec_helper.rb
|
332
|
+
- spec/support/controller_hacks.rb
|
333
|
+
- spec/support/database_cleaner.rb
|
334
|
+
- spec/support/have_attributes_matcher.rb
|