module Sirius
Top level module for Sirius
Warning¶ ↑
All methods throws Exception
-
when page not found
-
when timeout error
-
when json parse error
-
otherwise?
Wow!¶ ↑
Possible call methods for each board
Example ¶ ↑
# Returns pages count Sirius::PR::pages # => 20 # Returns all threads Sirius::PR::page # => [<Thread>...<Thread>] # Returns all posts from thread Sirius::PR::thread(1) # => [<Post>...<Posts>]
Constants
- TIME
Default time for request
- URL
Default
URL
for request- VERSION
Public Instance Methods
page(board, page_num = nil)
click to toggle source
Get all threads from page. Return Array of threads for board
from page
.
Attributes¶ ↑
-
board
- board for request -
page_num
- page_num, default is ‘nil`[wakaba page or 0]
Example¶ ↑
# Return all threads from 0 page for `pr` Sirius::page('pr') #=> [<Thread>...<Thread>] # For `b`, 1st page Sirius::page('b', 1) #=> [<Thread>...<Thread>]
# File lib/sirius.rb, line 68 def page(board, page_num = nil) get(board, page_num)[:threads].inject([]){|m, z| m << Thread.new(z.merge({:board => board})) } end
Also aliased as: threads
pages(board)
click to toggle source
thread(board, num)
click to toggle source
Get all posts from thread Return Array of posts
Attributes¶ ↑
-
board
- board -
num
- num of thread
Example¶ ↑
# Return all posts for 1st thread Sirius::thread('pr', 1) #=> [<Post>...<Post>]
# File lib/sirius.rb, line 97 def thread(board, num) get("#{board}/res", num)[:thread].inject([]){|m, z| m << Thread.new({:board => board, :posts => [z]}) } end
threads(board, page_num = nil)
TODO
add #pages! method for get all pages from board #pages get from CACHE #pages! http-request for return page count.
Alias for: page