Sha256: 420cea605b6b635fa8fb2322d1f6e1cbe81b42b072a7a75df0f389e40c9a907b

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

module Bickle
  class BuildRepository
    BUILDS_URI     = "https://api.travis-ci.org/repos/%s/builds.json"

    def initialize(repository, client = HttpClient, response_parser = ResponseParser)
      @repository      = repository
      @client          = client
      @response_parser = response_parser
    end

    def fetch(limit = 25)
      response = @client.get(BUILDS_URI % @repository.name)

      builds   = @response_parser.parse(response).map do |build|
        Build.new(build)
      end

      builds.first(limit)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bickle-0.0.1 lib/bickle/build_repository.rb