Class: Jenkins2::API::View::Proxy

Inherits:
ResourceProxy show all
Includes:
RUD
Defined in:
lib/jenkins2/api/view.rb

Instance Attribute Summary collapse

Attributes inherited from ResourceProxy

#connection, #path

Instance Method Summary collapse

Methods included from RUD

#config_xml, #delete, #update

Methods inherited from ResourceProxy

#initialize, #method_missing, #raw, #respond_to_missing?, #subject

Constructor Details

This class inherits a constructor from Jenkins2::ResourceProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Jenkins2::ResourceProxy

Instance Attribute Details

#idObject

Returns the value of attribute id.



21
22
23
# File 'lib/jenkins2/api/view.rb', line 21

def id
  @id
end

Instance Method Details

#add_job(job_name) ⇒ Object



30
31
32
# File 'lib/jenkins2/api/view.rb', line 30

def add_job(job_name)
	connection.post(build_path('addJobToView'), nil, name: job_name).code == '200'
end

#create(config_xml) ⇒ Object



24
25
26
27
28
# File 'lib/jenkins2/api/view.rb', line 24

def create(config_xml)
	connection.post('createView', config_xml, name: id) do |req|
		req['Content-Type'] = 'text/xml'
	end.code == '200'
end

#remove_job(job_name) ⇒ Object



34
35
36
# File 'lib/jenkins2/api/view.rb', line 34

def remove_job(job_name)
	connection.post(build_path('removeJobFromView'), nil, name: job_name).code == '200'
end