Sha256: f68f5c1b6424aff359bfafc3729e9c490b91242b3ad6df911e3afbf88362c279

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 Bytes

Contents

module Pinoccio
  class TroopCollection
    def initialize(client)
      @client = client
    end

    def first
      all.first
    end

    def all
      result = @client.get("troops")
      result = [result] unless result.is_a?(Array)
      result.map {|t| Troop.new(@client, t) }
    end

    def get(troop_id)
      result = @client.get("troops/#{troop_id}")
      Troop.new(@client, result)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pinoccio-0.1.0 lib/troop_collection.rb