[ANN] gmailer 0.0.9

Discussion in 'Ruby' started by Park Heesob, Sep 8, 2005.

  1. Park Heesob

    Park Heesob Guest

    GMailer 0.0.9 Released
    =======================

    This is the 0.0.9 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?
    ---------------------------

    Fix fetch message body bug
    Fix encode, decode bug
    Rename some methods like trash_in -> trash, trash_out -> untrash
    Add new class for messagelist and message.
    Add support for the new feature show origianl.
    Thanks Daniel Schierbeck and blair christensen!

    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 |item|
    puts "Name: #{item['name']} Email: #{item['email']}"
    end

    #send message
    # 'From' default gmail.com account
    g.send(
    :to => ", my_friend@his_company.com, ",
    :cc => "",
    :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 => "",
    :to => ", my_friend@his_company.com, ",
    :cc => "",
    :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=>'',
    :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
    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.report_not_spam(msgid)

    #move a message to trash
    g.trash(msgid)

    #move a message from trash to inbox
    g.untrash(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)

    #show original message
    g.show original(msgid)

    #get labels
    labels = g.labels

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

    #get inbox messages
    g.messages:)standard=>'inbox').each {|m|
    puts "Subject: #{m.subject} / Snippet: #{m.snippet}"
    }

    # fetch with filter :read or :star
    g.messages:)standard=>'all',:read=>false).each {|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


    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
     
    Park Heesob, Sep 8, 2005
    #1
    1. Advertising

  2. This just keeps on getting better :D
     
    Daniel Schierbeck, Sep 8, 2005
    #2
    1. Advertising

  3. Park Heesob

    Guest

    Re: gmailer 0.0.9

    Looks excellent, and Austin's kudos for it gave me an idea of what to
    do with it. However, browsing the documentation, I couldn't help
    thinking that a Message object is in order. i.e. instead of

    g.report_spam(msgid)

    you'd have

    g.msg(msgid).report_spam

    etc. (There are heaps of GMailer methods that take a msgid argument).

    Also, instead of returning hashes from various methods (preferences,
    for example), a "real" object would be nice. i.e.
    "pref.display_language" instead of "pref['display_language']".

    Please take these as suggestion to think about, not a complaint that
    they haven't been implemented. Like I say, I'm looking forward to
    using it.

    Cheers,
    Gavin
     
    , Sep 10, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Park Heesob

    [ANN] gmailer 0.0.1 (plain text)

    Park Heesob, Aug 16, 2005, in forum: Ruby
    Replies:
    5
    Views:
    129
    Park Heesob
    Aug 19, 2005
  2. Park Heesob

    [ANN] gmailer-0.0.2

    Park Heesob, Aug 20, 2005, in forum: Ruby
    Replies:
    2
    Views:
    125
    James Britt
    Aug 24, 2005
  3. Park Heesob

    [ANN] gmailer 0.0.3

    Park Heesob, Aug 25, 2005, in forum: Ruby
    Replies:
    3
    Views:
    92
    Shashank Date
    Aug 25, 2005
  4. Park Heesob

    [ANN] gmailer-0.0.5

    Park Heesob, Aug 28, 2005, in forum: Ruby
    Replies:
    0
    Views:
    87
    Park Heesob
    Aug 28, 2005
  5. Park Heesob

    [ANN] gmailer-0.0.7

    Park Heesob, Aug 30, 2005, in forum: Ruby
    Replies:
    2
    Views:
    98
    Daniel Schierbeck
    Aug 30, 2005
Loading...

Share This Page