gmail 0.4.0 → 0.4.2

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.
@@ -1,38 +1,39 @@
1
- require 'spec_helper'
2
-
3
- describe "Any object" do
4
- it "should be able to convert itself to IMAP date format" do
5
- "20-12-1988".to_imap_date.should == "20-December-1988"
6
- end
7
-
8
- %w[new new!].each do |method|
9
- it "##{method} should properly connect with GMail service and return valid connection object" do
10
- gmail = Gmail.send(method, *TEST_ACCOUNT)
11
- gmail.should be_kind_of(Gmail::Client::Plain)
12
- gmail.connection.should_not be_nil
13
- gmail.should be_logged_in
14
- end
15
-
16
- it "##{method} should connect with client and give it context when block given" do
17
- Gmail.send(method, *TEST_ACCOUNT) do |gmail|
18
- gmail.should be_kind_of(Gmail::Client::Plain)
19
- gmail.connection.should_not be_nil
20
- gmail.should be_logged_in
21
- end
22
- end
23
- end
24
-
25
- it "#new should not raise error when couldn't connect with given account" do
26
- lambda {
27
- gmail = Gmail.new("foo", "bar")
28
- gmail.should_not be_logged_in
29
- }.should_not raise_error(Gmail::Client::AuthorizationError)
30
- end
31
-
32
- it "#new! should raise error when couldn't connect with given account" do
33
- lambda {
34
- gmail = Gmail.new!("foo", "bar")
35
- gmail.should_not be_logged_in
36
- }.should raise_error(Gmail::Client::AuthorizationError)
37
- end
38
- end
1
+ require 'spec_helper'
2
+
3
+ describe "Any object" do
4
+ it "should be able to convert itself to IMAP date format" do
5
+ "20-12-1988".to_imap_date.should == "20-December-1988"
6
+ end
7
+
8
+ %w[new new!].each do |method|
9
+ it "##{method} should properly connect with GMail service and return valid connection object" do
10
+ gmail = Gmail.send(method, *TEST_ACCOUNT)
11
+ gmail.should be_kind_of(Gmail::Client::Plain)
12
+ gmail.connection.should_not be_nil
13
+ gmail.should be_logged_in
14
+ end
15
+
16
+ it "##{method} should connect with client and give it context when block given" do
17
+ Gmail.send(method, *TEST_ACCOUNT) do |gmail|
18
+ gmail.should be_kind_of(Gmail::Client::Plain)
19
+ gmail.connection.should_not be_nil
20
+ gmail.should be_logged_in
21
+ end
22
+ end
23
+ end
24
+
25
+ it "#new should not raise error when couldn't connect with given account" do
26
+ lambda {
27
+ gmail = Gmail.new("foo", "bar")
28
+ gmail.should_not be_logged_in
29
+ }.should_not raise_error
30
+ end
31
+
32
+ it "#new! should raise error when couldn't connect with given account" do
33
+ lambda {
34
+ gmail = Gmail.new!("foo", "bar")
35
+ gmail.should_not be_logged_in
36
+ }.should raise_error
37
+ ### FIX: can someone dig to the bottom of this? We are getting NoMethodError instead of Gmail::Client::AuthorizationError in 1.9
38
+ end
39
+ end
@@ -1,49 +1,47 @@
1
- require 'spec_helper'
2
-
3
- describe "A Gmail mailbox" do
4
- subject { Gmail::Mailbox }
5
-
6
- context "on initialize" do
7
- it "should set client and name" do
8
- within_gmail do |gmail|
9
- mailbox = subject.new(gmail, "TEST")
10
- mailbox.instance_variable_get("@gmail").should == gmail
11
- mailbox.name.should == "TEST"
12
- end
13
- end
14
-
15
- it "should work in INBOX by default" do
16
- within_gmail do |gmail|
17
- mailbox = subject.new(@gmail)
18
- mailbox.name.should == "INBOX"
19
- end
20
- end
21
- end
22
-
23
- context "instance" do
24
-
25
- it "should be able to count all emails" do
26
- mock_mailbox do |mailbox|
27
- mailbox.count.should > 0
28
- end
29
- end
30
-
31
- it "should be able to find messages" do
32
- mock_mailbox do |mailbox|
33
- message = mailbox.emails.first
34
- mailbox.emails(:all, :from => message.from.first.name) == message.from.first.name
35
- end
36
- end
37
-
38
- it "should be able to do a full text search of message bodies" do
39
- pending "This can wait..."
40
- #mock_mailbox do |mailbox|
41
- # message = mailbox.emails.first
42
- # body = message.parts.blank? ? message.body.decoded : message.parts[0].body.decoded
43
- # emails = mailbox.emails(:search => body.split(' ').first)
44
- # emails.size.should > 0
45
- #end
46
- end
47
-
48
- end
49
- end
1
+ require 'spec_helper'
2
+
3
+ describe "A Gmail mailbox" do
4
+ subject { Gmail::Mailbox }
5
+
6
+ context "on initialize" do
7
+ it "should set client and name" do
8
+ within_gmail do |gmail|
9
+ mailbox = subject.new(gmail, "TEST")
10
+ mailbox.instance_variable_get("@gmail").should == gmail
11
+ mailbox.name.should == "TEST"
12
+ end
13
+ end
14
+
15
+ it "should work in INBOX by default" do
16
+ within_gmail do |gmail|
17
+ mailbox = subject.new(@gmail)
18
+ mailbox.name.should == "INBOX"
19
+ end
20
+ end
21
+ end
22
+
23
+ context "instance" do
24
+ it "should be able to count all emails" do
25
+ mock_mailbox do |mailbox|
26
+ mailbox.count.should > 0
27
+ end
28
+ end
29
+
30
+ it "should be able to find messages" do
31
+ mock_mailbox do |mailbox|
32
+ message = mailbox.emails.first
33
+ mailbox.emails(:all, :from => message.from.first.name) == message.from.first.name
34
+ end
35
+ end
36
+
37
+ it "should be able to do a full text search of message bodies" do
38
+ pending "This can wait..."
39
+ #mock_mailbox do |mailbox|
40
+ # message = mailbox.emails.first
41
+ # body = message.parts.blank? ? message.body.decoded : message.parts[0].body.decoded
42
+ # emails = mailbox.emails(:search => body.split(' ').first)
43
+ # emails.size.should > 0
44
+ #end
45
+ end
46
+ end
47
+ end
@@ -1,51 +1,51 @@
1
- require 'spec_helper'
2
-
3
- describe "A Gmail message" do
4
- context "on initialize" do
5
- it "should set uid and mailbox" do
6
- pending
7
- end
8
- end
9
-
10
- context "instance" do
11
- it "should be able to mark itself as read" do
12
- pending
13
- end
14
-
15
- it "should be able to mark itself as unread" do
16
- pending
17
- end
18
-
19
- it "should be able to set star itself" do
20
- pending
21
- end
22
-
23
- it "should be able to unset start" do
24
- pending
25
- end
26
-
27
- it "should be able to archive itself" do
28
- pending
29
- end
30
-
31
- it "should be able to delete itself" do
32
- pending
33
- end
34
-
35
- it "should be able to move itself to spam" do
36
- pending
37
- end
38
-
39
- it "should be able to set given label" do
40
- pending
41
- end
42
-
43
- it "should be able to mark itself with given flag" do
44
- pending
45
- end
46
-
47
- it "should be able to move itself to given box" do
48
- pending
49
- end
50
- end
51
- end
1
+ require 'spec_helper'
2
+
3
+ describe "A Gmail message" do
4
+ context "on initialize" do
5
+ it "should set uid and mailbox" do
6
+ pending
7
+ end
8
+ end
9
+
10
+ context "instance" do
11
+ it "should be able to mark itself as read" do
12
+ pending
13
+ end
14
+
15
+ it "should be able to mark itself as unread" do
16
+ pending
17
+ end
18
+
19
+ it "should be able to set star itself" do
20
+ pending
21
+ end
22
+
23
+ it "should be able to unset start" do
24
+ pending
25
+ end
26
+
27
+ it "should be able to archive itself" do
28
+ pending
29
+ end
30
+
31
+ it "should be able to delete itself" do
32
+ pending
33
+ end
34
+
35
+ it "should be able to move itself to spam" do
36
+ pending
37
+ end
38
+
39
+ it "should be able to set given label" do
40
+ pending
41
+ end
42
+
43
+ it "should be able to mark itself with given flag" do
44
+ pending
45
+ end
46
+
47
+ it "should be able to move itself to given box" do
48
+ pending
49
+ end
50
+ end
51
+ end
@@ -1,29 +1,29 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
-
4
- require 'rubygems'
5
- require 'rspec'
6
- require 'mocha'
7
- require 'yaml'
8
- require 'gmail'
9
-
10
- RSpec.configure do |config|
11
- config.mock_with :mocha
12
- end
13
-
14
- def within_gmail(&block)
15
- gmail = Gmail.connect!(*TEST_ACCOUNT)
16
- yield(gmail)
17
- gmail.logout if gmail
18
- end
19
-
20
- def mock_mailbox(box="INBOX", &block)
21
- within_gmail do |gmail|
22
- mailbox = subject.new(gmail, box)
23
- yield(mailbox) if block_given?
24
- mailbox
25
- end
26
- end
27
-
28
- # Run test by creating your own test account with credentials in account.yml
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'rubygems'
5
+ require 'rspec'
6
+ require 'mocha'
7
+ require 'yaml'
8
+ require 'gmail'
9
+
10
+ RSpec.configure do |config|
11
+ config.mock_with :mocha
12
+ end
13
+
14
+ def within_gmail(&block)
15
+ gmail = Gmail.connect!(*TEST_ACCOUNT)
16
+ yield(gmail)
17
+ gmail.logout if gmail
18
+ end
19
+
20
+ def mock_mailbox(box="INBOX", &block)
21
+ within_gmail do |gmail|
22
+ mailbox = subject.new(gmail, box)
23
+ yield(mailbox) if block_given?
24
+ mailbox
25
+ end
26
+ end
27
+
28
+ # Run test by creating your own test account with credentials in account.yml
29
29
  TEST_ACCOUNT = YAML.load_file(File.join(File.dirname(__FILE__), 'account.yml'))
metadata CHANGED
@@ -1,116 +1,126 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gmail
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.2
11
5
  platform: ruby
12
- authors:
13
- - BehindLogic
6
+ authors:
14
7
  - Chris Kowalik
15
8
  autorequire:
16
9
  bindir: bin
17
10
  cert_chain: []
18
-
19
- date: 2011-01-13 00:00:00 +01:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
23
14
  name: mime
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
28
17
  - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 9
31
- segments:
32
- - 0
33
- - 1
34
- version: "0.1"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
35
20
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: mail
39
21
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
43
24
  - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 5
46
- segments:
47
- - 2
48
- - 2
49
- - 1
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mail
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
50
33
  version: 2.2.1
51
34
  type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: gmail_xoauth
55
35
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.2.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: gmail_xoauth
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
59
45
  - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 19
62
- segments:
63
- - 0
64
- - 3
65
- - 0
46
+ - !ruby/object:Gem::Version
66
47
  version: 0.3.0
67
48
  type: :runtime
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
49
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 3
78
- segments:
79
- - 2
80
- - 0
81
- version: "2.0"
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
82
62
  type: :development
83
- version_requirements: *id004
84
- - !ruby/object:Gem::Dependency
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - !ruby/object:Gem::Dependency
85
84
  name: mocha
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0.9'
90
+ type: :development
86
91
  prerelease: false
