Module: Travis::Client::Methods

Included in:
Travis::CLI::ApiCommand, Namespace, Session
Defined in:
lib/travis/client/methods.rb

Instance Method Summary collapse

Instance Method Details

#access_tokenObject



6
7
8
# File 'lib/travis/client/methods.rb', line 6

def access_token
  session.access_token
end

#access_token=(token) ⇒ Object



10
11
12
# File 'lib/travis/client/methods.rb', line 10

def access_token=(token)
  session.access_token = token
end

#api_endpointObject



14
15
16
# File 'lib/travis/client/methods.rb', line 14

def api_endpoint
  session.uri
end

#api_endpoint=(uri) ⇒ Object



27
28
29
30
# File 'lib/travis/client/methods.rb', line 27

def api_endpoint=(uri)
  @explicit_api_endpoint = true
  session.uri = uri
end

#artifact(id) ⇒ Object Also known as: log



56
57
58
# File 'lib/travis/client/methods.rb', line 56

def artifact(id)
  session.find_one(Artifact, id)
end

#build(id) ⇒ Object



48
49
50
# File 'lib/travis/client/methods.rb', line 48

def build(id)
  session.find_one(Build, id)
end

#explicit_api_endpoint?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/travis/client/methods.rb', line 23

def explicit_api_endpoint?
  @explicit_api_endpoint ||= false
end

#github_auth(github_token) ⇒ Object



18
19
20
21
# File 'lib/travis/client/methods.rb', line 18

def github_auth(github_token)
  reply = session.post_raw("/auth/github", :github_token => github_token)
  session.access_token = reply["access_token"]
end

#job(id) ⇒ Object



52
53
54
# File 'lib/travis/client/methods.rb', line 52

def job(id)
  session.find_one(Job, id)
end

#repo(id_or_slug) ⇒ Object



36
37
38
# File 'lib/travis/client/methods.rb', line 36

def repo(id_or_slug)
  session.find_one(Repository, id_or_slug)
end

#repos(params = {}) ⇒ Object



32
33
34
# File 'lib/travis/client/methods.rb', line 32

def repos(params = {})
  session.find_many(Repository, params)
end

#restart(entity) ⇒ Object



66
67
68
69
70
71
# File 'lib/travis/client/methods.rb', line 66

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
  session.post_raw('/requests', "#{entity.class.one}_id" => entity.id)
  entity.reload
end

#userObject



62
63
64
# File 'lib/travis/client/methods.rb', line 62

def user
  session.find_one(User)
end

#worker(id) ⇒ Object



40
41
42
# File 'lib/travis/client/methods.rb', line 40

def worker(id)
  session.find_one(Worker, id)
end

#workers(params = {}) ⇒ Object



44
45
46
# File 'lib/travis/client/methods.rb', line 44

def workers(params = {})
  session.find_many(Worker, params)
end