bitsa 0.10

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.
@@ -0,0 +1,16 @@
1
+ ---
2
+ - "2010-01-21T21:06:45.766Z"
3
+ - http://www.google.com/m8/feeds/contacts/person%40example.org/base/637e301a8e9c166e:
4
+ - - test1@example.com
5
+ - My Tester
6
+ http://www.google.com/m8/feeds/contacts/person%40example.org/base/637e301a8e9c176e:
7
+ - - john_smith@here.org
8
+ - ""
9
+ http://www.google.com/m8/feeds/contacts/person%40example.org/base/637e301a549c176e:
10
+ - - Joan.bloggs@somewhere.com.au
11
+ - Joan Bloggshere
12
+ http://www.google.com/m8/feeds/contacts/person%40example.org/base/685e301a549c176e:
13
+ - - email1@somewhere.com
14
+ - Mr Multiple
15
+ - - email2@somewhere.com
16
+ - Mr Multiple
@@ -0,0 +1,3 @@
1
+ ---
2
+ :login: test@gmail.com
3
+ :password: myPassword
@@ -0,0 +1,89 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ require 'fakeweb'
4
+
5
+ require "bitsa/contacts_cache"
6
+ require "bitsa/gmail_contacts_loader"
7
+
8
+ describe Bitsa::GmailContactsLoader do
9
+ context "Bitsa::GmailContactsLoader" do
10
+ before(:each) do
11
+ FakeWeb.allow_net_connect = false
12
+ FakeWeb.register_uri(:post, "https://www.google.com/accounts/ClientLogin",
13
+ :body => "SID=DQAAAGgA...7Zg8CTN\nLSID=DQAAAGsA...lk8BBbG\nAuth=DQAAAGgA...dk3fA5N")
14
+ FakeWeb.register_uri(:get, "http://www.google.com/m8/feeds/contacts/test/thin?orderby=lastmodified&showdeleted=true&max-results=25&start-index=1",
15
+ :body => <<eos
16
+ <feed gd:etag='W/&quot;AkANQXo7eCp7ImA9WxFTGUo.&quot;' xmlns:gContact='http://schemas.google.com/contact/2008' xmlns:gd='http://schemas.google.com/g/2005' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns='http://www.w3.org/2005/Atom'>
17
+ <id>
18
+ somebody@example.com
19
+ </id>
20
+ <updated>
21
+ 2010-04-11T09:39:50.400Z
22
+ </updated>
23
+ <category term='http://schemas.google.com/contact/2008#contact' scheme='http://schemas.google.com/g/2005#kind'/>
24
+ <title>
25
+ Somebodys's Contacts
26
+ </title>
27
+ <link href='http://www.google.com/' rel='alternate' type='text/html'/>
28
+ <link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin' rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml'/>
29
+ <link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin' rel='http://schemas.google.com/g/2005#post' type='application/atom+xml'/>
30
+ <link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin/batch' rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml'/>
31
+ <link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin?max-results=25' rel='self' type='application/atom+xml'/>
32
+ <author>
33
+ <name>
34
+ Somebody
35
+ </name>
36
+ <email>
37
+ somebody@example.com
38
+ </email>
39
+ </author>
40
+ <generator uri='http://www.google.com/m8/feeds' version='1.0'>
41
+ Contacts
42
+ </generator>
43
+ <openSearch:totalResults>
44
+ 1
45
+ </openSearch:totalResults>
46
+ <openSearch:startIndex>
47
+ 1
48
+ </openSearch:startIndex>
49
+ <openSearch:itemsPerPage>
50
+ 25
51
+ </openSearch:itemsPerPage>
52
+ <entry gd:etag='&quot;SHc-fTVSLyp7ImA9WxBaEkwIQAU.&quot;'>
53
+ <id>
54
+ http://www.google.com/m8/feeds/contacts/somebody%40example.com/base/0
55
+ </id>
56
+ <updated>
57
+ 2010-03-21T23:05:19.955Z
58
+ </updated>
59
+ <app:edited xmlns:app='http://www.w3.org/2007/app'>
60
+ 2010-03-21T23:05:19.955Z
61
+ </app:edited>
62
+ <category term='http://schemas.google.com/contact/2008#contact' scheme='http://schemas.google.com/g/2005#kind'/>
63
+ <title>
64
+ Jpe Bloggs
65
+ </title>
66
+ <link href='http://www.google.com/m8/feeds/photos/media/somebody%40example.com/0' gd:etag='&quot;bwR-YldFbCp7ImBIGHMMbBALQAwWIFMBVVc.&quot;' rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/*'/>
67
+ <link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin/0' rel='self' type='application/atom+xml'/>
68
+ <link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin/0' rel='edit' type='application/atom+xml'/>
69
+ <gd:email address='jbloggs@example.com' rel='http://schemas.google.com/g/2005#other' primary='true'/>
70
+ <gd:email address='another@example.com' rel='http://schemas.google.com/g/2005#work'/>
71
+ <gContact:groupMembershipInfo href='http://www.google.com/m8/feeds/groups/somebody%40example.com/base/6' deleted='false'/>
72
+ </entry>
73
+ </feed>
74
+ eos
75
+ )
76
+ end
77
+
78
+ it "should update cache" do
79
+ cache = mock('Bitsa::ContactsCache')
80
+ gcl = Bitsa::GmailContactsLoader.new('test', 'pw')
81
+ cache.should_receive(:update).once
82
+ cache.should_receive(:source_last_modified=).once
83
+ cache.should_receive(:source_last_modified)
84
+ cache.should_receive(:save).once
85
+ gcl.update_cache(cache)
86
+ end
87
+
88
+ end
89
+ end
@@ -0,0 +1,11 @@
1
+ require "rubygems"
2
+ # require "test/unit"
3
+ # require "shoulda"
4
+ # require 'mocha'
5
+ #require 'spec'
6
+
7
+ # begin
8
+ # require 'redgreen'
9
+ # rescue LoadError
10
+ # # ignore
11
+ # end
@@ -0,0 +1,34 @@
1
+ require "helper"
2
+ require "bitsa/config_file"
3
+ require "bitsa/settings"
4
+
5
+ describe Bitsa::Settings do
6
+ context "An existing Settings object" do
7
+
8
+ it "should read a value from config file if it wasn't passed in options" do
9
+ settings = load_settings({})
10
+ settings.login.should == "test@gmail.com"
11
+ settings.password.should == "myPassword"
12
+ end
13
+
14
+ it "should use values passed in options to override those in the config file" do
15
+ settings = load_settings({:login => "somebody@example.com"})
16
+ settings.login.should == "somebody@example.com"
17
+ end
18
+
19
+ it "should still use values in config file when other options passed" do
20
+ settings = load_settings({:login => "somebody@example.com"})
21
+ settings.password.should == "myPassword"
22
+ end
23
+
24
+ end
25
+
26
+ private
27
+
28
+ def load_settings(options)
29
+ settings = Bitsa::Settings.new
30
+ settings.load(Bitsa::ConfigFile.new("spec/data/config.yml"), options)
31
+ settings
32
+ end
33
+
34
+ end
@@ -0,0 +1,7 @@
1
+ desc "Create TAGS file"
2
+ task(:tags) do
3
+ puts "generating ctags..."
4
+ `ctags-exuberant -e -f TAGS --tag-relative -R lib spec`
5
+ puts "ctags generation completed."
6
+ end
7
+
@@ -0,0 +1,24 @@
1
+ # require "rexml/document"
2
+
3
+ # require "gdata"
4
+
5
+ # desc "Retrieve one page of Contacts and write to standard output"
6
+ # task(:retrieve_one_page) do
7
+ # email = "?????????"
8
+ # pw = "????"
9
+
10
+ # client = GData::Client::Contacts.new
11
+ # client.clientlogin(email, pw)
12
+
13
+ # url = "http://www.google.com/m8/feeds/contacts/#{email}/thin"
14
+ # data = client.get(url).to_xml
15
+ # fmt = REXML::Formatters::Pretty.new
16
+ # raw_data = ""
17
+ # fmt.write(data, raw_data)
18
+
19
+ # puts raw_data
20
+
21
+ # #Nokogiri::XML.Reader(raw_data).each do |node|
22
+ # # puts node.value
23
+ # #end
24
+ # end
@@ -0,0 +1,3 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec) {}
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bitsa
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 10
9
+ version: "0.10"
10
+ platform: ruby
11
+ authors:
12
+ - Colin Noel Bell
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-04-25 00:00:00 +10:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: trollop
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - "="
27
+ - !ruby/object:Gem::Version
28
+ hash: 17
29
+ segments:
30
+ - 1
31
+ - 15
32
+ version: "1.15"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: gdata
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - "="
42
+ - !ruby/object:Gem::Version
43
+ hash: 17
44
+ segments:
45
+ - 1
46
+ - 1
47
+ - 1
48
+ version: 1.1.1
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: bundler
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 23
60
+ segments:
61
+ - 1
62
+ - 0
63
+ - 0
64
+ version: 1.0.0
65
+ type: :development
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: rspec
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ hash: 62196431
76
+ segments:
77
+ - 2
78
+ - 0
79
+ - 0
80
+ - beta
81
+ - 22
82
+ version: 2.0.0.beta.22
83
+ type: :development
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: fakeweb
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ hash: 15
94
+ segments:
95
+ - 1
96
+ - 2
97
+ - 8
98
+ version: 1.2.8
99
+ type: :development
100
+ version_requirements: *id005
101
+ description: Allows you to lookup GMail contacts and cache contacts locally from the command line.
102
+ email:
103
+ - col@baibell.org
104
+ executables:
105
+ - bitsa
106
+ extensions: []
107
+
108
+ extra_rdoc_files: []
109
+
110
+ files:
111
+ - .gitignore
112
+ - .rspec
113
+ - COPYING
114
+ - Gemfile
115
+ - Gemfile.lock
116
+ - History.txt
117
+ - README.md
118
+ - Rakefile
119
+ - TAGS
120
+ - bin/bitsa
121
+ - bitsa.gemspec
122
+ - lib/bitsa.rb
123
+ - lib/bitsa/args_processor.rb
124
+ - lib/bitsa/config_file.rb
125
+ - lib/bitsa/contacts_cache.rb
126
+ - lib/bitsa/gmail_contacts_loader.rb
127
+ - lib/bitsa/settings.rb
128
+ - lib/bitsa/version.rb
129
+ - spec/args_processor_spec.rb
130
+ - spec/confg_file_spec.rb
131
+ - spec/contacts_cache_spec.rb
132
+ - spec/data/bitsa_cache.yml
133
+ - spec/data/config.yml
134
+ - spec/gmail_contacts_loader_spec.rb
135
+ - spec/helper.rb
136
+ - spec/settings_spec.rb
137
+ - tasks/create_tags.rake
138
+ - tasks/retrieve_one_page.rake
139
+ - tasks/spec.rake
140
+ has_rdoc: true
141
+ homepage: https://github.com/colbell/bitsa
142
+ licenses: []
143
+
144
+ post_install_message:
145
+ rdoc_options: []
146
+
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ hash: 3
155
+ segments:
156
+ - 0
157
+ version: "0"
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ none: false
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ hash: 23
164
+ segments:
165
+ - 1
166
+ - 3
167
+ - 6
168
+ version: 1.3.6
169
+ requirements: []
170
+
171
+ rubyforge_project:
172
+ rubygems_version: 1.3.7
173
+ signing_key:
174
+ specification_version: 3
175
+ summary: Command line GMail Contacts lookup tool.
176
+ test_files: []
177
+