[ANN] gmailer-0.0.5

(Park Heesob) #1

GMailer is a class for interface to Google's webmail service.

It can fetch mails, save attachements, get cotact lists, invite someone
or send message with file attachments.

CHANGE since 0.0.4
- add create_label, delete_label, rename_label, apply_label, delete_label
- add update_preference, get_preference method
- fix some bugs

The usage is very simple and compact like this:

GMailer.connect(name,pwd) do |g|
  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']}"

      :to => "whoo@foo.bar",
      :subject => "Hello There!",
      :body => "Hi...\n\nBlah blah blah~...",
      :files => ["./test.txt"]

  # update_preference
    :signature=>'This is a signature',
    :display_name=>'Display Name')

  # get preference
  pref = g.get_preference
  puts "Display language:#{pref['display_language']}, Max Page

  #creating new labels

  #renaming existing labels

  #deleting labels

  #applying a label to a message

  #removing a label from a message

  # get labels
  labels = g.get_labels

  # get messages
  g.get_messages(:label=>labels[0]).each {|m|
     puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']

Project:: http://rubyforge.org/projects/gmailutils/
Bugs:: http://rubyforge.org/tracker/?group_id=869


Park Heesob

(Daniel Amelang) #2

Hey Park, looks great. We can tell that you're putting a lot into this
lib. And aren't you supposed to be new to this ruby thing :slight_smile: You're
doing great.

Minor note: you have a number of methods that have the name 'get_this'
and 'get_that'. Consider leaving the 'get' out of the name. In other
languages, get methods are common to distinguish methods from public
members, but since everything is a method in ruby, people tend to
leave out the 'get'. So, basically, you'd have g.messages instead of
g.get_messages and g.labels instead of g.get_labels.

I put it on the tracker to make this suggestion 'official'.

Perhaps other people on this list can confirm/dispute that this would
be preferred.