simple_mobile_oauth 0.0.1 → 0.0.2

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: 7dae4e339a5e998c95f6bfda287c99be2bdc272f
4
- data.tar.gz: 38995f7cd9263b72f4598a966fb277c42813011e
3
+ metadata.gz: 186a40edb7005d3736a7ccbfe597b115a349feca
4
+ data.tar.gz: cae2e253cb2032529efa4bcfb82127133b06239e
5
5
  SHA512:
6
- metadata.gz: 2e7f1c8907463723201d6b04445a5833e6a8f1ec214fe4d87efee3f2e734478e6d37cc5af44ba4d1a09889b6ee3656de2806b6c6afbf35eafff0764354e7586f
7
- data.tar.gz: 4e15731713037c23788d34ba32fdd9b9cbc402d40b50af5671248ad6cdfe699385adc350da48e1ef85622372b97fa6ccbddd6f7ff6098c62df1c4428ea12333f
6
+ metadata.gz: 2441e0114f7a625a63c9c7baa3dd21bd4d9eac1dd76f2211337122383630d1f477bda0f4965bd9235fae971b4c9b5c4af8ee51622739f0e192a753dbd016ef3b
7
+ data.tar.gz: 0e4f3b0e9aadefedbc445e30e75ce795ac9e028e115d28bdcbd56680cc95c075176785d7ff4e2b6101ad31b8c4a7664a09de344316b951b218ba3bf2fa7e08c3
@@ -90,33 +90,33 @@ module SimpleMobileOauth
90
90
  user = _find_user_strategy(user_params)
91
91
  raise InvalidParamsError, 'could not find user from params given' unless user
92
92
  raise IdentityAlreadyBoundError, 'oauth identity exists with another user' \
93
- if identity_already_bound_to_different_user?(identity_owner, user)
93
+ if identity_already_bound_to_different_user?(identity_owner, user)
94
94
 
95
95
  # So the identity owner and user found from param match
96
- user
97
- else
98
- raise InvalidParamsError, 'missing user params' unless user_params
96
+ user
97
+ else
98
+ raise InvalidParamsError, 'missing user params' unless user_params
99
99
 
100
- user = _find_user_strategy(user_params) || _build_user_strategy(user_params)
100
+ user = _find_user_strategy(user_params) || _build_user_strategy(user_params)
101
101
 
102
- user.identities.build(identity_params)
103
- user.save
104
- user
105
- end
102
+ user.identities.build(identity_params)
103
+ user.save
104
+ user
106
105
  end
106
+ end
107
107
 
108
- private
108
+ private
109
109
 
110
- def login_request?(identity_owner, user_params)
111
- identity_owner && !user_params
112
- end
110
+ def login_request?(identity_owner, user_params)
111
+ identity_owner && !user_params
112
+ end
113
113
 
114
- def identity_already_bound_to_different_user?(identity_owner, user)
115
- identity_owner && user && identity_owner != user
116
- end
114
+ def identity_already_bound_to_different_user?(identity_owner, user)
115
+ identity_owner && user && identity_owner != user
116
+ end
117
117
 
118
- def start_of_registration_process?(identity, user_params)
119
- !identity && !user_params
120
- end
118
+ def start_of_registration_process?(identity, user_params)
119
+ !identity && !user_params
121
120
  end
122
121
  end
122
+ end
@@ -5,19 +5,5 @@ module SimpleMobileOauth
5
5
  included do
6
6
  has_many :identities, as: :identifiable
7
7
  end
8
-
9
- def username
10
- current_identity_info.try(:fetch, "nickname", "")
11
- end
12
-
13
- def avatar_url
14
- current_identity_info.try(:fetch, "image", "")
15
- end
16
-
17
- private
18
-
19
- def current_identity_info
20
- identities.first.try(:info)
21
- end
22
8
  end
23
9
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleMobileOauth
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -59,3 +59,39 @@ UserTest: test_has_many_identities
59
59
  SQL (1.0ms) INSERT INTO "identities" ("created_at", "identifiable_id", "identifiable_type", "info", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-12-16 00:47:50.174806"], ["identifiable_id", 1], ["identifiable_type", "User"], ["info", "null"], ["provider", "provider"], ["uid", "abc"], ["updated_at", "2014-12-16 00:47:50.174806"]]
60
60
   (0.1ms) RELEASE SAVEPOINT active_record_1
61
61
   (0.8ms) rollback transaction
62
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
63
+  (0.1ms) begin transaction
64
+ ----------------------------------
65
+ UserTest: test_creates_an_identity
66
+ ----------------------------------
67
+  (0.0ms) SAVEPOINT active_record_1
68
+ SQL (10.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-12-27 03:53:45.375459"], ["updated_at", "2014-12-27 03:53:45.375459"]]
69
+  (0.1ms) RELEASE SAVEPOINT active_record_1
70
+  (0.1ms) SAVEPOINT active_record_1
71
+ Identity Exists (0.4ms) SELECT 1 AS one FROM "identities" WHERE ("identities"."uid" = 'abc' AND "identities"."provider" = 'provider' AND "identities"."identifiable_type" = 'User') LIMIT 1
72
+ SQL (1.1ms) INSERT INTO "identities" ("created_at", "identifiable_id", "identifiable_type", "info", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-12-27 03:53:45.499147"], ["identifiable_id", 1], ["identifiable_type", "User"], ["info", "null"], ["provider", "provider"], ["uid", "abc"], ["updated_at", "2014-12-27 03:53:45.499147"]]
73
+  (0.1ms) RELEASE SAVEPOINT active_record_1
74
+  (13.1ms) rollback transaction
75
+  (0.1ms) begin transaction
76
+ ---------------------------------
77
+ SimpleMobileOauthTest: test_truth
78
+ ---------------------------------
79
+  (0.0ms) rollback transaction
80
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
81
+  (0.1ms) begin transaction
82
+ ----------------------------------
83
+ UserTest: test_creates_an_identity
84
+ ----------------------------------
85
+  (0.0ms) SAVEPOINT active_record_1
86
+ SQL (0.3ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-12-27 03:54:33.860344"], ["updated_at", "2014-12-27 03:54:33.860344"]]
87
+  (0.0ms) RELEASE SAVEPOINT active_record_1
88
+  (0.0ms) SAVEPOINT active_record_1
89
+ Identity Exists (0.2ms) SELECT 1 AS one FROM "identities" WHERE ("identities"."uid" = 'abc' AND "identities"."provider" = 'provider' AND "identities"."identifiable_type" = 'User') LIMIT 1
90
+ SQL (1.5ms) INSERT INTO "identities" ("created_at", "identifiable_id", "identifiable_type", "info", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-12-27 03:54:33.914630"], ["identifiable_id", 1], ["identifiable_type", "User"], ["info", "null"], ["provider", "provider"], ["uid", "abc"], ["updated_at", "2014-12-27 03:54:33.914630"]]
91
+  (0.1ms) RELEASE SAVEPOINT active_record_1
92
+  (18.7ms) rollback transaction
93
+  (0.1ms) begin transaction
94
+ ---------------------------------
95
+ SimpleMobileOauthTest: test_truth
96
+ ---------------------------------
97
+  (0.1ms) rollback transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_mobile_oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin He
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2014-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails