class Api2ch::LatestThreads
Public Class Methods
new(board)
click to toggle source
# File lib/api_2ch/methods/latest_threads.rb, line 3 def initialize(board) @board = board end
Public Instance Methods
call()
click to toggle source
# File lib/api_2ch/methods/latest_threads.rb, line 7 def call response = HTTParty.get("#{BASE_URL}#{@board}/catalog.json") json = JSON.parse(response.body) @subjects = [] @comments = [] json['threads'].each do |thread| @subjects << thread['subject'] @comments << thread['comment'] end Hash[@subjects.zip(@comments)] end