Class: Partyhat::Forums::ForumThread

Inherits:
Object
  • Object
show all
Defined in:
lib/partyhat/forums/forum_thread.rb

Overview

TODO: Add pagination support

e.g. thread.next_page

Constant Summary collapse

URL_FORMAT =
'http://services.runescape.com/m=forum/forums.ws?%s'

Instance Method Summary collapse

Constructor Details

#initialize(qfc) ⇒ ForumThread

Returns a new instance of ForumThread.



11
12
13
14
15
16
17
# File 'lib/partyhat/forums/forum_thread.rb', line 11

def initialize qfc
  raise InvalidArgumentError('Invalid quick find code') unless Forums.valid_qfc?(qfc)
  @posts = []
  @qfc   = qfc
  @link  = URL_FORMAT % qfc.gsub(/-/, ",")
  parse_from_page Partyhat::Util.fetch_remote(@link)
end

Instance Method Details



27
28
29
# File 'lib/partyhat/forums/forum_thread.rb', line 27

def link
  @link
end

#postsObject



23
24
25
# File 'lib/partyhat/forums/forum_thread.rb', line 23

def posts
  @posts
end

#qfcObject



31
32
33
# File 'lib/partyhat/forums/forum_thread.rb', line 31

def qfc
  @qfc
end

#titleObject



19
20
21
# File 'lib/partyhat/forums/forum_thread.rb', line 19

def title
  @title
end