socialmux 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.travis.yml +9 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +220 -0
  7. data/Rakefile +1 -0
  8. data/lib/socialmux/auth_mapper/base.rb +25 -0
  9. data/lib/socialmux/auth_mapper/facebook.rb +7 -0
  10. data/lib/socialmux/auth_mapper/github.rb +7 -0
  11. data/lib/socialmux/auth_mapper/google_oauth2.rb +7 -0
  12. data/lib/socialmux/auth_mapper/guess_name.rb +22 -0
  13. data/lib/socialmux/auth_mapper/linkedin.rb +7 -0
  14. data/lib/socialmux/auth_mapper/twitter.rb +7 -0
  15. data/lib/socialmux/auth_mapper.rb +26 -0
  16. data/lib/socialmux/event.rb +13 -0
  17. data/lib/socialmux/result.rb +15 -0
  18. data/lib/socialmux/strategy.rb +69 -0
  19. data/lib/socialmux/version.rb +4 -0
  20. data/lib/socialmux.rb +9 -0
  21. data/socialmux.gemspec +31 -0
  22. data/spec/fixtures/facebook_response.json +158 -0
  23. data/spec/fixtures/github_response.json +65 -0
  24. data/spec/fixtures/google_response.json +35 -0
  25. data/spec/fixtures/linkedin_response.json +45 -0
  26. data/spec/fixtures/twitter_response.json +239 -0
  27. data/spec/lib/.gitkeep +0 -0
  28. data/spec/lib/auth_mapper/facebook_spec.rb +18 -0
  29. data/spec/lib/auth_mapper/github_spec.rb +18 -0
  30. data/spec/lib/auth_mapper/google_oauth2_spec.rb +19 -0
  31. data/spec/lib/auth_mapper/linkedin_spec.rb +20 -0
  32. data/spec/lib/auth_mapper/twitter_spec.rb +22 -0
  33. data/spec/lib/result_spec.rb +17 -0
  34. data/spec/lib/strategy_spec.rb +112 -0
  35. data/spec/spec_helper.rb +12 -0
  36. data/spec/support/fixture_helpers.rb +13 -0
  37. data/spec/support/rspec_config.rb +11 -0
  38. metadata +210 -0
@@ -0,0 +1,158 @@
1
+ {
2
+ "provider": "facebook",
3
+ "uid": "771417286",
4
+ "info": {
5
+ "nickname": "stefano.verna",
6
+ "email": "stefano.verna@welaika.com",
7
+ "name": "Stefano Verna",
8
+ "first_name": "Stefano",
9
+ "last_name": "Verna",
10
+ "image": "http://graph.facebook.com/771417286/picture?type=square",
11
+ "urls": {
12
+ "Facebook": "https://www.facebook.com/stefano.verna"
13
+ },
14
+ "location": "Florence, Italy",
15
+ "verified": true
16
+ },
17
+ "credentials": {
18
+ "token": "CAAEFnHx42BIBAAl6OMh3HZC5y7MQ7AfAObg27UkrUCdx2YqSp651w6UMHvd6PrNJMEaBKE1dpb4oH152Ppq6OBsg56pnIWC0ZCYvRRO4JaCZBiW01uaDyXxLLc8O5mZBLpRpy8DyklJBGiGhplO6C4VkZCfkZBZCNUZD",
19
+ "expires_at": 1380465613,
20
+ "expires": true
21
+ },
22
+ "extra": {
23
+ "raw_info": {
24
+ "id": "771417286",
25
+ "name": "Stefano Verna",
26
+ "first_name": "Stefano",
27
+ "last_name": "Verna",
28
+ "link": "https://www.facebook.com/stefano.verna",
29
+ "username": "stefano.verna",
30
+ "hometown": {
31
+ "id": "115351801811432",
32
+ "name": "Turin, Italy"
33
+ },
34
+ "location": {
35
+ "id": "105782926129203",
36
+ "name": "Florence, Italy"
37
+ },
38
+ "work": [
39
+ {
40
+ "employer": {
41
+ "id": "201330109900200",
42
+ "name": "Cantiere Creativo"
43
+ },
44
+ "start_date": "2012-03-01"
45
+ },
46
+ {
47
+ "employer": {
48
+ "id": "276067326850",
49
+ "name": "weLaika"
50
+ },
51
+ "location": {
52
+ "id": "115351801811432",
53
+ "name": "Turin, Italy"
54
+ },
55
+ "position": {
56
+ "id": "109542932398298",
57
+ "name": "Software Engineer"
58
+ },
59
+ "start_date": "2010-09-01"
60
+ },
61
+ {
62
+ "employer": {
63
+ "id": "115201351823736",
64
+ "name": "Freelance"
65
+ },
66
+ "location": {
67
+ "id": "115351801811432",
68
+ "name": "Turin, Italy"
69
+ },
70
+ "position": {
71
+ "id": "108480125843293",
72
+ "name": "Web Developer"
73
+ },
74
+ "start_date": "2007-03-01",
75
+ "end_date": "0000-00"
76
+ },
77
+ {
78
+ "employer": {
79
+ "id": "153608871363738",
80
+ "name": "Agavee"
81
+ },
82
+ "from": {
83
+ "id": "1013042151",
84
+ "name": "Paolo Pustorino"
85
+ },
86
+ "projects": [
87
+ {
88
+ "id": "384529628287352",
89
+ "name": "DreamBoard",
90
+ "with": [
91
+ {
92
+ "id": "1013042151",
93
+ "name": "Paolo Pustorino"
94
+ }
95
+ ],
96
+ "from": {
97
+ "id": "1013042151",
98
+ "name": "Paolo Pustorino"
99
+ }
100
+ }
101
+ ]
102
+ }
103
+ ],
104
+ "education": [
105
+ {
106
+ "school": {
107
+ "id": "114660608549885",
108
+ "name": "ITC E. Vittorini"
109
+ },
110
+ "year": {
111
+ "id": "113125125403208",
112
+ "name": "2004"
113
+ },
114
+ "type": "High School"
115
+ },
116
+ {
117
+ "school": {
118
+ "id": "112756382072680",
119
+ "name": "Polytechnic University of Turin"
120
+ },
121
+ "type": "College"
122
+ },
123
+ {
124
+ "school": {
125
+ "id": "109518992401285",
126
+ "name": "Polytechnic University of Turin"
127
+ },
128
+ "degree": {
129
+ "id": "115140791834804",
130
+ "name": "Ingegneria Informatica"
131
+ },
132
+ "year": {
133
+ "id": "138383069535219",
134
+ "name": "2005"
135
+ },
136
+ "type": "Graduate School"
137
+ }
138
+ ],
139
+ "gender": "male",
140
+ "email": "stefano.verna@welaika.com",
141
+ "timezone": 2,
142
+ "locale": "it_IT",
143
+ "languages": [
144
+ {
145
+ "id": "106059522759137",
146
+ "name": "English"
147
+ },
148
+ {
149
+ "id": "113153272032690",
150
+ "name": "Italian"
151
+ }
152
+ ],
153
+ "verified": true,
154
+ "updated_time": "2013-05-09T12:36:31+0000"
155
+ }
156
+ }
157
+ }
158
+
@@ -0,0 +1,65 @@
1
+ {
2
+ "provider": "github",
3
+ "uid": "51573",
4
+ "info": {
5
+ "nickname": "stefanoverna",
6
+ "email": "stefano.verna@gmail.com",
7
+ "name": "Stefano Verna",
8
+ "image": "https://secure.gravatar.com/avatar/f1b1c16a5b246b3b7cff8d8a07aa9725?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
9
+ "urls": {
10
+ "GitHub": "https://github.com/stefanoverna",
11
+ "Blog": "http://www.stefanoverna.com"
12
+ }
13
+ },
14
+ "credentials": {
15
+ "token": "13a3342fedef375a62049c5b43bd1b93d602976e",
16
+ "expires": false
17
+ },
18
+ "extra": {
19
+ "raw_info": {
20
+ "login": "stefanoverna",
21
+ "id": 51573,
22
+ "avatar_url": "https://secure.gravatar.com/avatar/f1b1c16a5b246b3b7cff8d8a07aa9725?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
23
+ "gravatar_id": "f1b1c16a5b246b3b7cff8d8a07aa9725",
24
+ "url": "https://api.github.com/users/stefanoverna",
25
+ "html_url": "https://github.com/stefanoverna",
26
+ "followers_url": "https://api.github.com/users/stefanoverna/followers",
27
+ "following_url": "https://api.github.com/users/stefanoverna/following{/other_user}",
28
+ "gists_url": "https://api.github.com/users/stefanoverna/gists{/gist_id}",
29
+ "starred_url": "https://api.github.com/users/stefanoverna/starred{/owner}{/repo}",
30
+ "subscriptions_url": "https://api.github.com/users/stefanoverna/subscriptions",
31
+ "organizations_url": "https://api.github.com/users/stefanoverna/orgs",
32
+ "repos_url": "https://api.github.com/users/stefanoverna/repos",
33
+ "events_url": "https://api.github.com/users/stefanoverna/events{/privacy}",
34
+ "received_events_url": "https://api.github.com/users/stefanoverna/received_events",
35
+ "type": "User",
36
+ "name": "Stefano Verna",
37
+ "company": "WeLaika",
38
+ "blog": "http://www.stefanoverna.com",
39
+ "location": "Turin, Italy",
40
+ "email": "stefano.verna@gmail.com",
41
+ "hireable": false,
42
+ "bio": null,
43
+ "public_repos": 41,
44
+ "followers": 37,
45
+ "following": 8,
46
+ "created_at": "2009-02-03T23:54:53Z",
47
+ "updated_at": "2013-07-31T17:12:52Z",
48
+ "public_gists": 32,
49
+ "total_private_repos": 0,
50
+ "owned_private_repos": 0,
51
+ "disk_usage": 31462,
52
+ "collaborators": 0,
53
+ "plan": {
54
+ "name": "free",
55
+ "space": 307200,
56
+ "collaborators": 0,
57
+ "private_repos": 0
58
+ },
59
+ "private_gists": 8,
60
+ "site_admin": false
61
+ }
62
+ }
63
+ }
64
+
65
+
@@ -0,0 +1,35 @@
1
+ {
2
+ "provider": "google_oauth2",
3
+ "uid": "106136318376168001814",
4
+ "info": {
5
+ "name": "Stefano Verna",
6
+ "email": "stefano.verna@gmail.com",
7
+ "first_name": "Stefano",
8
+ "last_name": "Verna",
9
+ "image": "https://lh3.googleusercontent.com/-Mk9Xg5Qy_vc/AAAAAAAAAAI/AAAAAAAAAK4/h0ffVEFGrTo/photo.jpg",
10
+ "urls": {
11
+ "Google": "https://plus.google.com/106136318376168001814"
12
+ }
13
+ },
14
+ "credentials": {
15
+ "token": "ya29.AHES6ZS4zco44x0wdzotIcxR08dmOz9rlPjUb9BDcaNcRZFSkcroQQ",
16
+ "expires_at": 1375288165,
17
+ "expires": true
18
+ },
19
+ "extra": {
20
+ "raw_info": {
21
+ "id": "106136318376168001814",
22
+ "email": "stefano.verna@gmail.com",
23
+ "verified_email": true,
24
+ "name": "Stefano Verna",
25
+ "given_name": "Stefano",
26
+ "family_name": "Verna",
27
+ "link": "https://plus.google.com/106136318376168001814",
28
+ "picture": "https://lh3.googleusercontent.com/-Mk9Xg5Qy_vc/AAAAAAAAAAI/AAAAAAAAAK4/h0ffVEFGrTo/photo.jpg",
29
+ "gender": "male",
30
+ "birthday": "0000-09-25",
31
+ "locale": "en"
32
+ }
33
+ }
34
+ }
35
+
@@ -0,0 +1,45 @@
1
+ {
2
+ "provider": "linkedin",
3
+ "uid": "yCmV0Ms_fg",
4
+ "info": {
5
+ "name": "Stefano Verna",
6
+ "email": "stefano.verna@gmail.com",
7
+ "nickname": "Stefano Verna",
8
+ "first_name": "Stefano",
9
+ "last_name": "Verna",
10
+ "location": {
11
+ "country": {
12
+ "code": "it"
13
+ },
14
+ "name": "Turin Area, Italy"
15
+ },
16
+ "description": "Software Engineer at weLaika",
17
+ "image": "http://m.c.lnkd.licdn.com/mpr/mprx/0_dCvykIIfOoeQZqWUdXQ_keMhpEuE4-4UIhTikeHriWZsFnfR5k5KoHyO-G2vUzJBHTBCwfsBBN4N",
18
+ "urls": {
19
+ "public_profile": "http://www.linkedin.com/in/stefanoverna"
20
+ }
21
+ },
22
+ "credentials": {
23
+ "token": "AQWNmOocx29HFFuURNQLcryKvUsavFZAVdWF0qbQT5UjcHq53urDGqt5rLQt8Hj8U4bK7kiGh9U5vHAqTUWOxDOuy8uNpigdaqT-s5BIFQ1h-NM1MCopCjMqaQbleV8I6l1dJDH8MmHal9SGpPzAGySmhnWPbi7xrAbJvtmCyM2ncoSM05M",
24
+ "expires": false
25
+ },
26
+ "extra": {
27
+ "raw_info": {
28
+ "emailAddress": "stefano.verna@gmail.com",
29
+ "firstName": "Stefano",
30
+ "headline": "Software Engineer at weLaika",
31
+ "id": "yCmV0Ms_fg",
32
+ "industry": "Computer Software",
33
+ "lastName": "Verna",
34
+ "location": {
35
+ "country": {
36
+ "code": "it"
37
+ },
38
+ "name": "Turin Area, Italy"
39
+ },
40
+ "pictureUrl": "http://m.c.lnkd.licdn.com/mpr/mprx/0_dCvykIIfOoeQZqWUdXQ_keMhpEuE4-4UIhTikeHriWZsFnfR5k5KoHyO-G2vUzJBHTBCwfsBBN4N",
41
+ "publicProfileUrl": "http://www.linkedin.com/in/stefanoverna"
42
+ }
43
+ }
44
+ }
45
+
@@ -0,0 +1,239 @@
1
+ {
2
+ "provider": "twitter",
3
+ "uid": "5521662",
4
+ "info": {
5
+ "nickname": "steffoz",
6
+ "name": "Stefano Verna",
7
+ "location": "Florence, Tuscany, Italy",
8
+ "image": "http://a0.twimg.com/profile_images/3060238387/a9b2a4cd85377cf0c12b22fedcac80b3_normal.png",
9
+ "description": "28 years, 2 babies, Rails and iOS developer, cofounder of @weLaika. Tweet me anytime! ♥",
10
+ "urls": {
11
+ "Website": "http://t.co/h9u6fkWOgl",
12
+ "Twitter": "https://twitter.com/steffoz"
13
+ }
14
+ },
15
+ "credentials": {
16
+ "token": "5521662-DmZYt2BwoWr9FxtyT3MlIt8DscTFJTSDmG0Qy3wU0",
17
+ "secret": "PsRfrWeqdnZiWS4fHSot4SSOVe8WnQGdH6nutkXq0"
18
+ },
19
+ "extra": {
20
+ "access_token": {
21
+ "token": "5521662-DmZYt2BwoWr9FxtyT3MlIt8DscTFJTSDmG0Qy3wU0",
22
+ "secret": "PsRfrWeqdnZiWS4fHSot4SSOVe8WnQGdH6nutkXq0",
23
+ "consumer": {
24
+ "key": "gsbhxDIUZYkSgA2SaA5PQ",
25
+ "secret": "sT5mXEA6loulW1H4038eUkZS3yEW4tybTpDCBxhmg",
26
+ "options": {
27
+ "signature_method": "HMAC-SHA1",
28
+ "request_token_path": "/oauth/request_token",
29
+ "authorize_path": "/oauth/authenticate",
30
+ "access_token_path": "/oauth/access_token",
31
+ "proxy": null,
32
+ "scheme": "header",
33
+ "http_method": "post",
34
+ "oauth_version": "1.0",
35
+ "site": "https://api.twitter.com"
36
+ },
37
+ "http": {
38
+ "address": "api.twitter.com",
39
+ "port": 443,
40
+ "local_host": null,
41
+ "local_port": null,
42
+ "curr_http_version": "1.1",
43
+ "keep_alive_timeout": 2,
44
+ "last_communicated": null,
45
+ "close_on_empty_response": false,
46
+ "socket": null,
47
+ "started": false,
48
+ "open_timeout": 30,
49
+ "read_timeout": 30,
50
+ "continue_timeout": null,
51
+ "debug_output": null,
52
+ "proxy_from_env": true,
53
+ "proxy_uri": null,
54
+ "proxy_address": null,
55
+ "proxy_port": null,
56
+ "proxy_user": null,
57
+ "proxy_pass": null,
58
+ "use_ssl": true,
59
+ "ssl_context": {
60
+ "cert": null,
61
+ "key": null,
62
+ "client_ca": null,
63
+ "ca_file": null,
64
+ "ca_path": null,
65
+ "timeout": null,
66
+ "verify_mode": 0,
67
+ "verify_depth": null,
68
+ "renegotiation_cb": null,
69
+ "verify_callback": null,
70
+ "options": -2147482625,
71
+ "cert_store": null,
72
+ "extra_chain_cert": null,
73
+ "client_cert_cb": null,
74
+ "tmp_dh_callback": null,
75
+ "session_id_context": null,
76
+ "session_get_cb": null,
77
+ "session_new_cb": null,
78
+ "session_remove_cb": null,
79
+ "servername_cb": null,
80
+ "npn_protocols": null,
81
+ "npn_select_cb": null
82
+ },
83
+ "ssl_session": {},
84
+ "enable_post_connection_check": true,
85
+ "sspi_enabled": false,
86
+ "ca_file": null,
87
+ "ca_path": null,
88
+ "cert": null,
89
+ "cert_store": null,
90
+ "ciphers": null,
91
+ "key": null,
92
+ "ssl_timeout": null,
93
+ "ssl_version": null,
94
+ "verify_callback": null,
95
+ "verify_depth": null,
96
+ "verify_mode": 0
97
+ },
98
+ "http_method": "post",
99
+ "uri": {
100
+ "scheme": "https",
101
+ "user": null,
102
+ "password": null,
103
+ "host": "api.twitter.com",
104
+ "port": 443,
105
+ "path": "",
106
+ "query": null,
107
+ "opaque": null,
108
+ "registry": null,
109
+ "fragment": null,
110
+ "parser": null
111
+ }
112
+ },
113
+ "params": {
114
+ "oauth_token": "5521662-DmZYt2BwoWr9FxtyT3MlIt8DscTFJTSDmG0Qy3wU0",
115
+ "oauth_token_secret": "PsRfrWeqdnZiWS4fHSot4SSOVe8WnQGdH6nutkXq0",
116
+ "user_id": "5521662",
117
+ "screen_name": "steffoz"
118
+ },
119
+ "response": {
120
+ "cache-control": [
121
+ "no-cache, no-store, must-revalidate, pre-check=0, post-check=0"
122
+ ],
123
+ "content-length": [
124
+ "697"
125
+ ],
126
+ "content-type": [
127
+ "application/json;charset=utf-8"
128
+ ],
129
+ "date": [
130
+ "Wed, 31 Jul 2013 15:36:59 GMT"
131
+ ],
132
+ "expires": [
133
+ "Tue, 31 Mar 1981 05:00:00 GMT"
134
+ ],
135
+ "last-modified": [
136
+ "Wed, 31 Jul 2013 15:36:59 GMT"
137
+ ],
138
+ "pragma": [
139
+ "no-cache"
140
+ ],
141
+ "server": [
142
+ "tfe"
143
+ ],
144
+ "set-cookie": [
145
+ "lang=it",
146
+ "guest_id=v1%3A137528501927792038; Domain=.twitter.com; Path=/; Expires=Fri, 31-Jul-2015 15:36:59 UTC"
147
+ ],
148
+ "status": [
149
+ "200 OK"
150
+ ],
151
+ "strict-transport-security": [
152
+ "max-age=631138519"
153
+ ],
154
+ "x-access-level": [
155
+ "read"
156
+ ],
157
+ "x-frame-options": [
158
+ "SAMEORIGIN"
159
+ ],
160
+ "x-rate-limit-limit": [
161
+ "15"
162
+ ],
163
+ "x-rate-limit-remaining": [
164
+ "14"
165
+ ],
166
+ "x-rate-limit-reset": [
167
+ "1375285919"
168
+ ],
169
+ "x-transaction": [
170
+ "69e1c0701c84c56f"
171
+ ],
172
+ "x-xss-protection": [
173
+ "1; mode=block"
174
+ ],
175
+ "connection": [
176
+ "close"
177
+ ]
178
+ }
179
+ },
180
+ "raw_info": {
181
+ "id": 5521662,
182
+ "id_str": "5521662",
183
+ "name": "Stefano Verna",
184
+ "screen_name": "steffoz",
185
+ "location": "Florence, Tuscany, Italy",
186
+ "description": "28 years, 2 babies, Rails and iOS developer, cofounder of @weLaika. Tweet me anytime! ♥",
187
+ "url": "http://t.co/h9u6fkWOgl",
188
+ "entities": {
189
+ "url": {
190
+ "urls": [
191
+ {
192
+ "url": "http://t.co/h9u6fkWOgl",
193
+ "expanded_url": "http://stefanoverna.com",
194
+ "display_url": "stefanoverna.com",
195
+ "indices": [
196
+ 0,
197
+ 22
198
+ ]
199
+ }
200
+ ]
201
+ },
202
+ "description": {
203
+ "urls": []
204
+ }
205
+ },
206
+ "protected": false,
207
+ "followers_count": 285,
208
+ "friends_count": 282,
209
+ "listed_count": 12,
210
+ "created_at": "Thu Apr 26 08:19:50 +0000 2007",
211
+ "favourites_count": 21,
212
+ "utc_offset": 7200,
213
+ "time_zone": "Rome",
214
+ "geo_enabled": true,
215
+ "verified": false,
216
+ "statuses_count": 1422,
217
+ "lang": "it",
218
+ "contributors_enabled": false,
219
+ "is_translator": false,
220
+ "profile_background_color": "FFFFFF",
221
+ "profile_background_image_url": "http://a0.twimg.com/profile_background_images/774708681/0adfa5fa992fe23eb0344fa6688522c2.jpeg",
222
+ "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/774708681/0adfa5fa992fe23eb0344fa6688522c2.jpeg",
223
+ "profile_background_tile": false,
224
+ "profile_image_url": "http://a0.twimg.com/profile_images/3060238387/a9b2a4cd85377cf0c12b22fedcac80b3_normal.png",
225
+ "profile_image_url_https": "https://si0.twimg.com/profile_images/3060238387/a9b2a4cd85377cf0c12b22fedcac80b3_normal.png",
226
+ "profile_link_color": "000000",
227
+ "profile_sidebar_border_color": "FFFFFF",
228
+ "profile_sidebar_fill_color": "FFFFFF",
229
+ "profile_text_color": "000000",
230
+ "profile_use_background_image": true,
231
+ "default_profile": false,
232
+ "default_profile_image": false,
233
+ "following": false,
234
+ "follow_request_sent": false,
235
+ "notifications": false
236
+ }
237
+ }
238
+ }
239
+
data/spec/lib/.gitkeep ADDED
File without changes
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ module Socialmux::AuthMapper
4
+ describe Facebook do
5
+ subject do
6
+ Facebook.new(read_json('facebook_response'))
7
+ end
8
+
9
+ its(:uid) { should eq "771417286" }
10
+ its(:provider) { should eq "facebook" }
11
+ its(:first_name) { should eq "Stefano" }
12
+ its(:last_name) { should eq "Verna" }
13
+ its(:email) { should eq "stefano.verna@welaika.com" }
14
+ its(:image) { should eq "http://graph.facebook.com/771417286/picture?type=square" }
15
+ end
16
+ end
17
+
18
+
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ module Socialmux::AuthMapper
4
+ describe Github do
5
+ subject do
6
+ Github.new(read_json('github_response'))
7
+ end
8
+
9
+ its(:uid) { should eq "51573" }
10
+ its(:provider) { should eq "github" }
11
+ its(:first_name) { should eq "Stefano" }
12
+ its(:last_name) { should eq "Verna" }
13
+ its(:email) { should eq "stefano.verna@gmail.com" }
14
+ its(:image) { should eq "https://secure.gravatar.com/avatar/f1b1c16a5b246b3b7cff8d8a07aa9725?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" }
15
+ end
16
+ end
17
+
18
+
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ module Socialmux::AuthMapper
4
+ describe GoogleOauth2 do
5
+ subject do
6
+ GoogleOauth2.new(read_json('google_response'))
7
+ end
8
+
9
+ its(:uid) { should eq "106136318376168001814" }
10
+ its(:provider) { should eq "google_oauth2" }
11
+ its(:first_name) { should eq "Stefano" }
12
+ its(:last_name) { should eq "Verna" }
13
+ its(:email) { should eq "stefano.verna@gmail.com" }
14
+ its(:image) { should eq "https://lh3.googleusercontent.com/-Mk9Xg5Qy_vc/AAAAAAAAAAI/AAAAAAAAAK4/h0ffVEFGrTo/photo.jpg" }
15
+ end
16
+ end
17
+
18
+
19
+
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ module Socialmux::AuthMapper
4
+ describe Linkedin do
5
+ subject do
6
+ Linkedin.new(read_json('linkedin_response'))
7
+ end
8
+
9
+ its(:uid) { should eq "yCmV0Ms_fg" }
10
+ its(:provider) { should eq "linkedin" }
11
+ its(:first_name) { should eq "Stefano" }
12
+ its(:last_name) { should eq "Verna" }
13
+ its(:email) { should eq "stefano.verna@gmail.com" }
14
+ its(:image) { should eq "http://m.c.lnkd.licdn.com/mpr/mprx/0_dCvykIIfOoeQZqWUdXQ_keMhpEuE4-4UIhTikeHriWZsFnfR5k5KoHyO-G2vUzJBHTBCwfsBBN4N" }
15
+ its(:description) { should eq "Software Engineer at weLaika" }
16
+ end
17
+ end
18
+
19
+
20
+
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ module Socialmux::AuthMapper
6
+ describe Twitter do
7
+ subject do
8
+ Twitter.new(read_json('twitter_response'))
9
+ end
10
+
11
+ its(:uid) { should eq "5521662" }
12
+ its(:provider) { should eq "twitter" }
13
+ its(:first_name) { should eq "Stefano" }
14
+ its(:last_name) { should eq "Verna" }
15
+ its(:email) { should be nil }
16
+ its(:image) { should eq "http://a0.twimg.com/profile_images/3060238387/a9b2a4cd85377cf0c12b22fedcac80b3_normal.png" }
17
+ its(:description) { should eq "28 years, 2 babies, Rails and iOS developer, cofounder of @weLaika. Tweet me anytime! ♥" }
18
+ end
19
+ end
20
+
21
+
22
+
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ module Socialmux
4
+ describe Result do
5
+ let (:user) { stub('User') }
6
+
7
+ subject do
8
+ Result.new(user, Event::SIGN_UP)
9
+ end
10
+
11
+ it "implements dynamic boolean methods for events" do
12
+ expect(subject.sign_up?).to be_true
13
+ expect(subject.sign_in?).to be_false
14
+ end
15
+ end
16
+ end
17
+