[ANN] gmailer 0.1.0

P

Park Heesob

GMailer 0.1.0 Released
=======================

This is the 0.1.0 release of GMailer by Park Heesob.
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 and archiving message.


What's new in this release?
---------------------------

Remove all hash return values.
Add some classes like Contact, Filter, Box, Converation.
Now all return value is Class or Array of classes.
Add msg method for message based operation.
Add each and each_msg method for MessageList.

Thanks Daniel Schierbeck and Gavin!

How to use GMailer?
-----------------------
Sample usage:

require 'gmailer'

GMailer.connect(name,pwd) do |g|
#fetch
g.messages:)label=>"my_label") do |ml|
puts "Total # of conversations of my_label = " + ml.total.to_s
end

#get contact
g.fetch:)contact=>"freq").each do |contact|
puts "Name: #{contact.name} Email: #{contact.email}"
end

#send message
# 'From' default gmail.com account
g.send(
:to => "(e-mail address removed), my_friend@his_company.com, (e-mail address removed)",
:cc => "(e-mail address removed)",
:subject => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./my_pic.jpg", "./my_cv.txt"])

# multiple verified email addresses and choose one 'From:' email address
g.send(
:from => "(e-mail address removed)",
:to => "(e-mail address removed), my_friend@his_company.com, (e-mail address removed)",
:cc => "(e-mail address removed)",
:subject => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./my_pic.jpg", "./my_cv.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=>'(e-mail address removed)',
:snippets=>true,
:display_name=>'Display Name')

# get preference
pref = g.preference
puts "Language:#{pref.display_language}, 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
m.msg(msgid).apply_label('label_name')

# message id based operation
g.msg(msgid) {|m|

#applying a label to a message
m.apply_label('label_name')

#removing a label from a message
m.apply_label('label_name')

#apply star to a message
m.apply_star

#remove star from a message
m.remove_star

#archive a message
m.archive

#unarchive a message
m.unarchive

#mark a message as read
m.mark_read

#mark a message as unread
m.mark_unread

#report a message as not spam
m.report_spam

#report a message as not spam
m.report_not_spam

#move a message to trash
m.trash

#move a message from trash to inbox
m.untrash

#delete a message forever
m.delete

#show original message
m.original
end

#get labels
labels = g.labels

#get messages list
g.messages:)label=>labels[0]).each {|m|
puts "Subject: #{m.subject}" if m.new?
}

#get inbox messages list
g.messages:)standard=>'inbox').each {|m|
puts "Subject: #{m.subject}" if m.new?
}

# fetch each converation with filter :read or :star
g.messages:)standard=>'all',:read=>false).each_msg {|msg|
# operations on the message
msg.apply_star
msg.apply_label(label)
msg.trash

puts "subject: " + msg.subject
puts "from: " + msg.sender
puts msg.body
puts msg.original
}

end


Regards,

Park Heesob
 
J

James Britt

Park said:
GMailer 0.1.0 Released
=======================

This is the 0.1.0 release of GMailer by Park Heesob.
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 and archiving message.


What's new in this release?
---------------------------

Remove all hash return values.
Add some classes like Contact, Filter, Box, Converation.
Now all return value is Class or Array of classes.
Add msg method for message based operation.
Add each and each_msg method for MessageList.


I've found all sorts of neat uses for this code. Thanks!

But, recent releases have broken stuff. I used to be able to
instantiate individual GMailer objects. That no longer works; it seems
the GMailer object has been replaced with a collection of procedures
hung together on a module namespace.

The examples suggest that I need to pass around user names and password
for each gmail action my code works with, rather than instantiating a
self-contained GMailer object for any number of different accounts,
which can be passed around to other objects that need not know the
details of the account, just that responds to the GMailer API.


BTW, the docs at

http://rubyforge.org/docman/view.php/869/194/README

describe assorted GMailer.new methods, but none seem to work for me:

undefined method `new' for GMailer:Module (NoMethodError)

Anyways, I can, I suppose, wrap the global method calls in some
container object in the meantime.

Thanks,


James

--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] gmailer 0.0.9 2
[ANN] gmailer-0.0.8 released 8
[ANN] gmailer-0.0.7 2
[ANN] gmailer 0.0.1 (plain text) 5
[ANN] gmailer-0.0.5 0
[ANN] gmailer 0.0.3 3
[ANN] gmailer-0.0.2 2
Problems with gmailer 2

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top