From 9209eae7e62b256401320ef1defe14cfbc1b25dd Mon Sep 17 00:00:00 2001 From: Max Hawkins Date: Sat, 7 Jul 2012 18:36:15 -0700 Subject: [PATCH] Use conversation_id rather than conversation_url This establishes parity with Conversation.by_id which takes an id rather than a URL --- lib/lonely_coder/mailbox.rb | 6 +++--- spec/mailbox_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/lonely_coder/mailbox.rb b/lib/lonely_coder/mailbox.rb index 5935c50..3d5e2b0 100644 --- a/lib/lonely_coder/mailbox.rb +++ b/lib/lonely_coder/mailbox.rb @@ -12,20 +12,20 @@ def conversation_for(id) class Mailbox class MessageSnippet - attr_accessor :profile_username, :profile_small_avatar_url, :preview, :last_date, :conversation_url + attr_accessor :profile_username, :profile_small_avatar_url, :preview, :last_date, :conversation_id def self.from_html(html) profile_username = html.search('a.subject').text preview = html.search('.previewline').text last_date = html.search('.timestamp').text - conversation_url = html.search('p:first').attribute('onclick').text.gsub('window.location=\'', '').gsub('\';','') + conversation_id = html.attribute('id').text[/\d+/] profile_small_avatar_url = html.search('a.photo img').attribute('src').text self.new({ profile_username: profile_username, preview: preview, last_date: Date.parse(last_date), - conversation_url: conversation_url, + conversation_id: conversation_id, profile_small_avatar_url: profile_small_avatar_url }) end diff --git a/spec/mailbox_spec.rb b/spec/mailbox_spec.rb index 06b3081..62f1696 100644 --- a/spec/mailbox_spec.rb +++ b/spec/mailbox_spec.rb @@ -81,8 +81,8 @@ @header.preview.should == 'No, I was there like a month ago. I live in EL so ...' end - it "has a conversation_url" do - @header.conversation_url.should == '/messages?readmsg=true&threadid=9950201897626358080&folder=1' + it "has a conversation_id" do + @header.conversation_id.should == '9950201897626358080' end it "has a last_date" do