Class: Jenkins2::API::Computer::Proxy
Instance Attribute Summary collapse
#connection, #path
Instance Method Summary
collapse
Methods included from RUD
#config_xml, #delete, #update
#initialize, #method_missing, #raw, #respond_to_missing?, #subject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Jenkins2::ResourceProxy
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
17
18
19
|
# File 'lib/jenkins2/api/computer.rb', line 17
def id
@id
end
|
Instance Method Details
#create ⇒ Object
24
25
26
27
28
29
|
# File 'lib/jenkins2/api/computer.rb', line 24
def create
form_data = { name: @id, type: 'hudson.slaves.DumbSlave$DescriptorImpl', json: '{}' }
@id = nil
path = build_path 'doCreateItem'
connection.post(path, ::URI.encode_www_form(form_data)).code == '302'
end
|
#disconnect(offline_message = nil) ⇒ Object
31
32
33
34
35
|
# File 'lib/jenkins2/api/computer.rb', line 31
def disconnect(offline_message=nil)
path = build_path 'doDisconnect'
body = "offlineMessage=#{::CGI.escape offline_message}" unless offline_message.nil?
connection.post(path, body).code == '302'
end
|
#launch_agent ⇒ Object
20
21
22
|
# File 'lib/jenkins2/api/computer.rb', line 20
def launch_agent
connection.post(build_path('launchSlaveAgent')).code == '302'
end
|
#online? ⇒ Boolean
43
44
45
|
# File 'lib/jenkins2/api/computer.rb', line 43
def online?
not ( offline or temporarilyOffline)
end
|
#toggle_offline(offline_message = nil) ⇒ Object
37
38
39
40
41
|
# File 'lib/jenkins2/api/computer.rb', line 37
def toggle_offline(offline_message=nil)
path = build_path 'toggleOffline'
body = "offlineMessage=#{::CGI.escape offline_message}" unless offline_message.nil?
connection.post(path, body).code == '302'
end
|