Class: Buildbox::API
- Inherits:
-
Object
show all
- Defined in:
- lib/buildbox/api.rb
Defined Under Namespace
Classes: AgentNotFoundError, ProxyLogger, ServerError
Instance Method Summary
collapse
Constructor Details
#initialize(config = Buildbox.config, logger = Buildbox.logger) ⇒ API
Returns a new instance of API.
28
29
30
31
|
# File 'lib/buildbox/api.rb', line 28
def initialize(config = Buildbox.config, logger = Buildbox.logger)
@config = config
@logger = logger
end
|
Instance Method Details
#agent(access_token, options) ⇒ Object
33
34
35
36
37
38
39
40
41
|
# File 'lib/buildbox/api.rb', line 33
def agent(access_token, options)
put(access_token, options)
rescue Faraday::Error::ClientError => e
if e.response && e.response[:status] == 404
raise AgentNotFoundError.new(e, e.response)
else
raise ServerError.new(e, e.response)
end
end
|
#next_build(access_token) ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/buildbox/api.rb', line 43
def next_build(access_token)
build = get("#{access_token}/builds/queue/next").build
if build
Buildbox::Build.new(build)
else
nil
end
end
|
#update_build(access_token, build, options) ⇒ Object
53
54
55
|
# File 'lib/buildbox/api.rb', line 53
def update_build(access_token, build, options)
put("#{access_token}/builds/#{build.id}", options)
end
|