omnicontacts 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/omnicontacts.rb +1 -1
- data/lib/omnicontacts/authorization/oauth2.rb +2 -2
- data/lib/omnicontacts/middleware/base_oauth.rb +1 -1
- data/spec/omnicontacts/authorization/oauth2_spec.rb +1 -1
- data/spec/omnicontacts/middleware/base_oauth_spec.rb +1 -1
- data/spec/omnicontacts/middleware/oauth1_spec.rb +2 -2
- data/spec/omnicontacts/middleware/oauth2_spec.rb +1 -1
- metadata +15 -45
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -36,7 +36,7 @@ On the other hand it makes things much easier to leave the default value for `:r
|
|
36
36
|
|
37
37
|
## Integrating with your Application
|
38
38
|
|
39
|
-
To use the Gem you first need to redirect your users to `/contacts/:importer`, where `:importer` can be
|
39
|
+
To use the Gem you first need to redirect your users to `/contacts/:importer`, where `:importer` can be gmail, yahoo or hotmail.
|
40
40
|
No changes to `config/routes.rb` are needed for this step since OmniContacts will be listening on that path and redirect the user to the email provider's website in order to authorize your app to access his contact list.
|
41
41
|
Once that is done the user will be redirected back to your application, to the path specified in `:redirect_path` (or `:callback_path` for yahoo).
|
42
42
|
If nothing is specified the default value is `/contacts/:importer/callback` (e.g. `/contacts/yahoo/callback`). This makes things simpler and you can just add the following line to `config/routes.rb`:
|
data/lib/omnicontacts.rb
CHANGED
@@ -30,8 +30,8 @@ module OmniContacts
|
|
30
30
|
:client_id => client_id,
|
31
31
|
:scope => encode(scope),
|
32
32
|
:response_type => "code",
|
33
|
-
:access_type => "
|
34
|
-
:approval_prompt => "
|
33
|
+
:access_type => "online",
|
34
|
+
:approval_prompt => "auto",
|
35
35
|
:redirect_uri => encode(redirect_uri)
|
36
36
|
})
|
37
37
|
end
|
@@ -84,7 +84,7 @@ module OmniContacts
|
|
84
84
|
|
85
85
|
def handle_error error_type, exception
|
86
86
|
logger << ("Error #{error_type} while processing #{@env["PATH_INFO"]}: #{exception.message}") if logger
|
87
|
-
[302, {"location" => "/contacts/failure?error_message=#{error_type}"}, []]
|
87
|
+
[302, {"location" => "/contacts/failure?error_message=#{error_type}&importer=#{class_name}"}, []]
|
88
88
|
end
|
89
89
|
|
90
90
|
def session
|
@@ -22,7 +22,7 @@ describe OmniContacts::Authorization::OAuth2 do
|
|
22
22
|
it { should include("client_id=#{test_target.client_id}") }
|
23
23
|
it { should include("scope=#{test_target.scope}") }
|
24
24
|
it { should include("redirect_uri=#{test_target.redirect_uri}") }
|
25
|
-
it { should include("access_type=
|
25
|
+
it { should include("access_type=online") }
|
26
26
|
it { should include("response_type=code") }
|
27
27
|
end
|
28
28
|
|
@@ -36,7 +36,7 @@ describe OmniContacts::Middleware::BaseOAuth do
|
|
36
36
|
get "/contacts/testprovider"
|
37
37
|
get "/contacts/testprovider/callback"
|
38
38
|
last_response.should be_redirect
|
39
|
-
last_response.headers["location"].should eq("/contacts/failure?error_message=internal_error")
|
39
|
+
last_response.headers["location"].should eq("/contacts/failure?error_message=internal_error&importer=testprovider")
|
40
40
|
end
|
41
41
|
|
42
42
|
after(:all) do
|
@@ -50,7 +50,7 @@ describe OmniContacts::Middleware::OAuth1 do
|
|
50
50
|
OAuth1Middleware.mock_auth_token_resp.should_receive(:body).and_raise("Request failed")
|
51
51
|
get "contacts/oauth1middleware"
|
52
52
|
last_response.should be_redirect
|
53
|
-
last_response.headers["location"].should eq("/contacts/failure?error_message=internal_error")
|
53
|
+
last_response.headers["location"].should eq("/contacts/failure?error_message=internal_error&importer=oauth1middleware")
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -66,7 +66,7 @@ describe OmniContacts::Middleware::OAuth1 do
|
|
66
66
|
OAuth1Middleware.mock_session.should_receive(:[]).and_return(nil)
|
67
67
|
get "/contacts/oauth1middleware/callback?oauth_token=token&oauth_verifier=verifier"
|
68
68
|
last_response.should be_redirect
|
69
|
-
last_response.headers["location"].should eq("/contacts/failure?error_message=not_authorized")
|
69
|
+
last_response.headers["location"].should eq("/contacts/failure?error_message=not_authorized&importer=oauth1middleware")
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -56,7 +56,7 @@ describe OmniContacts::Middleware::OAuth2 do
|
|
56
56
|
it "should redirect to failure page because user did not allow access to contacts list" do
|
57
57
|
get '/redirect_path?error=not_authorized'
|
58
58
|
last_response.should be_redirect
|
59
|
-
last_response.headers["location"].should eq("/contacts/failure?error_message=not_authorized")
|
59
|
+
last_response.headers["location"].should eq("/contacts/failure?error_message=not_authorized&importer=oauth2middleware")
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnicontacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &3692640 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
24
|
+
version_requirements: *3692640
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: json
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &3692410 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: '0'
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
35
|
+
version_requirements: *3692410
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: simplecov
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &3692200 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: '0'
|
54
44
|
type: :development
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
46
|
+
version_requirements: *3692200
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: rake
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &3691980 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ! '>='
|
@@ -69,15 +54,10 @@ dependencies:
|
|
69
54
|
version: '0'
|
70
55
|
type: :development
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
57
|
+
version_requirements: *3691980
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: rack-test
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &3691770 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ! '>='
|
@@ -85,15 +65,10 @@ dependencies:
|
|
85
65
|
version: '0'
|
86
66
|
type: :development
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
68
|
+
version_requirements: *3691770
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: rspec
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &3691540 !ruby/object:Gem::Requirement
|
97
72
|
none: false
|
98
73
|
requirements:
|
99
74
|
- - ! '>='
|
@@ -101,12 +76,7 @@ dependencies:
|
|
101
76
|
version: '0'
|
102
77
|
type: :development
|
103
78
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
79
|
+
version_requirements: *3691540
|
110
80
|
description: A generalized Rack middleware for importing contacts from major email
|
111
81
|
providers.
|
112
82
|
email:
|
@@ -165,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
135
|
version: 1.3.6
|
166
136
|
requirements: []
|
167
137
|
rubyforge_project:
|
168
|
-
rubygems_version: 1.8.
|
138
|
+
rubygems_version: 1.8.17
|
169
139
|
signing_key:
|
170
140
|
specification_version: 3
|
171
141
|
summary: A generalized Rack middleware for importing contacts from major email providers.
|