dailycred 0.1.461 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +2 -2
  3. data/README.md +43 -15
  4. data/Rakefile +2 -2
  5. data/app/controllers/sessions_controller.rb +1 -1
  6. data/app/views/sessions/info.html.erb +2 -2
  7. data/config/routes.rb +4 -4
  8. data/dailycred.gemspec +1 -1
  9. data/dummy-preauth/.gitignore +16 -0
  10. data/dummy-preauth/Gemfile +42 -0
  11. data/dummy-preauth/README.rdoc +28 -0
  12. data/dummy-preauth/Rakefile +6 -0
  13. data/dummy-preauth/app/assets/images/rails.png +0 -0
  14. data/dummy-preauth/app/assets/javascripts/application.js +16 -0
  15. data/{dummy/app/assets/javascripts/posts.js.coffee → dummy-preauth/app/assets/javascripts/welcome.js.coffee} +1 -1
  16. data/dummy-preauth/app/assets/stylesheets/application.css +13 -0
  17. data/{dummy/app/assets/stylesheets/posts.css.scss → dummy-preauth/app/assets/stylesheets/welcome.css.scss} +1 -1
  18. data/dummy-preauth/app/controllers/application_controller.rb +6 -0
  19. data/{dummy/app/mailers/.gitkeep → dummy-preauth/app/controllers/concerns/.keep} +0 -0
  20. data/dummy-preauth/app/controllers/sessions_controller.rb +34 -0
  21. data/dummy-preauth/app/controllers/users_controller.rb +30 -0
  22. data/dummy-preauth/app/controllers/welcome_controller.rb +9 -0
  23. data/dummy-preauth/app/helpers/application_helper.rb +2 -0
  24. data/dummy-preauth/app/helpers/sessions_helper.rb +2 -0
  25. data/dummy-preauth/app/helpers/users_helper.rb +2 -0
  26. data/dummy-preauth/app/helpers/welcome_helper.rb +2 -0
  27. data/{dummy/app/models/.gitkeep → dummy-preauth/app/mailers/.keep} +0 -0
  28. data/{dummy/lib/assets/.gitkeep → dummy-preauth/app/models/.keep} +0 -0
  29. data/{dummy/lib/tasks/.gitkeep → dummy-preauth/app/models/concerns/.keep} +0 -0
  30. data/dummy-preauth/app/models/user.rb +34 -0
  31. data/dummy-preauth/app/views/layouts/application.html.erb +14 -0
  32. data/dummy-preauth/app/views/sessions/new.html.erb +15 -0
  33. data/dummy-preauth/app/views/users/_form.html.erb +20 -0
  34. data/dummy-preauth/app/views/users/edit.html.erb +3 -0
  35. data/dummy-preauth/app/views/users/new.html.erb +5 -0
  36. data/dummy-preauth/app/views/welcome/index.html.erb +2 -0
  37. data/dummy-preauth/bin/bundle +3 -0
  38. data/dummy-preauth/bin/rails +4 -0
  39. data/dummy-preauth/bin/rake +4 -0
  40. data/dummy-preauth/config.ru +4 -0
  41. data/dummy-preauth/config/application.rb +22 -0
  42. data/dummy-preauth/config/boot.rb +4 -0
  43. data/dummy-preauth/config/database.yml +25 -0
  44. data/dummy-preauth/config/environment.rb +5 -0
  45. data/dummy-preauth/config/environments/development.rb +27 -0
  46. data/dummy-preauth/config/environments/production.rb +80 -0
  47. data/dummy-preauth/config/environments/test.rb +36 -0
  48. data/dummy-preauth/config/initializers/backtrace_silencers.rb +7 -0
  49. data/dummy-preauth/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/dummy-preauth/config/initializers/inflections.rb +16 -0
  51. data/dummy-preauth/config/initializers/mime_types.rb +5 -0
  52. data/dummy-preauth/config/initializers/omniauth.rb +9 -0
  53. data/dummy-preauth/config/initializers/secret_token.rb +12 -0
  54. data/dummy-preauth/config/initializers/session_store.rb +3 -0
  55. data/dummy-preauth/config/initializers/wrap_parameters.rb +14 -0
  56. data/dummy-preauth/config/locales/en.yml +23 -0
  57. data/dummy-preauth/config/routes.rb +57 -0
  58. data/dummy-preauth/db/migrate/20130423011519_create_users.rb +15 -0
  59. data/dummy-preauth/db/migrate/20130423011738_add_uuid_to_users.rb +5 -0
  60. data/dummy-preauth/db/schema.rb +26 -0
  61. data/dummy-preauth/db/seeds.rb +7 -0
  62. data/{dummy/log/.gitkeep → dummy-preauth/lib/assets/.keep} +0 -0
  63. data/dummy-preauth/lib/controller_authentication.rb +48 -0
  64. data/{dummy/test/fixtures/.gitkeep → dummy-preauth/lib/tasks/.keep} +0 -0
  65. data/{dummy/test/functional/.gitkeep → dummy-preauth/log/.keep} +0 -0
  66. data/dummy-preauth/public/404.html +27 -0
  67. data/dummy-preauth/public/422.html +26 -0
  68. data/dummy-preauth/public/500.html +26 -0
  69. data/{dummy/test/integration/.gitkeep → dummy-preauth/public/favicon.ico} +0 -0
  70. data/dummy-preauth/public/robots.txt +5 -0
  71. data/{dummy/test/unit/.gitkeep → dummy-preauth/test/controllers/.keep} +0 -0
  72. data/dummy-preauth/test/controllers/welcome_controller_test.rb +9 -0
  73. data/{dummy/vendor/assets/javascripts/.gitkeep → dummy-preauth/test/fixtures/.keep} +0 -0
  74. data/dummy-preauth/test/fixtures/users.yml +12 -0
  75. data/dummy-preauth/test/functional/sessions_controller_test.rb +22 -0
  76. data/dummy-preauth/test/functional/users_controller_test.rb +51 -0
  77. data/{dummy/vendor/assets/stylesheets/.gitkeep → dummy-preauth/test/helpers/.keep} +0 -0
  78. data/dummy-preauth/test/helpers/welcome_helper_test.rb +4 -0
  79. data/{dummy/vendor/plugins/.gitkeep → dummy-preauth/test/integration/.keep} +0 -0
  80. data/dummy-preauth/test/mailers/.keep +0 -0
  81. data/dummy-preauth/test/models/.keep +0 -0
  82. data/dummy-preauth/test/test_helper.rb +15 -0
  83. data/dummy-preauth/test/unit/user_test.rb +86 -0
  84. data/dummy-preauth/vendor/assets/javascripts/.keep +0 -0
  85. data/dummy-preauth/vendor/assets/stylesheets/.keep +0 -0
  86. data/dummy/.gitignore +3 -2
  87. data/dummy/Gemfile +14 -28
  88. data/dummy/README.rdoc +15 -248
  89. data/dummy/Rakefile +0 -1
  90. data/dummy/app/assets/javascripts/application.js +2 -1
  91. data/dummy/app/controllers/application_controller.rb +5 -4
  92. data/dummy/app/controllers/concerns/.keep +0 -0
  93. data/dummy/app/mailers/.keep +0 -0
  94. data/dummy/app/models/.keep +0 -0
  95. data/dummy/app/models/concerns/.keep +0 -0
  96. data/dummy/app/views/layouts/application.html.erb +2 -6
  97. data/dummy/bin/bundle +3 -0
  98. data/dummy/bin/rails +4 -0
  99. data/dummy/bin/rake +4 -0
  100. data/dummy/config/application.rb +2 -42
  101. data/dummy/config/boot.rb +0 -2
  102. data/dummy/config/environment.rb +2 -2
  103. data/dummy/config/environments/development.rb +9 -19
  104. data/dummy/config/environments/production.rb +40 -27
  105. data/dummy/config/environments/test.rb +12 -13
  106. data/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  107. data/dummy/config/initializers/inflections.rb +6 -5
  108. data/dummy/config/initializers/omniauth.rb +9 -2
  109. data/dummy/config/initializers/secret_token.rb +6 -1
  110. data/dummy/config/initializers/session_store.rb +1 -6
  111. data/dummy/config/initializers/wrap_parameters.rb +6 -6
  112. data/dummy/config/locales/en.yml +20 -2
  113. data/dummy/config/routes.rb +15 -26
  114. data/dummy/db/migrate/{20120925172903_create_users.rb → 20130417131939_create_users.rb} +7 -11
  115. data/dummy/db/schema.rb +9 -19
  116. data/dummy/lib/assets/.keep +0 -0
  117. data/dummy/lib/tasks/.keep +0 -0
  118. data/dummy/log/.keep +0 -0
  119. data/dummy/public/404.html +2 -1
  120. data/dummy/public/422.html +1 -1
  121. data/dummy/public/500.html +2 -1
  122. data/dummy/public/robots.txt +1 -1
  123. data/dummy/test/controllers/.keep +0 -0
  124. data/dummy/test/fixtures/.keep +0 -0
  125. data/dummy/test/helpers/.keep +0 -0
  126. data/dummy/test/integration/.keep +0 -0
  127. data/dummy/test/mailers/.keep +0 -0
  128. data/dummy/test/models/.keep +0 -0
  129. data/dummy/test/test_helper.rb +11 -58
  130. data/dummy/vendor/assets/javascripts/.keep +0 -0
  131. data/dummy/vendor/assets/stylesheets/.keep +0 -0
  132. data/lib/dailycred.rb +2 -2
  133. data/lib/dailycred/acts_as_dailycred.rb +4 -17
  134. data/lib/dailycred/client.rb +1 -0
  135. data/lib/dailycred/engine.rb +3 -2
  136. data/lib/dailycred/helper.rb +4 -4
  137. data/lib/dailycred/middleware.rb +5 -2
  138. data/lib/dailycred/version.rb +1 -1
  139. data/lib/generators/dailycred_generator.rb +17 -8
  140. data/lib/generators/templates/migration_create_user.rb +3 -9
  141. data/lib/omniauth/strategies/dailycred.rb +2 -0
  142. data/spec/helper_spec.rb +1 -3
  143. data/test/generator_test.rb +4 -3
  144. metadata +103 -52
  145. data/dummy/Guardfile +0 -31
  146. data/dummy/app/assets/stylesheets/scaffolds.css.scss +0 -69
  147. data/dummy/app/controllers/posts_controller.rb +0 -86
  148. data/dummy/app/helpers/posts_helper.rb +0 -2
  149. data/dummy/app/models/post.rb +0 -3
  150. data/dummy/app/views/posts/_form.html.erb +0 -21
  151. data/dummy/app/views/posts/edit.html.erb +0 -6
  152. data/dummy/app/views/posts/index.html.erb +0 -23
  153. data/dummy/app/views/posts/new.html.erb +0 -5
  154. data/dummy/app/views/posts/show.html.erb +0 -10
  155. data/dummy/db/migrate/20120926012555_create_posts.rb +0 -9
  156. data/dummy/db/migrate/20121002192037_update_users_2.rb +0 -70
  157. data/dummy/db/migrate/20121108192739_add_column_to_posts.rb +0 -5
  158. data/dummy/public/index.html +0 -241
  159. data/dummy/script/rails +0 -6
  160. data/dummy/test/fixtures/posts.yml +0 -7
  161. data/dummy/test/fixtures/users.yml +0 -3
  162. data/dummy/test/functional/posts_controller_test.rb +0 -51
  163. data/dummy/test/performance/browsing_test.rb +0 -12
  164. data/dummy/test/unit/helpers/posts_helper_test.rb +0 -4
  165. data/dummy/test/unit/post_test.rb +0 -7
  166. data/dummy/test/unit/user_test.rb +0 -77
  167. data/spec/omniauth/strategies/dailycred_spec.rb +0 -64
@@ -1,14 +1,14 @@
1
1
  # Be sure to restart your server when you modify this file.
2
- #
2
+
3
3
  # This file contains settings for ActionController::ParamsWrapper which
4
4
  # is enabled by default.
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
9
  end
10
10
 
11
- # Disable root element in JSON by default.
12
- ActiveSupport.on_load(:active_record) do
13
- self.include_root_in_json = false
14
- end
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -1,5 +1,23 @@
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.
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
3
21
 
4
22
  en:
5
23
  hello: "Hello world"
@@ -1,22 +1,21 @@
1
1
  Dummy::Application.routes.draw do
2
- resources :posts
2
+ #mount Dailycred::Engine => '/auth', :as => 'dailycred_engine'
3
+ # The priority is based upon order of creation: first created -> highest priority.
4
+ # See how all your routes lay out with "rake routes".
3
5
 
4
- mount Dailycred::Engine => '/auth', :as => 'dailycred_engine'
5
- # The priority is based upon order of creation:
6
- # first created -> highest priority.
6
+ # You can have the root of your site routed with "root"
7
+ # root to: 'welcome#index'
7
8
 
8
- # Sample of regular route:
9
- # match 'products/:id' => 'catalog#view'
10
- # Keep in mind you can assign values other than :controller and :action
9
+ # Example of regular route:
10
+ # get 'products/:id' => 'catalog#view'
11
11
 
12
- # Sample of named route:
13
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
14
- # This route can be invoked with purchase_url(:id => product.id)
12
+ # Example of named route that can be invoked with purchase_url(id: product.id)
13
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
15
14
 
16
- # Sample resource route (maps HTTP verbs to controller actions automatically):
15
+ # Example resource route (maps HTTP verbs to controller actions automatically):
17
16
  # resources :products
18
17
 
19
- # Sample resource route with options:
18
+ # Example resource route with options:
20
19
  # resources :products do
21
20
  # member do
22
21
  # get 'short'
@@ -28,34 +27,24 @@ Dummy::Application.routes.draw do
28
27
  # end
29
28
  # end
30
29
 
31
- # Sample resource route with sub-resources:
30
+ # Example resource route with sub-resources:
32
31
  # resources :products do
33
32
  # resources :comments, :sales
34
33
  # resource :seller
35
34
  # end
36
35
 
37
- # Sample resource route with more complex sub-resources
36
+ # Example resource route with more complex sub-resources:
38
37
  # resources :products do
39
38
  # resources :comments
40
39
  # resources :sales do
41
- # get 'recent', :on => :collection
40
+ # get 'recent', on: :collection
42
41
  # end
43
42
  # end
44
43
 
45
- # Sample resource route within a namespace:
44
+ # Example resource route within a namespace:
46
45
  # namespace :admin do