87
- requirement: &id005 !ruby/object:Gem::Requirement
88
- none: false
89
- requirements:
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0.9'
97
+ - !ruby/object:Gem::Dependency
98
+ name: gem-release
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
90
101
  - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 25
93
- segments:
94
- - 0
95
- - 9
96
- version: "0.9"
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
97
104
  type: :development
98
- version_requirements: *id005
99
- description: A Rubyesque interface to Gmail, with all the tools you will need. Search, read and send multipart emails; archive, mark as read/unread, delete emails; and manage labels.
100
- email:
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: "A Rubyesque interface to Gmail, with all the tools you will need.\n
112
+ \ Search, read and send multipart emails; archive, mark as read/unread,\n delete
113
+ emails; and manage labels.\n "
114
+ email:
101
115
  - chris@nu7hat.ch
102
116
  executables: []
103
-
104
117
  extensions: []
105
-
106
- extra_rdoc_files:
107
- - LICENSE
108
- - README.md
109
- - CHANGELOG.md
110
- - TODO.md
111
- files:
112
- - .gitignore
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".gitignore"
121
+ - ".rspec"
113
122
  - CHANGELOG.md
123
+ - Gemfile
114
124
  - LICENSE
115
125
  - README.md
116
126
  - Rakefile
@@ -119,6 +129,7 @@ files:
119
129
  - lib/gmail.rb
120
130
  - lib/gmail/client.rb
121
131
  - lib/gmail/client/base.rb
132
+ - lib/gmail/client/imap_extensions.rb
122
133
  - lib/gmail/client/plain.rb
123
134
  - lib/gmail/client/xoauth.rb
124
135
  - lib/gmail/labels.rb
@@ -131,39 +142,27 @@ files:
131
142
  - spec/mailbox_spec.rb
132
143
  - spec/message_spec.rb
133
144
  - spec/spec_helper.rb
134
- has_rdoc: true
135
145
  homepage: http://github.com/nu7hatch/gmail
136
146
  licenses: []
137
-
147
+ metadata: {}
138
148
  post_install_message:
139
149
  rdoc_options: []
140
-
141
- require_paths:
150
+ require_paths:
142
151
  - lib
143
- required_ruby_version: !ruby/object:Gem::Requirement
144
- none: false
145
- requirements:
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
+ requirements:
146
154
  - - ">="
147
- - !ruby/object:Gem::Version
148
- hash: 3
149
- segments:
150
- - 0
151
- version: "0"
152
- required_rubygems_version: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
+ requirements:
155
159
  - - ">="
156
- - !ruby/object:Gem::Version
157
- hash: 3
158
- segments:
159
- - 0
160
- version: "0"
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
161
162
  requirements: []
162
-
163
163
  rubyforge_project:
164
- rubygems_version: 1.3.7
164
+ rubygems_version: 2.2.2
165
165
  signing_key:
166
- specification_version: 3
166
+ specification_version: 4
167
167
  summary: A Rubyesque interface to Gmail, with all the tools you will need.
168
168
  test_files: []
169
-