class SomeApi
  attr_reader :key
  def initialize(key)
    @key = key
  end

  def fetch_threads
    10.times.with_object([]) {|i,posts| posts << Post.new(self, i) }
  end

  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
end

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