Skip to content

Commit 33c0856

Browse files
committed
first commit
0 parents  commit 33c0856

File tree

20 files changed

+551
-0
lines changed

20 files changed

+551
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
\#*
2+
*~
3+
.#*
4+
.DS_Store
5+
.idea
6+
.project
7+
tmp
8+
nbproject
9+
*.swp
10+
spec/dummy
11+
pkg

.rspec

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--colour

Gemfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
source 'http://rubygems.org'
2+
3+
if RUBY_VERSION < '1.9'
4+
gem 'ruby-debug'
5+
else
6+
gem 'debugger'
7+
end
8+
9+
gemspec

Gemfile.lock

+237
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
PATH
2+
remote: .
3+
specs:
4+
spree_api_auth (0.0.1)
5+
spree_api (~> 1.1.3)
6+
spree_auth (~> 1.1.3)
7+
spree_core (~> 1.1.3)
8+
9+
GEM
10+
remote: http://rubygems.org/
11+
specs:
12+
actionmailer (3.2.8)
13+
actionpack (= 3.2.8)
14+
mail (~> 2.4.4)
15+
actionpack (3.2.8)
16+
activemodel (= 3.2.8)
17+
activesupport (= 3.2.8)
18+
builder (~> 3.0.0)
19+
erubis (~> 2.7.0)
20+
journey (~> 1.0.4)
21+
rack (~> 1.4.0)
22+
rack-cache (~> 1.2)
23+
rack-test (~> 0.6.1)
24+
sprockets (~> 2.1.3)
25+
active_utils (1.0.4)
26+
activesupport (>= 2.3.11)
27+
i18n
28+
activemerchant (1.20.4)
29+
active_utils (>= 1.0.2)
30+
activesupport (>= 2.3.11)
31+
braintree (>= 2.0.0)
32+
builder (>= 2.0.0)
33+
i18n
34+
json (>= 1.5.1)
35+
money (<= 3.7.1)
36+
activemodel (3.2.8)
37+
activesupport (= 3.2.8)
38+
builder (~> 3.0.0)
39+
activerecord (3.2.8)
40+
activemodel (= 3.2.8)
41+
activesupport (= 3.2.8)
42+
arel (~> 3.0.2)
43+
tzinfo (~> 0.3.29)
44+
activeresource (3.2.8)
45+
activemodel (= 3.2.8)
46+
activesupport (= 3.2.8)
47+
activesupport (3.2.8)
48+
i18n (~> 0.6)
49+
multi_json (~> 1.0)
50+
acts_as_list (0.1.4)
51+
addressable (2.3.2)
52+
arel (3.0.2)
53+
aws-sdk (1.3.9)
54+
httparty (~> 0.7)
55+
json (~> 1.4)
56+
nokogiri (>= 1.4.4)
57+
uuidtools (~> 2.1)
58+
bcrypt-ruby (3.0.1)
59+
braintree (2.16.0)
60+
builder (>= 2.0.0)
61+
builder (3.0.0)
62+
cancan (1.6.7)
63+
capybara (1.0.1)
64+
mime-types (>= 1.16)
65+
nokogiri (>= 1.3.3)
66+
rack (>= 1.0.0)
67+
rack-test (>= 0.5.4)
68+
selenium-webdriver (~> 2.0)
69+
xpath (~> 0.1.4)
70+
childprocess (0.3.5)
71+
ffi (~> 1.0, >= 1.0.6)
72+
cocaine (0.2.1)
73+
columnize (0.3.6)
74+
debugger (1.2.0)
75+
columnize (>= 0.3.1)
76+
debugger-linecache (~> 1.1.1)
77+
debugger-ruby_core_source (~> 1.1.3)
78+
debugger-linecache (1.1.2)
79+
debugger-ruby_core_source (>= 1.1.1)
80+
debugger-ruby_core_source (1.1.3)
81+
deface (0.9.1)
82+
nokogiri (~> 1.5.0)
83+
rails (~> 3.1)
84+
devise (2.0.4)
85+
bcrypt-ruby (~> 3.0)
86+
orm_adapter (~> 0.0.3)
87+
railties (~> 3.1)
88+
warden (~> 1.1.1)
89+
diff-lcs (1.1.3)
90+
erubis (2.7.0)
91+
factory_girl (2.6.4)
92+
activesupport (>= 2.3.9)
93+
ffaker (1.12.1)
94+
ffi (1.1.5)
95+
highline (1.6.11)
96+
hike (1.2.1)
97+
httparty (0.8.3)
98+
multi_json (~> 1.0)
99+
multi_xml
100+
i18n (0.6.0)
101+
journey (1.0.4)
102+
jquery-rails (2.0.3)
103+
railties (>= 3.1.0, < 5.0)
104+
thor (~> 0.14)
105+
json (1.7.5)
106+
kaminari (0.13.0)
107+
actionpack (>= 3.0.0)
108+
activesupport (>= 3.0.0)
109+
railties (>= 3.0.0)
110+
libwebsocket (0.1.5)
111+
addressable
112+
mail (2.4.4)
113+
i18n (>= 0.4.0)
114+
mime-types (~> 1.16)
115+
treetop (~> 1.4.8)
116+
mime-types (1.19)
117+
money (3.7.1)
118+
i18n (~> 0.4)
119+
multi_json (1.3.6)
120+
multi_xml (0.5.1)
121+
nested_set (1.7.0)
122+
activerecord (>= 3.0.0)
123+
railties (>= 3.0.0)
124+
nokogiri (1.5.5)
125+
orm_adapter (0.0.7)
126+
paperclip (2.7.0)
127+
activerecord (>= 2.3.0)
128+
activesupport (>= 2.3.2)
129+
cocaine (>= 0.0.2)
130+
mime-types
131+
polyamorous (0.5.0)
132+
activerecord (~> 3.0)
133+
polyglot (0.3.3)
134+
rabl (0.6.5)
135+
activesupport (>= 2.3.14)
136+
multi_json (~> 1.0)
137+
rack (1.4.1)
138+
rack-cache (1.2)
139+
rack (>= 0.4)
140+
rack-ssl (1.3.2)
141+
rack
142+
rack-test (0.6.1)
143+
rack (>= 1.0)
144+
rails (3.2.8)
145+
actionmailer (= 3.2.8)
146+
actionpack (= 3.2.8)
147+
activerecord (= 3.2.8)
148+
activeresource (= 3.2.8)
149+
activesupport (= 3.2.8)
150+
bundler (~> 1.0)
151+
railties (= 3.2.8)
152+
railties (3.2.8)
153+
actionpack (= 3.2.8)
154+
activesupport (= 3.2.8)
155+
rack-ssl (~> 1.3.2)
156+
rake (>= 0.8.7)
157+
rdoc (~> 3.4)
158+
thor (>= 0.14.6, < 2.0)
159+
rake (0.9.2.2)
160+
ransack (0.6.0)
161+
actionpack (~> 3.0)
162+
activerecord (~> 3.0)
163+
polyamorous (~> 0.5.0)
164+
rdoc (3.12)
165+
json (~> 1.4)
166+
rspec (2.11.0)
167+
rspec-core (~> 2.11.0)
168+
rspec-expectations (~> 2.11.0)
169+
rspec-mocks (~> 2.11.0)
170+
rspec-core (2.11.1)
171+
rspec-expectations (2.11.2)
172+
diff-lcs (~> 1.1.3)
173+
rspec-mocks (2.11.2)
174+
rspec-rails (2.11.0)
175+
actionpack (>= 3.0)
176+
activesupport (>= 3.0)
177+
railties (>= 3.0)
178+
rspec (~> 2.11.0)
179+
rubyzip (0.9.9)
180+
selenium-webdriver (2.25.0)
181+
childprocess (>= 0.2.5)
182+
libwebsocket (~> 0.1.3)
183+
multi_json (~> 1.0)
184+
rubyzip
185+
spree_api (1.1.3)
186+
rabl (= 0.6.5)
187+
spree_auth (= 1.1.3)
188+
spree_core (= 1.1.3)
189+
spree_auth (1.1.3)
190+
cancan (= 1.6.7)
191+
devise (~> 2.0.0)
192+
spree_core (= 1.1.3)
193+
spree_core (1.1.3)
194+
activemerchant (= 1.20.4)
195+
acts_as_list (= 0.1.4)
196+
aws-sdk (~> 1.3.4)
197+
deface (>= 0.9.0)
198+
ffaker (~> 1.12.0)
199+
highline (= 1.6.11)
200+
jquery-rails (~> 2.0.0)
201+
kaminari (>= 0.13.0)
202+
nested_set (= 1.7.0)
203+
paperclip (~> 2.7)
204+
rails (~> 3.2.6)
205+
ransack (~> 0.6.0)
206+
state_machine (= 1.1.2)
207+
stringex (~> 1.3.2)
208+
sprockets (2.1.3)
209+
hike (~> 1.2)
210+
rack (~> 1.0)
211+
tilt (~> 1.1, != 1.3.0)
212+
sqlite3 (1.3.6)
213+
state_machine (1.1.2)
214+
stringex (1.3.3)
215+
thor (0.16.0)
216+
tilt (1.3.3)
217+
treetop (1.4.10)
218+
polyglot
219+
polyglot (>= 0.3.1)
220+
tzinfo (0.3.33)
221+
uuidtools (2.1.3)
222+
warden (1.1.1)
223+
rack (>= 1.0)
224+
xpath (0.1.4)
225+
nokogiri (~> 1.3)
226+
227+
PLATFORMS
228+
ruby
229+
230+
DEPENDENCIES
231+
capybara (= 1.0.1)
232+
debugger
233+
factory_girl (~> 2.6.4)
234+
ffaker
235+
rspec-rails (~> 2.9)
236+
spree_api_auth!
237+
sqlite3