47
46
  # # Directs /admin/products/* to Admin::ProductsController
48
47
  # # (app/controllers/admin/products_controller.rb)
49
48
  # resources :products
50
49
  # end
51
-
52
- # You can have the root of your site routed with "root"
53
- # just remember to delete public/index.html.
54
- # root :to => 'welcome#index'
55
-
56
- # See how all your routes lay out with "rake routes"
57
-
58
- # This is a legacy wild controller route that's not recommended for RESTful applications.
59
- # Note: This route will make all actions in every controller accessible via GET requests.
60
- # match ':controller(/:action(/:id))(.:format)'
61
50
  end
@@ -5,20 +5,18 @@ class CreateUsers < ActiveRecord::Migration
5
5
  t.string :provider
6
6
  t.string :uid
7
7
  t.string :email
8
- t.integer :created
9
8
  t.string :username
10
9
  t.boolean :verified
11
10
  t.boolean :admin
12
11
  t.string :referred_by
13
12
  t.string :token
14
- t.text :facebook
15
13
  t.text :tags
16
14
  t.text :referred
17
- t.text :google
18
- t.text :twitter
19
- t.text :github
15
+ t.text :access_tokens
20
16
  t.boolean :subscribed
21
17
  t.string :display
18
+ t.text :identities
19
+ t.datetime :created
22
20
 
23
21
  t.timestamps
24
22
  end
@@ -26,20 +24,18 @@ class CreateUsers < ActiveRecord::Migration
26
24
  safe_column :users, :provider, :string
27
25
  safe_column :users, :uid, :string
28
26
  safe_column :users, :email, :string
29
- safe_column :users, :created, :integer
30
27
  safe_column :users, :username, :string
31
- safe_column :users, :verified, :booleanied
28
+ safe_column :users, :verified, :boolean
32
29
  safe_column :users, :admin, :boolean
33
30
  safe_column :users, :referred, :string
34
31
  safe_column :users, :token, :string
35
- safe_column :users, :facebook, :text
36
32
  safe_column :users, :tags, :text
37
33
  safe_column :users, :referred, :text
38
- safe_column :users, :google, :text
39
- safe_column :users, :twitter, :text
40
- safe_column :users, :github, :text
34
+ safe_column :users, :access_tokens, :text
41
35
  safe_column :users, :display, :string
42
36
  safe_column :users, :subscribed, :boolean
37
+ safe_column :users, :identities, :text
38
+ safe_column :users, :created, :datetime
43
39
  end
44
40
  end
45
41
 
data/dummy/db/schema.rb CHANGED
@@ -9,38 +9,28 @@
9
9
  # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
10
  # you'll amass, the slower it'll run and the greater likelihood for issues).
