module Travis::Client::Methods

Public Instance Methods

access_token() click to toggle source
# File lib/travis/client/methods.rb, line 7
def access_token
  session.access_token
end
access_token=(token) click to toggle source
# File lib/travis/client/methods.rb, line 11
def access_token=(token)
  session.access_token = token
end
account(name) click to toggle source
# File lib/travis/client/methods.rb, line 61
def account(name)
  session.find_one(Account, name)
end
accounts() click to toggle source
# File lib/travis/client/methods.rb, line 65
def accounts
  session.find_many(Account, :all => true)
end
api_endpoint() click to toggle source
# File lib/travis/client/methods.rb, line 15
def api_endpoint
  session.uri
end
api_endpoint=(uri) click to toggle source
# File lib/travis/client/methods.rb, line 28
def api_endpoint=(uri)
  @explicit_api_endpoint = true
  session.uri = uri
end
artifact(id) click to toggle source
# File lib/travis/client/methods.rb, line 49
def artifact(id)
  session.find_one(Artifact, id)
end
Also aliased as: log
broadcasts() click to toggle source
# File lib/travis/client/methods.rb, line 69
def broadcasts
  session.find_many(Broadcast)
end
build(id) click to toggle source
# File lib/travis/client/methods.rb, line 41
def build(id)
  session.find_one(Build, id)
end
cancel(entity) click to toggle source
# File lib/travis/client/methods.rb, line 81
def cancel(entity)
  raise Error, "cannot cancel a #{entity.class.one}" unless entity.cancelable?
  session.post_raw("/#{entity.class.many}/#{entity.id}/cancel")
  entity.reload
end
explicit_api_endpoint?() click to toggle source
# File lib/travis/client/methods.rb, line 24
def explicit_api_endpoint?
  @explicit_api_endpoint ||= false
end
github_auth(github_token) click to toggle source
# File lib/travis/client/methods.rb, line 19
def github_auth(github_token)
  reply = session.post_raw("/auth/github", :github_token => github_token)
  session.access_token = reply["access_token"]
end
hooks() click to toggle source
# File lib/travis/client/methods.rb, line 99
def hooks
  session.get('hooks')['hooks']
end
job(id) click to toggle source
# File lib/travis/client/methods.rb, line 45
def job(id)
  session.find_one(Job, id)
end
lint(body) click to toggle source
# File lib/travis/client/methods.rb, line 93
def lint(body)
  body   = body.to_yaml unless body.is_a? String
  result = session.post_raw('/lint', 'content' => body)
  LintResult.new(result)
end
listen(*entities, &block) click to toggle source
# File lib/travis/client/methods.rb, line 87
def listen(*entities, &block)
  listener = Listener.new(session)
  listener.subscribe(*entities, &block)
  listener.listen
end
log(id)
Alias for: artifact
repo(id_or_slug) click to toggle source
# File lib/travis/client/methods.rb, line 37
def repo(id_or_slug)
  session.find_one(Repository, id_or_slug)
end
repos(params = {}) click to toggle source
# File lib/travis/client/methods.rb, line 33
def repos(params = {})
  session.find_many(Repository, params)
end
restart(entity) click to toggle source
# File lib/travis/client/methods.rb, line 73
def restart(entity)
  # btw, internally we call this reset, not restart, as it resets the state machine
  # but we thought that would be too confusing
  raise Error, "cannot restart a #{entity.class.one}" unless entity.restartable?
  session.post_raw('/requests', "#{entity.class.one}_id" => entity.id)
  entity.reload
end
user() click to toggle source
# File lib/travis/client/methods.rb, line 55
def user
  session.find_one(User)
rescue NotFound
  raise NotLoggedIn, 'currently not logged in'
end