class Post
  def initialize(parent, thread_id)
    @parent = parent
    @thread_id = thread_id
  end

  def create_post(message)
    "Posting '#{message}' to thread №#{@thread_id} apikey:#{@parent.key} "
  end
end

class SomeApi
  attr_reader :key

  def initialize(key)
    @key = key
  end

  def fetch_threads(klass, &callback)
    (1..10).each do |i|
      yield klass.new(self, i) if callback
    end
  end
end

SomeApi.new("abulik").fetch_threads(Post) do |post|
  puts post.create_post("sup 2ch")
end