11
11
  #
12
- # It's strongly recommended to check this file into your version control system.
12
+ # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20121108192739) do
14
+ ActiveRecord::Schema.define(version: 20130417131939) do
15
15
 
16
- create_table "posts", :force => true do |t|
17
- t.string "title"
18
- t.datetime "created_at", :null => false
19
- t.datetime "updated_at", :null => false
20
- t.datetime "created"
21
- end
22
-
23
- create_table "users", :force => true do |t|
16
+ create_table "users", force: true do |t|
24
17
  t.string "provider"
25
18
  t.string "uid"
26
19
  t.string "email"
27
- t.integer "created", :limit => 8
28
20
  t.string "username"
29
21
  t.boolean "verified"
30
22
  t.boolean "admin"
31
23
  t.string "referred_by"
32
24
  t.string "token"
33
- t.text "facebook"
34
25
  t.text "tags"
35
26
  t.text "referred"
36
- t.text "google"
37
- t.text "twitter"
38
- t.text "github"
39
- t.datetime "created_at", :null => false
40
- t.datetime "updated_at", :null => false
41
- t.string "display"
42
- t.boolean "subscribed"
43
27
  t.text "access_tokens"
28
+ t.boolean "subscribed"
29
+ t.string "display"
30
+ t.text "identities"
31
+ t.datetime "created"
32
+ t.datetime "created_at"
33
+ t.datetime "updated_at"
44
34
  end
45
35
 
46
36
  end
File without changes
File without changes
data/dummy/log/.keep ADDED
File without changes
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
5
+ <style>
6
6
  body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
