Class: Api2ch::ViewedThreads

Inherits:
Object
  • Object
show all
Defined in:
lib/api_2ch/methods/viewed_threads.rb

Instance Method Summary collapse

Constructor Details

#initialize(board) ⇒ ViewedThreads

Returns a new instance of ViewedThreads.



3
4
5
# File 'lib/api_2ch/methods/viewed_threads.rb', line 3

def initialize(board)
  @board = board
end

Instance Method Details

#callObject



7
8
9
10
11
# File 'lib/api_2ch/methods/viewed_threads.rb', line 7

def call
  board_threads = make_request(@board)
  board_threads['threads'].map     { |i| i['subject'].scrub! }
  board_threads['threads'].sort_by { |i| - i['views'] }
end