anadea-identity 0.4.2 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 856560cbb081cb688dae77144fe14e9d99fd9011
4
- data.tar.gz: 2e45bc3bf5182b2f731696e94dc5e2093307d825
3
+ metadata.gz: 359806dd089e6d62b28ac09587eacde7bdf9b661
4
+ data.tar.gz: d0b99f29bed1f78f471eaaaeb29c8038e0b9ac54
5
5
  SHA512:
6
- metadata.gz: b1b17436816726952a84a651abb35bcb0c89a2a128c80c98cd6da5efbf5892e70911caf040970ea80bbe957364eebd768da13c470e156b6bc56c80637637a9f3
7
- data.tar.gz: 306161bbfc204ce2d7a1e998fd162b570ff58ee3d5e8eb599b9892b6ad05f143d45047d87456489f4989bdb2a7b33bf24d4c4c5388f48f5449a2b3aa30837987
6
+ metadata.gz: 61d3aa69a6bc158b0bf318807c7811a647ec373b71e1de8542560fd002f386d66102953cefdc8b49f7b34cfc697b6902c033baa81825cc314ff5c1b05d156bab
7
+ data.tar.gz: aed7fb0178f41b08e39a35c5e0c409e6900fc8c0298dfe860d5057c7952a5fa41c5cf10609bbad38b633ae6ea608a9d3c1fa301595e6499bbf7d1893e142d5b5
@@ -10,6 +10,7 @@ module Identity
10
10
  def model_contents
11
11
  <<RUBY
12
12
  include Identity::Mixins::User
13
+ #{"serialize :oauth_hash, JSON" unless json?}
13
14
  RUBY
14
15
  end
15
16
 
@@ -45,7 +46,16 @@ RUBY
45
46
  ## Omniauthable
46
47
  t.string :provider
47
48
  t.string :uid
49
+ t.#{json_column} :oauth_hash
48
50
  RUBY
49
- end
51
+ end
52
+
53
+ def json_column
54
+ "%-6s" % (json? ? "json" : "text")
55
+ end
56
+
57
+ def json?
58
+ rails4? && postgresql?
59
+ end
50
60
  end
51
61
  end
@@ -12,8 +12,9 @@ module Identity
12
12
  end
13
13
 
14
14
  def build_from_auth(auth)
15
- self.email = "#{auth.uid}@#{auth.provider}.com"
15
+ self.email = auth.provider == "twitter" ? "#{auth.uid}@#{auth.provider}.com" : auth.info.email
16
16
  self.password = Devise.friendly_token[0,20]
17
+ self.oauth_hash = auth
17
18
 
18
19
  send("build_from_#{auth.provider}", auth) if respond_to?("build_from_#{auth.provider}")
19
20
  end
@@ -1,3 +1,3 @@
1
1
  module Identity
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anadea-identity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anadea team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-27 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise