erc-contacts 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitmodules +3 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +96 -0
- data/LICENSE +18 -0
- data/README.markdown +111 -0
- data/Rakefile +32 -0
- data/VERSION +1 -0
- data/erc-contacts.gemspec +91 -0
- data/lib/contacts.rb +90 -0
- data/lib/contacts/consumer.rb +123 -0
- data/lib/contacts/google.rb +85 -0
- data/lib/contacts/oauth_consumer.rb +71 -0
- data/lib/contacts/railtie.rb +14 -0
- data/lib/contacts/util.rb +24 -0
- data/lib/contacts/version.rb +10 -0
- data/lib/contacts/windows_live.rb +192 -0
- data/lib/contacts/yahoo.rb +89 -0
- data/pkg/kulesa-contacts-0.2.6.gem +0 -0
- data/spec/config/contacts.yml +15 -0
- data/spec/contact_spec.rb +29 -0
- data/spec/feeds/google-many.xml +76 -0
- data/spec/feeds/wl_contacts.xml +29 -0
- data/spec/feeds/yh_contacts.txt +241 -0
- data/spec/gmail/google_spec.rb +54 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/windows_live/windows_live_spec.rb +44 -0
- data/spec/yahoo/yahoo_spec.rb +52 -0
- metadata +200 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'contacts/google'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
describe Contacts::Google do
|
6
|
+
before(:each) do
|
7
|
+
config = YAML.load_file(File.expand_path("../../config/contacts.yml", __FILE__))
|
8
|
+
Contacts.configure(config["test"])
|
9
|
+
@google = Contacts::Google.new
|
10
|
+
fake_responses
|
11
|
+
end
|
12
|
+
|
13
|
+
context "return_url" do
|
14
|
+
it "should allow the return url to be set in the config" do
|
15
|
+
@google.return_url.should_not == nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "authentication_url" do
|
20
|
+
it "should return an authentication url" do
|
21
|
+
@google.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the return url from configuration if the return url is not set" do
|
25
|
+
@google.authentication_url().length.should_not == 0
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "authorize" do
|
30
|
+
it "should set the access token if the authoriztion is granted" do
|
31
|
+
@google.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
32
|
+
@google.authorize({})
|
33
|
+
@google.access_token.should_not == nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "contacts" do
|
38
|
+
it "should return an array of contacts (all users with email addresses)" do
|
39
|
+
@google.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
40
|
+
@google.authorize({})
|
41
|
+
contacts = @google.contacts
|
42
|
+
contacts.should_not == nil
|
43
|
+
contacts.length.should == 3
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return multiple email addresses for user with multiple email addresses" do
|
47
|
+
@google.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
48
|
+
@google.authorize({})
|
49
|
+
contacts = @google.contacts
|
50
|
+
contacts[1].emails.length.should == 2
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'fake_web'
|
2
|
+
|
3
|
+
FakeWeb.allow_net_connect = false
|
4
|
+
|
5
|
+
RSpec.configure do |c|
|
6
|
+
c.run_all_when_everything_filtered = true
|
7
|
+
end
|
8
|
+
p
|
9
|
+
def fake_responses
|
10
|
+
FakeWeb.register_uri(:post, 'https://www.google.com/accounts/OAuthGetRequestToken', :body => 'oauth_token=faketoken&oauth_token_secret=faketokensecret')
|
11
|
+
FakeWeb.register_uri(:post, 'https://www.google.com/accounts/OAuthGetAccessToken', :body => 'oauth_token=fake&oauth_token_secret=fake')
|
12
|
+
FakeWeb.register_uri(:get, 'https://www.google.com/m8/feeds/contacts/default/thin?max-results=200', :body => feeds('google-many.xml'))
|
13
|
+
FakeWeb.register_uri(:post, 'https://api.login.yahoo.com/oauth/v2/get_request_token', :body => 'oauth_token=faketoken&oauth_token_secret=faketokensecret')
|
14
|
+
FakeWeb.register_uri(:post, 'https://api.login.yahoo.com/oauth/v2/get_token', :body => 'oauth_token=fake&oauth_token_secret=fake&xoauth_yahoo_guid=tester')
|
15
|
+
FakeWeb.register_uri(:get, 'http://social.yahooapis.com/v1/user/tester/contacts?count=200&sort=asc&sort-fields=email&format=json', :body => feeds('yh_contacts.txt'))
|
16
|
+
FakeWeb.register_uri(:get, 'https://livecontacts.services.live.com/users/@L@/rest/invitationsbyemail', :body => feeds('wl_contacts.xml'))
|
17
|
+
end
|
18
|
+
|
19
|
+
def feeds(*path)
|
20
|
+
File.join(File.dirname(__FILE__), "feeds", path)
|
21
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'contacts/windows_live'
|
3
|
+
|
4
|
+
describe Contacts::WindowsLive do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
config = YAML.load_file(File.expand_path("../../config/contacts.yml", __FILE__))
|
8
|
+
Contacts.configure(config["test"])
|
9
|
+
@wl = Contacts::WindowsLive.new
|
10
|
+
@wl.delegation_token = "fake_token"
|
11
|
+
@wl.token_expires_at = Time.now+1
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
context "return_url" do
|
16
|
+
it "should allow the return url to be set in the config" do
|
17
|
+
@wl.return_url.should_not == nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the return url from configuration if the return url is not set" do
|
21
|
+
@wl.authentication_url().length.should_not == 0
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
context "authentication_url" do
|
27
|
+
it "should return an authentication url" do
|
28
|
+
@wl.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "contacts" do
|
33
|
+
it "should return an array of contacts (all users with email addresses)" do
|
34
|
+
contacts = @wl.contacts
|
35
|
+
contacts.should_not == nil
|
36
|
+
contacts.length.should == 3
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should contain a single name which is a join of the first and last name fields" do
|
40
|
+
contacts = @wl.contacts
|
41
|
+
contacts[1].name.should == "Rafael Timbo"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'contacts/yahoo'
|
3
|
+
|
4
|
+
describe Contacts::Yahoo do
|
5
|
+
before(:each) do
|
6
|
+
config = YAML.load_file(File.expand_path("../../config/contacts.yml", __FILE__))
|
7
|
+
Contacts.configure(config["test"])
|
8
|
+
@yahoo = Contacts::Yahoo.new
|
9
|
+
fake_responses
|
10
|
+
end
|
11
|
+
|
12
|
+
context "return_url" do
|
13
|
+
it "should allow the return url to be set in the config" do
|
14
|
+
@yahoo.return_url.should_not == nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "authentication_url" do
|
19
|
+
it "should return an authentication url" do
|
20
|
+
@yahoo.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return the return url from configuration if the return url is not set" do
|
24
|
+
@yahoo.authentication_url().length.should_not == 0
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "authorize" do
|
29
|
+
it "should set the access token if the authoriztion is granted" do
|
30
|
+
@yahoo.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
31
|
+
@yahoo.authorize({})
|
32
|
+
@yahoo.access_token.should_not == nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "contacts" do
|
37
|
+
it "should return an array of contacts (all users with email addresses)" do
|
38
|
+
@yahoo.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
39
|
+
@yahoo.authorize({})
|
40
|
+
contacts = @yahoo.contacts
|
41
|
+
contacts.should_not == nil
|
42
|
+
contacts.length.should == 3
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return multiple email addresses for user with multiple email addresses" do
|
46
|
+
@yahoo.authentication_url("http://browser.zen.turingstudio.com/test").length.should_not == 0
|
47
|
+
@yahoo.authorize({})
|
48
|
+
contacts = @yahoo.contacts
|
49
|
+
contacts[1].emails.length.should == 2
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erc-contacts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mislav Marohnic
|
8
|
+
- George Odata
|
9
|
+
- Julian Countu
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: httparty
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: hpricot
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: nokogiri
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.8.1
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.8.1
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: oauth
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.4.5
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.4.5
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: oj
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.0'
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '3.0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rspec
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 3.6.0
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 3.6.0
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: jeweler
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 2.3.7
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 2.3.7
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: mocha
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: fakeweb
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
description: Import users' contacts lists from Google, Yahoo!, and Windows Live.
|
142
|
+
email: kulesa@gmail.com
|
143
|
+
executables: []
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files:
|
146
|
+
- LICENSE
|
147
|
+
- README.markdown
|
148
|
+
files:
|
149
|
+
- ".gitmodules"
|
150
|
+
- Gemfile
|
151
|
+
- Gemfile.lock
|
152
|
+
- LICENSE
|
153
|
+
- README.markdown
|
154
|
+
- Rakefile
|
155
|
+
- VERSION
|
156
|
+
- erc-contacts.gemspec
|
157
|
+
- lib/contacts.rb
|
158
|
+
- lib/contacts/consumer.rb
|
159
|
+
- lib/contacts/google.rb
|
160
|
+
- lib/contacts/oauth_consumer.rb
|
161
|
+
- lib/contacts/railtie.rb
|
162
|
+
- lib/contacts/util.rb
|
163
|
+
- lib/contacts/version.rb
|
164
|
+
- lib/contacts/windows_live.rb
|
165
|
+
- lib/contacts/yahoo.rb
|
166
|
+
- pkg/kulesa-contacts-0.2.6.gem
|
167
|
+
- spec/config/contacts.yml
|
168
|
+
- spec/contact_spec.rb
|
169
|
+
- spec/feeds/google-many.xml
|
170
|
+
- spec/feeds/wl_contacts.xml
|
171
|
+
- spec/feeds/yh_contacts.txt
|
172
|
+
- spec/gmail/google_spec.rb
|
173
|
+
- spec/spec_helper.rb
|
174
|
+
- spec/windows_live/windows_live_spec.rb
|
175
|
+
- spec/yahoo/yahoo_spec.rb
|
176
|
+
homepage: https://github.com/kulesa/contacts
|
177
|
+
licenses:
|
178
|
+
- MIT
|
179
|
+
metadata: {}
|
180
|
+
post_install_message:
|
181
|
+
rdoc_options: []
|
182
|
+
require_paths:
|
183
|
+
- lib
|
184
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
requirements: []
|
195
|
+
rubyforge_project:
|
196
|
+
rubygems_version: 2.5.1
|
197
|
+
signing_key:
|
198
|
+
specification_version: 4
|
199
|
+
summary: Import users' contacts lists from Google, Yahoo!, and Windows Live.
|
200
|
+
test_files: []
|