LICENSE

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright (c) 2012 [name of plugin creator]
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation
11+
and/or other materials provided with the distribution.
12+
* Neither the name Spree nor the names of its contributors may be used to
13+
endorse or promote products derived from this software without specific
14+
prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
SpreeApiAuth
2+
============
3+
4+
Introduction goes here.
5+
6+
7+
Example
8+
=======
9+
10+
Example goes here.
11+
12+
Testing
13+
-------
14+
15+
Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
16+
17+
$ bundle
18+
$ bundle exec rake test_app
19+
$ bundle exec rspec spec
20+
21+
Copyright (c) 2012 [name of extension creator], released under the New BSD License

Rakefile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
require 'rake'
2+
require 'rake/testtask'
3+
require 'rake/packagetask'
4+
require 'rubygems/package_task'
5+
require 'rspec/core/rake_task'
6+
require 'spree/core/testing_support/common_rake'
7+
8+
RSpec::Core::RakeTask.new
9+
10+
task :default => [:spec]
11+
12+
spec = eval(File.read('spree_api_auth.gemspec'))
13+
14+
Gem::PackageTask.new(spec) do |p|
15+
p.gem_spec = spec
16+
end
17+
18+
desc 'Release to gemcutter'
19+
task :release => :package do
20+
require 'rake/gemcutter'
21+
Rake::Gemcutter::Tasks.new(spec).define
22+
Rake::Task['gem:push'].invoke
23+
end
24+
25+
desc 'Generates a dummy app for testing'
26+
task :test_app do
27+
ENV['LIB_NAME'] = 'spree_api_auth'
28+
Rake::Task['common:test_app'].invoke
29+
end

Versionfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is used to designate compatibilty with different versions of Spree
2+
# Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
3+
4+
# Examples
5+
#
6+
# '1.2.x' => { :branch => 'master' }
7+
# '1.1.x' => { :branch => '1-1-stable' }
8+
# '1.0.x' => { :branch => '1-0-stable' }
9+
# '0.70.x' => { :branch => '0-70-stable' }
10+
# '0.40.x' => { :tag => 'v1.0.0', :version => '1.0.0' }
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Spree
2+
module Api
3+
module V1
4+
class UsersController < Spree::Api::V1::BaseController
5+
before_filter :check_for_api_key, :except => [:sign_up, :sign_in]
6+
7+
def sign_up
8+
@user = Spree::User.new(params[:user])
9+
if !@user.save
10+
unauthorized
11+
return
12+
end
13+
@user.generate_api_key!
14+
end
15+
16+
def sign_in
17+
@user = Spree::User.find_by_email(params[:user][:email])
18+
if !@user.present? || !@user.valid_password?(params[:user][:password])
19+
unauthorized
20+
return
21+
end
22+
end
23+
24+
end
25+
end
26+
end
27+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
object @user
2+
attributes :id, :api_key, :email
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
object @user
2+
attributes :id, :api_key, :email

config/locales/en.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Sample localization file for English. Add more files in this directory for other locales.
2+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3+
4+
en:
5+
hello: "Hello world"

0 commit comments

Comments
 (0)