7
  div.dialog {
8
8
  width: 25em;
@@ -22,5 +22,6 @@
22
22
  <h1>The page you were looking for doesn't exist.</h1>
23
23
  <p>You may have mistyped the address or the page may have moved.</p>
24
24
  </div>
25
+ <p>If you are the application owner check the logs for more information.</p>
25
26
  </body>
26
27
  </html>
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
5
+ <style>
6
6
  body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
7
  div.dialog {
8
8
  width: 25em;
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
5
+ <style>
6
6
  body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
7
  div.dialog {
8
8
  width: 25em;
@@ -21,5 +21,6 @@
21
21
  <div class="dialog">
22
22
  <h1>We're sorry, but something went wrong.</h1>
23
23
  </div>
24
+ <p>If you are the application owner check the logs for more information.</p>
24
25
  </body>
25
26
  </html>
@@ -1,5 +1,5 @@
1
1
  # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
2
  #
3
3
  # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-Agent: *
4
+ # User-agent: *
5
5
  # Disallow: /
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,62 +1,15 @@
1
- require 'rubygems'
2
- require 'spork'
3
- #uncomment the following line to use spork with the debugger
4
- #require 'spork/ext/ruby-debug'
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
5
4
 
6
- Spork.prefork do
7
- # Loading more in this block will cause your tests to run faster. However,
8
- # if you change any configuration or code from libraries loaded here, you'll
9
- # need to restart spork for it take effect.
10
- ENV["RAILS_ENV"] = "test"
11
- require File.expand_path('../../config/environment', __FILE__)
12
- require 'rails/test_help'
5
+ class ActiveSupport::TestCase
6
+ ActiveRecord::Migration.check_pending!
13
7
 
14
- class ActiveSupport::TestCase
15
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
16
- #
17
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
18
- # -- they do not yet inherit this setting
19
- fixtures :all
8
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
9
+ #
10
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
11
+ # -- they do not yet inherit this setting
12
+ fixtures :all
20
13
 
21
- # Add more helper methods to be used by all tests here...
22
- end
23
-
24
- end
25
-
26
- Spork.each_run do
27
- # This code will be run each time you run your specs.
14
+ # Add more helper methods to be used by all tests here...
28
15
  end
29
-
30
- # --- Instructions ---
31
- # Sort the contents of this file into a Spork.prefork and a Spork.each_run
32
- # block.
33
- #
34
- # The Spork.prefork block is run only once when the spork server is started.
35
- # You typically want to place most of your (slow) initializer code in here, in
36
- # particular, require'ing any 3rd-party gems that you don't normally modify
37
- # during development.
38
- #
39
- # The Spork.each_run block is run each time you run your specs. In case you
40
- # need to load files that tend to change during development, require them here.
41
- # With Rails, your application modules are loaded automatically, so sometimes
42
- # this block can remain empty.
43
- #
44
- # Note: You can modify files loaded *from* the Spork.each_run block without
45
- # restarting the spork server. However, this file itself will not be reloaded,
46
- # so if you change any of the code inside the each_run block, you still need to
47
- # restart the server. In general, if you have non-trivial code in this file,
48
- # it's advisable to move it into a separate file so you can easily edit it
49
- # without restarting spork. (For example, with RSpec, you could move
50
- # non-trivial code into a file spec/support/my_helper.rb, making sure that the
51
- # spec/support/* files are require'd from inside the each_run block.)
52
- #
53
- # Any code that is left outside the two blocks will be run during preforking
54
- # *and* during each_run -- that's probably not what you want.
55
- #
56
- # These instructions should self-destruct in 10 seconds. If they don't, feel
57
- # free to delete them.
58
-
59
-
60
-
61
-
62
-
File without changes
File without changes
data/lib/dailycred.rb CHANGED
@@ -1,2 +1,2 @@
1
- require "omniauth/strategies/dailycred"
2
- Dir[File.expand_path('../dailycred/*', __FILE__)].each { |f| require f }
1
+ Dir[File.expand_path('../dailycred/*', __FILE__)].each { |f| require f }
2
+ require "omniauth/strategies/dailycred"
@@ -1,13 +1,9 @@
1
1
  module ActsAsDailycred
2
2
  def acts_as_dailycred
3
- serialize :facebook, Hash
4
- serialize :twitter, Hash
5
- serialize :google, Hash
6
- serialize :github, Hash
7
3
  serialize :tags, Array
8
4
  serialize :referred, Array
9
5
  serialize :access_tokens, Hash
10
- serialize :idenitities, Hash
6
+ serialize :identities, Hash
11
7
 
12
8
  extend ActsAsDailycred::SingletonMethods
13
9
  include ActsAsDailycred::InstanceMethods
@@ -15,7 +11,6 @@ module ActsAsDailycred
15
11
  end
16
12
  module SingletonMethods
17
13
  def find_or_create_with_omniauth(model)
18
- ap model
19
14
  @user = User.find_by_provider_and_uid(model['provider'], model['uid']) || User.new
20
15
  @user.update_from_dailycred model[:info]
21
16
  @user
@@ -42,16 +37,9 @@ module ActsAsDailycred
42
37
  end
43
38
  end
44
39
 
40
+ #deprecated, use @user.display
45
41
  def display_name
46
- display = self.email || ""
47
- if self.facebook != {}
48
- return self.facebook["name"]
49
- elsif self.google != {}
50
- return self.google["name"]
51
- elsif self.twitter != {}
52
- return "@"+self.twitter["screen_name"]
53
- end
54
- display
42
+ self.display
55
43
  end
56
44
 
57
45
  def referral_link url
@@ -63,9 +51,8 @@ module ActsAsDailycred
63
51
 
64
52
  def update_from_dailycred dc
65
53
  bad = ['updated_at', 'created_at']
66
- p dc
67
54
  dc.each do |k,v|
68
- self[k] = v if self.respond_to?(k) and !bad.include?(k.to_s)
55
+ self.send("#{k}=", v) if self.respond_to?(k) and !bad.include?(k.to_s)
69
56
  end
70
57
  save!
71
58
  end
@@ -1,5 +1,6 @@
1
1
  module Dailycred
2
2
  class Client
3
+ require 'faraday'
3
4
  attr_accessor :client_id, :secret_key, :options, :url
4
5
 
5
6
  URL = "https://www.dailycred.com"
@@ -1,4 +1,5 @@
1
1
  require 'rails'
2
+ require 'omniauth'
2
3
  module Dailycred
3
4
 
4
5
  class Engine < Rails::Engine
@@ -37,8 +38,8 @@ module Dailycred
37
38
  Rails.application.config.middleware.use OmniAuth::Builder do
38
39
  provider :dailycred, id, secret, opts
39
40
  end
40
-
41
- Rails.application.config.middleware.use "Dailycred::Middleware", id
41
+ opts[:middleware] ||= {}
42
+ Rails.application.config.middleware.use "Dailycred::Middleware", id, opts[:middleware]
42
43
 
43
44
  ActiveSupport.on_load(:action_controller) do
44
45
  include Dailycred::Helpers