ruby-gmail 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +7 -0
- data/README.txt +10 -2
- data/Rakefile +2 -0
- data/lib/gmail.rb +6 -1
- data/lib/mime/entity.rb +2 -2
- data/lib/mime/message.rb +1 -1
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
= ruby-gmail
|
2
2
|
|
3
|
-
* http://github.com/
|
3
|
+
* Homepage: http://dcparker.github.com/ruby-gmail/
|
4
|
+
* Code: http://github.com/dcparker/ruby-gmail
|
5
|
+
|
4
6
|
|
5
7
|
== DESCRIPTION:
|
6
8
|
|
7
9
|
A Rubyesque interface to Gmail. Connect to Gmail via IMAP and manipulate emails and labels. Send email with your Gmail account via SMTP. Includes full support for parsing and generating MIME messages.
|
8
10
|
|
9
|
-
== FEATURES
|
11
|
+
== FEATURES:
|
10
12
|
|
11
13
|
* Read emails via IMAP
|
12
14
|
* Full MIME parsing ability, with understanding of attachments
|
@@ -15,8 +17,14 @@ A Rubyesque interface to Gmail. Connect to Gmail via IMAP and manipulate emails
|
|
15
17
|
* Send emails via SMTP
|
16
18
|
* Full ability to generate MIME messages including inline images and attachments
|
17
19
|
|
20
|
+
== PROBLEMS:
|
21
|
+
|
22
|
+
* May not correctly read malformed MIME messages. This could possibly be corrected by having IMAP parse the MIME structure.
|
23
|
+
* Cannot grab the plain or html message without also grabbing attachments. It might be nice to lazy-[down]load attachments.
|
24
|
+
|
18
25
|
== SYNOPSIS:
|
19
26
|
|
27
|
+
require 'gmail'
|
20
28
|
gmail = Gmail.new(username, password)
|
21
29
|
gmail.inbox.count # => {:read => 41, :unread => 2}
|
22
30
|
unread = gmail.inbox.emails(:unread)
|
data/Rakefile
CHANGED
@@ -6,4 +6,6 @@ require 'hoe'
|
|
6
6
|
Hoe.spec 'ruby-gmail' do
|
7
7
|
developer 'Daniel Parker', 'gems@behindlogic.com'
|
8
8
|
extra_deps << ['shared-mime-info', '>= 0']
|
9
|
+
self.url = "http://dcparker.github.com/ruby-gmail"
|
10
|
+
self.post_install_message = "If you *really* like this gem, consider donating toward time for me to make it even better: http://pledgie.com/campaigns/7087"
|
9
11
|
end
|
data/lib/gmail.rb
CHANGED
@@ -3,7 +3,7 @@ require 'net/smtp'
|
|
3
3
|
require 'smtp_tls'
|
4
4
|
|
5
5
|
class Gmail
|
6
|
-
VERSION = '0.0.
|
6
|
+
VERSION = '0.0.3'
|
7
7
|
|
8
8
|
attr_reader :imap
|
9
9
|
|
@@ -69,10 +69,15 @@ class Gmail
|
|
69
69
|
puts "SMTP closed."
|
70
70
|
end
|
71
71
|
|
72
|
+
def new_message
|
73
|
+
MIME::Message.generate
|
74
|
+
end
|
75
|
+
|
72
76
|
def send_email(to, body=nil)
|
73
77
|
meta = class << self; self end
|
74
78
|
if to.is_a?(MIME::Message)
|
75
79
|
to.headers['from'] = meta.username
|
80
|
+
to.headers['date'] = Time.now.strftime("%a, %d %b %Y %H:%M:%S %z")
|
76
81
|
body = to.to_s
|
77
82
|
to = to.to
|
78
83
|
end
|
data/lib/mime/entity.rb
CHANGED
@@ -152,7 +152,7 @@ module MIME
|
|
152
152
|
# Converts this data structure into a string, but decoded if necessary
|
153
153
|
def decoded_content
|
154
154
|
return nil if @content.is_a?(Array)
|
155
|
-
case encoding.downcase
|
155
|
+
case encoding.to_s.downcase
|
156
156
|
when 'quoted-printable'
|
157
157
|
@content.unpack('M')[0]
|
158
158
|
when 'base64'
|
@@ -165,7 +165,7 @@ module MIME
|
|
165
165
|
# You can set new content, and it will be saved in encoded form.
|
166
166
|
def content=(raw)
|
167
167
|
@content = raw.is_a?(Array) ? raw :
|
168
|
-
case encoding.downcase
|
168
|
+
case encoding.to_s.downcase
|
169
169
|
when 'quoted-printable'
|
170
170
|
[raw].pack('M')
|
171
171
|
when 'base64'
|
data/lib/mime/message.rb
CHANGED
@@ -7,7 +7,7 @@ module MIME
|
|
7
7
|
# from an email message.
|
8
8
|
class Message < Entity
|
9
9
|
def self.generate
|
10
|
-
Message.new('
|
10
|
+
Message.new('content-type' => 'text/plain', 'mime-version' => '1.0')
|
11
11
|
end
|
12
12
|
|
13
13
|
def to(addressee=nil)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-gmail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Parker
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
teST6sOe8lUhZQ==
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2009-11-
|
33
|
+
date: 2009-11-20 00:00:00 -05:00
|
34
34
|
default_executable:
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
@@ -79,10 +79,10 @@ files:
|
|
79
79
|
- Rakefile
|
80
80
|
- README.txt
|
81
81
|
has_rdoc: true
|
82
|
-
homepage: http://github.com/
|
82
|
+
homepage: http://dcparker.github.com/ruby-gmail
|
83
83
|
licenses: []
|
84
84
|
|
85
|
-
post_install_message:
|
85
|
+
post_install_message: "If you *really* like this gem, consider donating toward time for me to make it even better: http://pledgie.com/campaigns/7087"
|
86
86
|
rdoc_options:
|
87
87
|
- --main
|
88
88
|
- README.txt
|
metadata.gz.sig
CHANGED
Binary file
|