Class: OKCupid::Mailbox::Conversation
- Inherits:
-
Object
- Object
- OKCupid::Mailbox::Conversation
- Defined in:
- lib/lonely_coder/mailbox.rb
Instance Attribute Summary collapse
-
#from_profile_username ⇒ Object
Returns the value of attribute from_profile_username.
-
#messages ⇒ Object
Returns the value of attribute messages.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Conversation
constructor
A new instance of Conversation.
Constructor Details
#initialize(attrs) ⇒ Conversation
Returns a new instance of Conversation.
71 72 73 74 75 |
# File 'lib/lonely_coder/mailbox.rb', line 71 def initialize(attrs) attrs.each do |attr, value| self.send("#{attr}=", value) end end |
Instance Attribute Details
#from_profile_username ⇒ Object
Returns the value of attribute from_profile_username.
41 42 43 |
# File 'lib/lonely_coder/mailbox.rb', line 41 def from_profile_username @from_profile_username end |
#messages ⇒ Object
Returns the value of attribute messages.
41 42 43 |
# File 'lib/lonely_coder/mailbox.rb', line 41 def @messages end |
Class Method Details
.by_id(id, browser) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/lonely_coder/mailbox.rb', line 43 def self.by_id(id, browser) html = browser.get("/messages?readmsg=true&threadid=#{id}&folder=1") from_profile_username = html.search('li.to_me:first a').attribute('title').text = [] html.search('#thread > li').each do || css_class = .attribute('class') css_id = .attribute('id') # matches 'from_me' and 'to_me' classes. if (css_class && css_class.text.match(/_me/)) if(css_id && css_id.text == 'compose') next else << Message.from_html() end else next end end self.new({ from_profile_username: from_profile_username, messages: }) end |