Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.

Use conversation_id rather than conversation_url #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/lonely_coder/mailbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/mailbox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down