spree_api 1.1.6 → 1.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/Gemfile +0 -1
  2. data/app/controllers/spree/api/v1/addresses_controller.rb +0 -2
  3. data/app/controllers/spree/api/v1/base_controller.rb +2 -13
  4. data/app/controllers/spree/api/v1/images_controller.rb +0 -3
  5. data/app/controllers/spree/api/v1/orders_controller.rb +1 -2
  6. data/app/controllers/spree/api/v1/shipments_controller.rb +0 -3
  7. data/app/helpers/spree/api/api_helpers.rb +2 -2
  8. data/app/models/spree/user_decorator.rb +10 -8
  9. data/app/views/spree/admin/users/_api_fields.html.erb +2 -2
  10. data/app/views/spree/api/v1/orders/show.rabl +1 -4
  11. data/db/migrate/20100107141738_add_api_key_to_spree_users.rb +3 -1
  12. data/db/migrate/20120411123334_resize_api_key_field.rb +3 -1
  13. data/db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb +7 -0
  14. data/lib/spree/api.rb +0 -1
  15. data/lib/spree/api/testing_support/helpers.rb +2 -2
  16. data/lib/spree/api/testing_support/setup.rb +2 -2
  17. data/script/rails +1 -0
  18. data/spec/controllers/spree/api/v1/addresses_controller_spec.rb +7 -29
  19. data/spec/controllers/spree/api/v1/images_controller_spec.rb +31 -41
  20. data/spec/controllers/spree/api/v1/orders_controller_spec.rb +2 -9
  21. data/spec/controllers/spree/api/v1/payments_controller_spec.rb +1 -1
  22. data/spec/controllers/spree/api/v1/shipments_controller_spec.rb +2 -16
  23. data/spec/controllers/spree/api/v1/taxons_controller_spec.rb +3 -3
  24. data/spec/models/spree/legacy_user_spec.rb +19 -0
  25. data/spec/models/spree/order_spec.rb +1 -1
  26. data/spree_api.gemspec +0 -1
  27. metadata +25 -45
  28. data/app/controllers/spree/admin/users_controller_decorator.rb +0 -17
  29. data/app/models/spree/payment_decorator.rb +0 -0
  30. data/spec/models/spree/user_spec.rb +0 -19
data/Gemfile CHANGED
@@ -1,6 +1,5 @@
1
1
  eval(File.read(File.dirname(__FILE__) + '/../common_spree_dependencies.rb'))
2
2
 
3
3
  gem 'spree_core', :path => "../core"
4
- gem 'spree_auth', :path => "../auth"
5
4
 
6
5
  gemspec
@@ -4,12 +4,10 @@ module Spree
4
4
  class AddressesController < Spree::Api::V1::BaseController
5
5
  def show
6
6
  @address = Address.find(params[:id])
7
- authorize! :read, @address
8
7
  end
9
8
 
10
9
  def update
11
10
  @address = Address.find(params[:id])
12
- authorize! :read, @address
13
11
  @address.update_attributes(params[:address])
14
12
  render :show, :status => 200
15
13
  end
@@ -6,7 +6,6 @@ module Spree
6
6
 
7
7
  attr_accessor :current_api_user
8
8
 
9
- before_filter :set_content_type
10
9
  before_filter :check_for_api_key
11
10
  before_filter :authenticate_user
12
11
 
@@ -26,22 +25,12 @@ module Spree
26
25
 
27
26
  private
28
27
 
29
- def set_content_type
30
- content_type = case params[:format]
31
- when "json"
32
- "application/json"
33
- when "xml"
34
- "text/xml"
35
- end
36
- headers["Content-Type"] = content_type
37
- end
38
-
39
28
  def check_for_api_key
40
29
  render "spree/api/v1/errors/must_specify_api_key", :status => 401 and return if api_key.blank?
41
30
  end
42
31
 
43
32
  def authenticate_user
44
- unless @current_api_user = User.find_by_api_key(api_key.to_s)
33
+ unless @current_api_user = Spree.user_class.find_by_spree_api_key(api_key)
45
34
  render "spree/api/v1/errors/invalid_api_key", :status => 401 and return
46
35
  end
47
36
  end
@@ -77,7 +66,7 @@ module Spree
77
66
  end
78
67
 
79
68
  def product_scope
80
- if current_api_user.has_role?("admin")
69
+ if current_api_user.has_spree_role?("admin")
81
70
  scope = Product
82
71
  unless params[:show_deleted]
83
72
  scope = scope.not_deleted
@@ -7,20 +7,17 @@ module Spree
7
7
  end
8
8
 
9
9
  def create
10
- authorize! :create, Image
11
10
  @image = Image.create(params[:image])
12
11
  render :show, :status => 201
13
12
  end
14
13
 
15
14
  def update
16
- authorize! :update, Image
17
15
  @image = Image.find(params[:id])
18
16
  @image.update_attributes(params[:image])
19
17
  render :show, :status => 200
20
18
  end
21
19
 
22
20
  def destroy
23
- authorize! :delete, Image
24
21
  @image = Image.find(params[:id])
25
22
  @image.destroy
26
23
  render :text => nil
@@ -7,7 +7,7 @@ module Spree
7
7
 
8
8
  def index
9
9
  # should probably look at turning this into a CanCan step
10
- raise CanCan::AccessDenied unless current_api_user.has_role?("admin")
10
+ raise CanCan::AccessDenied unless current_api_user.has_spree_role?("admin")
11
11
  @orders = Order.page(params[:page]).per(params[:per_page])
12
12
  end
13
13
 
@@ -57,7 +57,6 @@ module Spree
57
57
  end
58
58
 
59
59
  def empty
60
- authorize! :read, order
61
60
  order.line_items.destroy_all
62
61
  order.update!
63
62
  render :text => nil, :status => 200
@@ -6,7 +6,6 @@ module Spree
6
6
  before_filter :find_and_update_shipment, :only => [:ship, :ready]
7
7
 
8
8
  def ready
9
- authorize! :read, Shipment
10
9
  unless @shipment.ready?
11
10
  @shipment.ready!
12
11
  end
@@ -14,7 +13,6 @@ module Spree
14
13
  end
15
14
 
16
15
  def ship
17
- authorize! :read, Shipment
18
16
  unless @shipment.shipped?
19
17
  @shipment.ship!
20
18
  end
@@ -25,7 +23,6 @@ module Spree
25
23
 
26
24
  def find_order
27
25
  @order = Spree::Order.find_by_number!(params[:order_id])
28
- authorize! :read, @order
29
26
  end
30
27
 
31
28
  def find_and_update_shipment
@@ -12,7 +12,7 @@ module Spree
12
12
  end
13
13
 
14
14
  def product_attributes
15
- [:id, :name, :description, :price, :available_on, :permalink,
15
+ [:id, :name, :description, :price, :available_on, :permalink,
16
16
  :count_on_hand, :meta_description, :meta_keywords, :taxon_ids]
17
17
  end
18
18
 
@@ -33,7 +33,7 @@ module Spree
33
33
  end
34
34
 
35
35
  def order_attributes
36
- [:id, :number, :item_total, :total, :state, :adjustment_total, :credit_total, :user_id, :created_at, :updated_at, :completed_at, :payment_total, :shipment_state, :payment_state, :email, :special_instructions]
36
+ [:id, :number, :item_total, :total, :state, :adjustment_total, :user_id, :created_at, :updated_at, :completed_at, :payment_total, :shipment_state, :payment_state, :email, :special_instructions]
37
37
  end
38
38
 
39
39
  def line_item_attributes
@@ -1,11 +1,13 @@
1
- Spree::User.class_eval do
2
- def generate_api_key!
3
- self.api_key = SecureRandom.hex(24)
4
- save!
5
- end
1
+ if Spree.user_class
2
+ Spree.user_class.class_eval do
3
+ def generate_spree_api_key!
4
+ self.spree_api_key = SecureRandom.hex(24)
5
+ save!
6
+ end
6
7
 
7
- def clear_api_key!
8
- self.api_key = nil
9
- save!
8
+ def clear_spree_api_key!
9
+ self.spree_api_key = nil
10
+ save!
11
+ end
10
12
  end
11
13
  end
@@ -1,7 +1,7 @@
1
1
  <h2><%= t('access', :scope => 'spree.api') %></h2>
2
2
 
3
- <% if @user.api_key.present? %>
4
- <p><strong><%= t('key', :scope => 'spree.api') %></strong> <%= @user.api_key %></p>
3
+ <% if @user.spree_api_key.present? %>
4
+ <p><strong><%= t('key', :scope => 'spree.api') %></strong> <%= @user.spree_api_key %></p>
5
5
 
6
6
  <%= form_tag spree.clear_api_key_admin_user_path(@user), :method => :put do %>
7
7
  <%= button t('clear_key', :scope => 'spree.api') %>
@@ -1,9 +1,6 @@
1
1
  object @order
2
2
  attributes *order_attributes
3
-
4
- if lookup_context.find_all("spree/api/v1/orders/#{@order.state}").present?
5
- extends "spree/api/v1/orders/#{@order.state}"
6
- end
3
+ extends "spree/api/v1/orders/#{@order.state}"
7
4
 
8
5
  child :billing_address => :bill_address do
9
6
  extends "spree/api/v1/addresses/show"
@@ -1,5 +1,7 @@
1
1
  class AddApiKeyToSpreeUsers < ActiveRecord::Migration
2
2
  def change
3
- add_column :spree_users, :api_key, :string, :limit => 40
3
+ unless defined?(User)
4
+ add_column :spree_users, :api_key, :string, :limit => 40
5
+ end
4
6
  end
5
7
  end
@@ -1,5 +1,7 @@
1
1
  class ResizeApiKeyField < ActiveRecord::Migration
2
2
  def change
3
- change_column :spree_users, :api_key, :string, :limit => 48
3
+ unless defined?(User)
4
+ change_column :spree_users, :api_key, :string, :limit => 48
5
+ end
4
6
  end
5
7
  end
@@ -0,0 +1,7 @@
1
+ class RenameApiKeyToSpreeApiKey < ActiveRecord::Migration
2
+ def change
3
+ unless defined?(User)
4
+ rename_column :spree_users, :api_key, :spree_api_key
5
+ end
6
+ end
7
+ end
@@ -1,5 +1,4 @@
1
1
  require 'spree/core'
2
- require 'spree/auth'
3
2
 
4
3
  require 'spree/api/controller_setup'
5
4
 
@@ -13,13 +13,13 @@ module Spree
13
13
 
14
14
  def stub_authentication!
15
15
  controller.stub :check_for_api_key
16
- Spree::User.stub :find_by_api_key => current_api_user
16
+ Spree::LegacyUser.stub :find_by_spree_api_key => current_api_user
17
17
  end
18
18
 
19
19
  # This method can be overriden (with a let block) inside a context
20
20
  # For instance, if you wanted to have an admin user instead.
21
21
  def current_api_user
22
- @current_api_user ||= stub_model(Spree::User, :email => "spree@example.com")
22
+ @current_api_user ||= stub_model(Spree::LegacyUser, :email => "spree@example.com")
23
23
  end
24
24
 
25
25
  def image(filename)
@@ -4,8 +4,8 @@ module Spree
4
4
  module Setup
5
5
  def sign_in_as_admin!
6
6
  let!(:current_api_user) do
7
- user = stub_model(Spree::User)
8
- user.should_receive(:has_role?).any_number_of_times.with("admin").and_return(true)
7
+ user = stub_model(Spree::LegacyUser)
8
+ user.should_receive(:has_spree_role?).any_number_of_times.with("admin").and_return(true)
9
9
  user
10
10
  end
11
11
  end
@@ -6,3 +6,4 @@ ENGINE_PATH = File.expand_path('../../lib/spree/api/engine', __FILE__)
6
6
 
7
7
  require 'rails/all'
8
8
  require 'rails/engine/commands'
9
+
@@ -9,37 +9,15 @@ module Spree
9
9
  @address = create(:address)
10
10
  end
11
11
 
12
- context "with their own address" do
13
- before do
14
- Address.any_instance.stub :user => current_api_user
15
- end
16
-
17
- it "gets an address" do
18
- api_get :show, :id => @address.id
19
- json_response['address']['address1'].should eq @address.address1
20
- end
21
-
22
- it "updates an address" do
23
- api_put :update, :id => @address.id,
24
- :address => { :address1 => "123 Test Lane" }
25
- json_response['address']['address1'].should eq '123 Test Lane'
26
- end
12
+ it "gets an address" do
13
+ api_get :show, :id => @address.id
14
+ json_response['address']['address1'].should eq @address.address1
27
15
  end
28
16
 
29
- context "on somebody else's address" do
30
- before do
31
- Address.any_instance.stub :user => stub_model(Spree::User)
32
- end
33
-
34
- it "cannot retreive address information" do
35
- api_get :show, :id => @address.id
36
- assert_unauthorized!
37
- end
38
-
39
- it "cannot update address information" do
40
- api_get :update, :id => @address.id
41
- assert_unauthorized!
42
- end
17
+ it "updates an address" do
18
+ api_put :update, :id => @address.id,
19
+ :address => { :address1 => "123 Test Lane" }
20
+ json_response['address']['address1'].should eq '123 Test Lane'
43
21
  end
44
22
  end
45
23
  end
@@ -13,53 +13,43 @@ module Spree
13
13
  stub_authentication!
14
14
  end
15
15
 
16
- context "as an admin" do
17
- sign_in_as_admin!
18
-
19
- it "can upload a new image for a variant" do
20
- lambda do
21
- api_post :create,
22
- :image => { :attachment => upload_image('thinking-cat.jpg'),
23
- :viewable_type => 'Spree::Variant',
24
- :viewable_id => product.master.to_param }
25
- response.status.should == 201
26
- json_response.should have_attributes(attributes)
27
- end.should change(Image, :count).by(1)
28
- end
29
-
30
- context "working with an existing image" do
31
- let!(:product_image) { product.master.images.create!(:attachment => image('thinking-cat.jpg')) }
32
-
33
- it "can update image data" do
34
- product_image.position.should == 1
35
- api_post :update, :image => { :position => 2 }, :id => product_image.id
36
- response.status.should == 200
37
- json_response.should have_attributes(attributes)
38
- product_image.reload.position.should == 2
39
- end
16
+ it "can upload a new image for a product" do
17
+ lambda do
18
+ api_post :create,
19
+ :image => { :attachment => upload_image("thinking-cat.jpg"),
20
+ :viewable_type => 'Spree::Product',
21
+ :viewable_id => product.id }
22
+ response.status.should == 201
23
+ json_response.should have_attributes(attributes)
24
+ end.should change(Image, :count).by(1)
25
+ end
40
26
 
41
- it "can delete an image" do
42
- api_delete :destroy, :id => product_image.id
43
- response.status.should == 200
44
- lambda { product_image.reload }.should raise_error(ActiveRecord::RecordNotFound)
45
- end
46
- end
27
+ it "can upload a new image for a variant" do
28
+ lambda do
29
+ api_post :create,
30
+ :image => { :attachment => upload_image("thinking-cat.jpg"),
31
+ :viewable_type => 'Spree::Variant',
32
+ :viewable_id => product.master.to_param }
33
+ response.status.should == 201
34
+ json_response.should have_attributes(attributes)
35
+ end.should change(Image, :count).by(1)
47
36
  end
48
37
 
49
- context "as a non-admin" do
50
- it "cannot create an image" do
51
- api_post :create
52
- assert_unauthorized!
53
- end
38
+ context "working with an existing image" do
39
+ let!(:product_image) { product.master.images.create!(:attachment => image("thinking-cat.jpg")) }
54
40
 
55
- it "cannot update an image" do
56
- api_put :update, :id => 1
57
- assert_unauthorized!
41
+ it "can update image data" do
42
+ product_image.position.should == 1
43
+ api_post :update, :image => { :position => 2 }, :id => product_image.id
44
+ response.status.should == 200
45
+ json_response.should have_attributes(attributes)
46
+ product_image.reload.position.should == 2
58
47
  end
59
48
 
60
- it "cannot delete an image" do
61
- api_delete :destroy, :id => 1
62
- assert_unauthorized!
49
+ it "can delete an image" do
50
+ api_delete :destroy, :id => product_image.id
51
+ response.status.should == 200
52
+ lambda { product_image.reload }.should raise_error(ActiveRecord::RecordNotFound)
63
53
  end
64
54
  end
65
55
  end
@@ -6,7 +6,7 @@ module Spree
6
6
 
7
7
  let!(:order) { create(:order) }
8
8
  let(:attributes) { [:number, :item_total, :total,
9
- :state, :adjustment_total, :credit_total,
9
+ :state, :adjustment_total,
10
10
  :user_id, :created_at, :updated_at,
11
11
  :completed_at, :payment_total, :shipment_state,
12
12
  :payment_state, :email, :special_instructions] }
@@ -28,15 +28,8 @@ module Spree
28
28
  json_response.should have_attributes(attributes)
29
29
  end
30
30
 
31
- # Regression test for #1992
32
- it "can view an order not in a standard state" do
33
- Order.any_instance.stub :user => current_api_user
34
- order.update_column(:state, 'shipped')
35
- api_get :show, :id => order.to_param
36
- end
37
-
38
31
  it "can not view someone else's order" do
39
- Order.any_instance.stub :user => stub_model(User)
32
+ Order.any_instance.stub :user => stub_model(Spree::LegacyUser)
40
33
  api_get :show, :id => order.to_param
41
34
  assert_unauthorized!
42
35
  end
@@ -50,7 +50,7 @@ module Spree
50
50
 
51
51
  context "when the order does not belong to the user" do
52
52
  before do
53
- Order.any_instance.stub :user => stub_model(User)
53
+ Order.any_instance.stub :user => stub_model(LegacyUser)
54
54
  end
55
55
 
56
56
  it "cannot view payments for somebody else's order" do
@@ -9,22 +9,8 @@ describe Spree::Api::V1::ShipmentsController do
9
9
  stub_authentication!
10
10
  end
11
11
 
12
- let!(:resource_scoping) { { :order_id => shipment.order.to_param, :id => shipment.to_param } }
13
-
14
- context "as a non-admin" do
15
- it "cannot make a shipment ready" do
16
- api_put :ready
17
- assert_unauthorized!
18
- end
19
-
20
- it "cannot make a shipment shipped" do
21
- api_put :ship
22
- assert_unauthorized!
23
- end
24
- end
25
-
26
- context "as an admin" do
27
- sign_in_as_admin!
12
+ context "working with a shipment" do
13
+ let!(:resource_scoping) { { :order_id => shipment.order.to_param, :id => shipment.to_param } }
28
14
 
29
15
  it "can make a shipment ready" do
30
16
  api_put :ready
@@ -4,9 +4,9 @@ module Spree
4
4
  describe Api::V1::TaxonsController do
5
5
  render_views
6
6
 
7
- let(:taxonomy) { create(:taxonomy) }
8
- let(:taxon) { create(:taxon, :name => "Ruby", :taxonomy => taxonomy) }
9
- let(:taxon2) { create(:taxon, :name => "Rails", :taxonomy => taxonomy) }
7
+ let(:taxonomy) { Factory(:taxonomy) }
8
+ let(:taxon) { Factory(:taxon, :name => "Ruby", :taxonomy => taxonomy) }
9
+ let(:taxon2) { Factory(:taxon, :name => "Rails", :taxonomy => taxonomy) }
10
10
  let(:attributes) { ["id", "name", "permalink", "position", "parent_id", "taxonomy_id"] }
11
11
 
12
12
  before do
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ module Spree
4
+ describe LegacyUser do
5
+ let(:user) { LegacyUser.new }
6
+
7
+ it "can generate an API key" do
8
+ user.should_receive(:save!)
9
+ user.generate_spree_api_key!
10
+ user.spree_api_key.should_not be_blank
11
+ end
12
+
13
+ it "can clear an API key" do
14
+ user.should_receive(:save!)
15
+ user.clear_spree_api_key!
16
+ user.spree_api_key.should be_blank
17
+ end
18
+ end
19
+ end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module Spree
4
4
  describe Order do
5
- let(:user) { stub_model(User) }
5
+ let(:user) { stub_model(LegacyUser) }
6
6
 
7
7
  it 'can build an order from API parameters' do
8
8
  product = Spree::Product.create!(:name => 'Test', :sku => 'TEST-1', :price => 33.22)
@@ -16,7 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.version = version
17
17
 
18
18
  gem.add_dependency 'spree_core', version
19
- gem.add_dependency 'spree_auth', version
20
19
  gem.add_dependency 'rabl', '0.6.5'
21
20
 
22
21
  gem.add_development_dependency 'rspec-rails', '2.9.0'
metadata CHANGED
@@ -1,91 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_api
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.1.6
4
+ version: 1.2.0.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan Bigg
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000 Z
12
+ date: 2012-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- type: :runtime
16
- version_requirements: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - '='
20
- - !ruby/object:Gem::Version
21
- version: 1.1.6
22
15
  name: spree_core
23
- prerelease: false
24
16
  requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
18
  requirements:
27
19
  - - '='
28
20
  - !ruby/object:Gem::Version
29
- version: 1.1.6
30
- - !ruby/object:Gem::Dependency
21
+ version: 1.2.0.rc1
31
22
  type: :runtime
32
- version_requirements: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - '='
36
- - !ruby/object:Gem::Version
37
- version: 1.1.6
38
- name: spree_auth
39
23
  prerelease: false
40
- requirement: !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
41
25
  none: false
42
26
  requirements:
43
27
  - - '='
44
28
  - !ruby/object:Gem::Version
45
- version: 1.1.6
29
+ version: 1.2.0.rc1
46
30
  - !ruby/object:Gem::Dependency
47
- type: :runtime
48
- version_requirements: !ruby/object:Gem::Requirement
31
+ name: rabl
32
+ requirement: !ruby/object:Gem::Requirement
49
33
  none: false
50
34
  requirements:
51
35
  - - '='
52
36
  - !ruby/object:Gem::Version
53
37
  version: 0.6.5
54
- name: rabl
38
+ type: :runtime
55
39
  prerelease: false
56
- requirement: !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
57
41
  none: false
58
42
  requirements:
59
43
  - - '='
60
44
  - !ruby/object:Gem::Version
61
45
  version: 0.6.5
62
46
  - !ruby/object:Gem::Dependency
63
- type: :development
64
- version_requirements: !ruby/object:Gem::Requirement
47
+ name: rspec-rails
48
+ requirement: !ruby/object:Gem::Requirement
65
49
  none: false
66
50
  requirements:
67
51
  - - '='
68
52
  - !ruby/object:Gem::Version
69
53
  version: 2.9.0
70
- name: rspec-rails
54
+ type: :development
71
55
  prerelease: false
72
- requirement: !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
73
57
  none: false
74
58
  requirements:
75
59
  - - '='
76
60
  - !ruby/object:Gem::Version
77
61
  version: 2.9.0
78
62
  - !ruby/object:Gem::Dependency
79
- type: :development
80
- version_requirements: !ruby/object:Gem::Requirement
63
+ name: database_cleaner
64
+ requirement: !ruby/object:Gem::Requirement
81
65
  none: false
82
66
  requirements:
83
67
  - - ! '>='
84
68
  - !ruby/object:Gem::Version
85
69
  version: '0'
86
- name: database_cleaner
70
+ type: :development
87
71
  prerelease: false
88
- requirement: !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
89
73
  none: false
90
74
  requirements:
91
75
  - - ! '>='
@@ -102,7 +86,6 @@ files:
102
86
  - Gemfile
103
87
  - LICENSE
104
88
  - Rakefile
105
- - app/controllers/spree/admin/users_controller_decorator.rb
106
89
  - app/controllers/spree/api/v1/addresses_controller.rb
107
90
  - app/controllers/spree/api/v1/base_controller.rb
108
91
  - app/controllers/spree/api/v1/countries_controller.rb
@@ -120,7 +103,6 @@ files:
120
103
  - app/models/spree/line_item_decorator.rb
121
104
  - app/models/spree/option_value_decorator.rb
122
105
  - app/models/spree/order_decorator.rb
123
- - app/models/spree/payment_decorator.rb
124
106
  - app/models/spree/user_decorator.rb
125
107
  - app/overrides/api_admin_user_edit_form.rb
126
108
  - app/views/spree/admin/users/_api_fields.html.erb
@@ -174,6 +156,7 @@ files:
174
156
  - config/routes.rb
175
157
  - db/migrate/20100107141738_add_api_key_to_spree_users.rb
176
158
  - db/migrate/20120411123334_resize_api_key_field.rb
159
+ - db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb
177
160
  - lib/spree/api.rb
178
161
  - lib/spree/api/controller_setup.rb
179
162
  - lib/spree/api/engine.rb
@@ -196,8 +179,8 @@ files:
196
179
  - spec/controllers/spree/api/v1/variants_controller_spec.rb
197
180
  - spec/controllers/spree/api/v1/zones_controller_spec.rb
198
181
  - spec/fixtures/thinking-cat.jpg
182
+ - spec/models/spree/legacy_user_spec.rb
199
183
  - spec/models/spree/order_spec.rb
200
- - spec/models/spree/user_spec.rb
201
184
  - spec/spec_helper.rb
202
185
  - spec/support/controller_hacks.rb
203
186
  - spec/support/database_cleaner.rb
@@ -214,19 +197,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
197
  requirements:
215
198
  - - ! '>='
216
199
  - !ruby/object:Gem::Version
200
+ version: '0'
217
201
  segments:
218
202
  - 0
219
- hash: -2398953299128676409
220
- version: '0'
203
+ hash: -4054632363792620125
221
204
  required_rubygems_version: !ruby/object:Gem::Requirement
222
205
  none: false
223
206
  requirements:
224
- - - ! '>='
207
+ - - ! '>'
225
208
  - !ruby/object:Gem::Version
226
- segments:
227
- - 0
228
- hash: -2398953299128676409
229
- version: '0'
209
+ version: 1.3.1
230
210
  requirements: []
231
211
  rubyforge_project:
232
212
  rubygems_version: 1.8.23
@@ -248,8 +228,8 @@ test_files:
248
228
  - spec/controllers/spree/api/v1/variants_controller_spec.rb
249
229
  - spec/controllers/spree/api/v1/zones_controller_spec.rb
250
230
  - spec/fixtures/thinking-cat.jpg
231
+ - spec/models/spree/legacy_user_spec.rb
251
232
  - spec/models/spree/order_spec.rb
252
- - spec/models/spree/user_spec.rb
253
233
  - spec/spec_helper.rb
254
234
  - spec/support/controller_hacks.rb
255
235
  - spec/support/database_cleaner.rb
@@ -1,17 +0,0 @@
1
- Spree::Admin::UsersController.class_eval do
2
- before_filter :load_roles, :only => [:edit, :new, :update, :create, :generate_api_key, :clear_api_key]
3
-
4
- def generate_api_key
5
- if @user.generate_api_key!
6
- flash.notice = t('key_generated', :scope => 'spree.api')
7
- end
8
- redirect_to edit_admin_user_path(@user)
9
- end
10
-
11
- def clear_api_key
12
- if @user.clear_api_key!
13
- flash.notice = t('key_cleared', :scope => 'spree.api')
14
- end
15
- redirect_to edit_admin_user_path(@user)
16
- end
17
- end
File without changes
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Spree
4
- describe User do
5
- let(:user) { User.new }
6
-
7
- it "can generate an API key" do
8
- user.should_receive(:save!)
9
- user.generate_api_key!
10
- user.api_key.should_not be_blank
11
- end
12
-
13
- it "can clear an API key" do
14
- user.should_receive(:save!)
15
- user.clear_api_key!
16
- user.api_key.should be_blank
17
- end
18
- end
19
- end