domp 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e41323956c24154d3024f6caa314be487025a13c
4
+ data.tar.gz: a63514f5fe406d4cec169eec5cbfa711e930afba
5
+ SHA512:
6
+ metadata.gz: f21d91da64b4172cd80b2389cd7fb714d8a1a9bdde452a51e3321c19152d3cf01ed95c551067b4eee70a000b35c11f534db083c928c0ad9257ff5f6cce6ff15a
7
+ data.tar.gz: f01add0181b293c748551c877e005085544af006a38cda58652784b1154470bd2aaf63a309e56ce49267a06e6d9bb0485360d2b2407613fe9a34c1ef8df4e9c8
data/README.md CHANGED
@@ -11,6 +11,7 @@ rails generate devise:install
11
11
  rails generate devise User
12
12
  rails generate domp User facebook twitter
13
13
  ```
14
+ You can list as many providers as you want, check out a [full list](https://github.com/intridea/omniauth/wiki/List-of-Strategies) of them.
14
15
 
15
16
  Note: this is not an engine but rather a generator which will generate models, controllers and setup configs for you. You are free to change everything. You are the king.
16
17
 
@@ -49,13 +50,22 @@ Here's what the `User` model will look like:
49
50
  ```ruby
50
51
  class User < ActiveRecord::Base
51
52
  has_many :authentications, class_name: 'UserAuthentication'
52
- devise :omniauthable, :database_authenticatable, :registerable,
53
- :recoverable, :rememberable, :trackable, :validatable
53
+
54
+ devise :omniauthable, :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
55
+
56
+ def self.create_from_omniauth(params)
57
+ attributes = {
58
+ email: params['info']['email'],
59
+ password: Devise.friendly_token
60
+ }
61
+
62
+ create attributes
63
+ end
54
64
  end
55
65
  ```
56
66
 
57
67
  ### User::OmniauthCallbacksController
58
- Here goes all the logic of creating multiple authentications. You are free to change everything, it's just a boilerplate that will make sense it most of the apps.
68
+ Here goes all the logic of creating multiple authentications. You are free to change everything, it's just a boilerplate that will make sense in most of the apps.
59
69
 
60
70
  ### Route additions
61
71
  ```ruby
data/lib/domp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Domp
2
- VERSION = "0.0.2"
2
+ VERSION = '0.0.3'
3
3
  end
@@ -36,6 +36,20 @@ class DompGenerator < Rails::Generators::NamedBase
36
36
  " has_many :authentications, class_name: '#{class_name}Authentication'\n"
37
37
  end
38
38
 
39
+ inject_into_class "app/models/#{file_name}.rb", class_name do
40
+ <<-METHOD.gsub(/^ {6}/, '')
41
+ def self.create_from_omniauth(params)
42
+ attributes = {
43
+ email: params['info']['email'],
44
+ password: Devise.friendly_token
45
+ }
46
+
47
+ create(attributes)
48
+ end
49
+
50
+ METHOD
51
+ end
52
+
39
53
  inject_into_file "app/models/#{file_name}.rb", after: " devise" do
40
54
  " :omniauthable,"
41
55
  end
@@ -15,7 +15,7 @@ class <%= class_name %>Authentication < ActiveRecord::Base
15
15
  authentication_provider: provider,
16
16
  uid: params['uid'],
17
17
  token: params['credentials']['token'],
18
- token_expires_at: params['credentials']['expires_at'],
18
+ token_expires_at: Time.at(params['credentials']['expires_at']).to_datetime,
19
19
  params: params,
20
20
  )
21
21
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alexander Zaytsev
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
11
+ date: 2013-06-30 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Devise Omniauth Multiple Providers
15
14
  email:
@@ -35,26 +34,25 @@ files:
35
34
  - lib/generators/domp/templates/omniauth_callbacks_controller.rb
36
35
  homepage: https://github.com/AlexanderZaytsev/domp
37
36
  licenses: []
37
+ metadata: {}
38
38
  post_install_message:
39
39
  rdoc_options: []
40
40
  require_paths:
41
41
  - lib
42
42
  required_ruby_version: !ruby/object:Gem::Requirement
43
- none: false
44
43
  requirements:
45
- - - ! '>='
44
+ - - '>='
46
45
  - !ruby/object:Gem::Version
47
46
  version: '0'
48
47
  required_rubygems_version: !ruby/object:Gem::Requirement
49
- none: false
50
48
  requirements:
51
- - - ! '>='
49
+ - - '>='
52
50
  - !ruby/object:Gem::Version
53
51
  version: '0'
54
52
  requirements: []
55
53
  rubyforge_project:
56
- rubygems_version: 1.8.24
54
+ rubygems_version: 2.0.0
57
55
  signing_key:
58
- specification_version: 3
56
+ specification_version: 4
59
57
  summary: Generator to bootstrap usage of multiple providers with Devise and Omniauth
60
58
  test_files: []