Sha256: f41b25801477d7ad61a0b5f89fad42a2e7ab8b69ea5c97bf5a669e063c407861
Contents?: true
Size: 1018 Bytes
Versions: 1
Compression:
Stored size: 1018 Bytes
Contents
# frozen_string_literal: true require 'trav3/version' require 'trav3/options' require 'trav3/result' require 'trav3/get' module Trav3 class Travis API_ENDPOINT = 'https://api.travis-ci.org/v3' def initialize(repo) raise InvalidRepository unless repo.is_a?(String) and Regexp.new(/(^\d+$)|(^\w+(?:\/|%2F){1}\w+$)/) === repo @repo = repo.gsub(/\//, '%2F') defaults(limit: 25) end def [](repository = nil) [API_ENDPOINT].tap {|a| a.push("repo/#{@repo}") if repository }.join('/') end def defaults(**args) (@options ||= Options.new).build(**args) self end def builds GET.("#{self[true]}/builds#{opts}") end def build(id) GET.("#{self[]}/build/#{id}") end def job(id) GET.("#{self[]}/job/#{id}") end def log(id) GET.("#{self[]}/job/#{id}/log") end def text_log(id) GET.("#{self[]}/job/#{id}/log.txt") end def opts @options end private :opts end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trav3-0.0.1 | lib/trav3.rb |