class Api2ch::Posts

Public Class Methods

new(board, num) click to toggle source
# File lib/api_2ch/methods/posts.rb, line 3
def initialize(board, num)
  @board = board
  @num   = num
end

Public Instance Methods

call() click to toggle source
# File lib/api_2ch/methods/posts.rb, line 8
def call
  response = HTTParty.get("#{BASE_URL}#{@board}/res/#{@num}.json")
  json     = JSON.parse(response.body)
  json['threads'].each do |thread|
    return thread['posts'].map { |post| post }
  end
end