minimum-omniauth-scaffold 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33892c60d2859d617507140936a030ec64dabc25
4
- data.tar.gz: 1368589131c08029d0e2374109e2fa971365aa76
3
+ metadata.gz: b58db84863bddeda53dfe1deb1be497cf6f7e5c6
4
+ data.tar.gz: f4cc21e109fa18c68b743c351bc01ef07991a133
5
5
  SHA512:
6
- metadata.gz: 3158e5392c0bcec58f4f7d2e45cda5083860ea88780c5afe2362e155bef373311006d5a3f0ea47c35600b456148182115a4430350f5008f800758d376602783f
7
- data.tar.gz: e20e4edf4c4d02c354f63e90b9508e29ba3bb53dfb99a5f81db0a1ac4a2ec2262c91ae046681207d43f393cff3446ba679840468ec6335c5086e090702d7fedd
6
+ metadata.gz: a461ee413262ac5570b5aba564e000de4be6a54fd7e035cd39139c6dfb7ef4740730ba62832007d5e75fbea23d00961cdda2c513c6d0e3ea4c83a4451e6626b9
7
+ data.tar.gz: 65fdc8f07dac7d6c9c704cb7fc5a5786ac53f91b44a3812e902d56d39a5496fdf49568032d89d8cfe03da08a170d071a710cae4de6bdabc6c2c0bd2550bdf741
@@ -8,6 +8,7 @@ class CreateUsers < ActiveRecord::Migration
8
8
  t.string :image
9
9
  t.string :email
10
10
  t.string :location
11
+ t.string :gender
11
12
  t.string :token
12
13
  t.string :secret
13
14
 
@@ -1,6 +1,4 @@
1
1
  class User < ActiveRecord::Base
2
- # attr_accessible :provider, :uid, :name, :nickname, :image, :email, :location, :token, :secret
3
-
4
2
  # auth情報更新
5
3
  def auth_update( auth )
6
4
  if auth["provider"] == "facebook"
@@ -9,12 +7,13 @@ class User < ActiveRecord::Base
9
7
  image_path = auth["info"]["image"]
10
8
  end
11
9
 
12
- if self.name != auth["info"]["name"] or self.nickname != auth["info"]["nickname"] or self.image != image_path or self.email != auth["info"]["email"] or self.location != auth["info"]["location"]
10
+ if self.name != auth["info"]["name"] or self.nickname != auth["info"]["nickname"] or self.image != image_path or self.email != auth["info"]["email"]
13
11
  self.name = auth["info"]["name"]
14
12
  self.nickname = auth["info"]["nickname"]
15
13
  self.image = image_path
16
14
  self.email = auth["info"]["email"]
17
- self.location = auth["info"]["location"]
15
+ self.gender = auth["extra"]["raw_info"]["gender"]
16
+ self.location = auth["info"]["location"] || auth["extra"]["raw_info"]["location"]
18
17
  self.save!
19
18
  end
20
19
  end
@@ -40,6 +39,11 @@ class User < ActiveRecord::Base
40
39
  user.secret = auth['credentials']['secret']
41
40
  end
42
41
 
42
+ if auth["extra"].present? and auth["extra"]["raw_info"].present?
43
+ user.gender = auth["extra"]["raw_info"]["gender"]
44
+ user.location = auth["extra"]["raw_info"]["location"] if user.location.blank?
45
+ end
46
+
43
47
  user.save!
44
48
 
45
49
  return user
@@ -1,7 +1,7 @@
1
1
  module Minimum
2
2
  module Omniauth
3
3
  module Scaffold
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimum-omniauth-scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - shu0115
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-28 00:00:00.000000000 Z
11
+ date: 2013-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler