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)
    10.times.with_object([]) { |i, posts| posts << klass.new(self, i) }
  end
end

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