Some API suggestions:
First, get rid of camel case! That, or at least provide aliases, e.g.
gmail.fetch_box vs gmail.fetchBox.
Second, since you must call setLoginInfo in order to do just about
anything, then I would recommend allowing users to pass that information
to the constructor as a shortcut. So, your constructor would look like
this:
def initialize(name, password, charset='UTF-8')
...
setLoginInfo(name, password)
end
Let's folks skip a step.
Regards,
Dan
PS - I'll post these suggestions on the project page as well.
···
-----Original Message-----
From: Park Heesob [mailto:phasis@bcline.com]
Sent: Tuesday, August 16, 2005 8:01 AM
To: ruby-talk ML
Subject: [ANN] gmailer 0.0.1 (plain text)Hi,
Sorry for previous encoding message.
I'm happy to announce first version of GMailer, a class for
interface to
Google's webmail service.You can fetching gmails
require "gmailer"
gmail = GMailer.new
gmail.setLoginInfo(name, pwd)
if gmail.connect
gmail.fetchBox(GM_LABEL, "my_label", 0)
snapshot = gmail.getSnapshot(GM_LABEL)
if snapshot
puts "Total # of conversations of my_label = " +
snapshot.box_total.to_send
gmail.disconnect
endSending new gmails
require "gmailer"
gmail = GMailer.new
gmail.setLoginInfo(name, pwd)
if gmail.connect
to = "who@what.com, my_friend@his_company.com, god@heaven.org"
cc = "foo@bar.com"
subj = "Hello There!"
message = "Hi...\n\nBlah blah blah~..."
attachments = ["./my_pic.jpg", "./my_cv.txt"]
gmail.send(to, subj, message, cc, '','', '',
attachments, false, '')
endOr playing around with contact list
require "gmailer"
gmail = GMailer.new
gmail.setLoginInfo(name, pwd)
if gmail.connect
gmail.fetchBox(GM_CONTACT, "freq", 0)
snapshot = gmail.getSnapshot(GM_CONTACT)
puts "Your frequently used addresses:"
snapshot.contacts.each { |item|
puts "Name: " + item["name"] + ", Email: " + item["email"]
}
endYou can find out more about GMailer at: