Home > Archive > Ruby > August 2005 > [ANN] gmailer-0.0.7
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
[ANN] gmailer-0.0.7
|
|
| Park Heesob 2005-08-30, 7:02 pm |
|
GMailer 0.0.7 Released
=======================
This is the 0.0.7 release of GMailer.
This is a class library for interface to Google's webmail service.
What is GMailer?
-----------------
GMailer can fetch mails, save attachements, get cotact lists, invite someone
or send message with file attachments. It provides edit methods for labels,
preferece settings, starring,archiving message and spam,trash managements.
What's new in this release?
---------------------------
Added apply_star, remove_star method for editing starring a message
Added archive, unarchive method for archiving a message
Rename get_ method e.g. get_messages -> messages, get_labels -> labels
Added mark_read, mark_unread, report_spam, not_spam method
Added trash_in, trash_out, delete_message, delete_spam, delete_trash method
How to use GMailer?
-----------------------
Sample usage:
GMailer.connect(name,pwd) do |g|
#fetch
g.fetch(:label=>"my_label") {|s|
puts "Total # of conversations of my_label = " + s.box_total.to_s
}
#get contact
g.fetch(:contact=>"freq").each do |item|
puts "Name: #{item['name']} Email: #{item['email']}"
end
#send message
g.send(
:to => "whoo@foo.bar",
:subject => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./test.txt"]
)
# update_preference
g.update_preference(:max_page_size=>50,
:keyboard_shortcuts=>true,
:indicators=>true,
:display_language=>'en',
:signature=>'This is a signature',
:reply_to=>'return@foo.bar',
:snippets=>true,
:display_name=>'Display Name')
# get preference
pref = g.preference
puts "Display language:#{pref['display_language']}, Max Page
Size:#{pref['max_page_size']}"
#creating new labels
g.create_label('label_name')
#renaming existing labels
g. rename_label('label_name','renamed_label
')
#deleting labels
g.delete_label('label_name')
#applying a label to a message
g.apply_label(msgid,'label_name')
#removing a label from a message
g.remove_label(msgid,'label_name')
#apply star to a message
g.apply_star(msgid)
#remove star from a message
g.remove_star(msgid)
#archive a message
g.archive(msgid)
#unarchive a message
g.unarchive(msgid)
#mark a message as read
g.mark_read(msgid)
#mark a message as unread
g.mark_unread(msgid)
#report a message as not spam
g.report_spam(msgid)
#report a message as not spam
g.not_spam(msgid)
#move a message to trash
g.trash_in(msgid)
#move a message from trash to inbox
g.trash_out(msgid)
#delete a trash message forever
g.delete_trash(msgid)
#delete a spam message forever
g.delete_spam(msgid)
#delete a message forever
g.delete_message(msgid)
#get labels
labels = g.labels
#get messages
g.messages(:label=>labels[0]).each {|m|
puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']
}
#get inbox messages
g.messages(:standard=>'inbox').each {|m|
puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']
}
end
Project:: http://rubyforge.org/projects/gmailutils/
Bugs:: http://rubyforge.org/tracker/?group_id=869
Document:: http://rubyforge.org/docman/?group_id=869
Download:: http://rubyforge.org/frs/?group_id=869
How do I get GMailer?
----------------------
If you have RubyGems installed:
$ sudo gem install gmailer # in *NIX
> gem install gmailer # in Windows
Or not, download the latest release from
http://rubyforge.org/frs/?group_id=869
and run install.rb
Regards,
Park Heesob
| |
| Shashank Date 2005-08-30, 7:02 pm |
| Hi Park,
--- Park Heesob <phasis@bcline.com> wrote:
<snip>
=20
> #applying a label to a message
> g.apply_label(msgid,'label_name')
^^^^^^
<snip>
I got an error at this line:
------------------------------
C:\atest>ruby tst_gmailer7.rb
my password :-)
Total # of conversations of my_label =3D 0
Name: shanko_date Email: shanko_date@yahoo.com
Name: shashank Email: shashank@juno.com
Display language:en, Max Page Size:50
tst_gmailer7.rb:48: undefined local variable or method `msgid' for main:O=
bject (NameError)
from tst_gmailer7.rb:5:in `connect'
from tst_gmailer7.rb:5
-------------------------------
And all I had to do was add this before that line:
msgid =3D nil
It worked like a charm ... even after connecting with the proxy server.
Thanks for this great release.
-- shanko
________________________________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around=20
http://mail.yahoo.com=20
| |
| Daniel Schierbeck 2005-08-30, 7:02 pm |
| Great work!
Another idea for a change of method names: use "connected?" instead of
"is_connected".
Keep up the good work!
Cheers,
Daniel
|
|
|
|
|