Class: Jenkins::Client
- Inherits:
-
Object
- Object
- Jenkins::Client
- Defined in:
- lib/jenkins-client/job.rb,
lib/jenkins-client/client.rb,
lib/jenkins-client/version.rb
Defined Under Namespace
Classes: Job
Constant Summary collapse
- VERSION =
"0.0.1"
Class Attribute Summary collapse
-
.connection ⇒ Object
Returns the value of attribute connection.
-
.password ⇒ Object
Returns the value of attribute password.
-
.url ⇒ Object
Returns the value of attribute url.
-
.username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
- .get(path) ⇒ Object
- .post(path, body) ⇒ Object
- .setup_connection ⇒ Object
Class Attribute Details
.connection ⇒ Object
Returns the value of attribute connection.
8 9 10 |
# File 'lib/jenkins-client/client.rb', line 8 def connection @connection end |
.password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/jenkins-client/client.rb', line 8 def password @password end |
.url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/jenkins-client/client.rb', line 8 def url @url end |
.username ⇒ Object
Returns the value of attribute username.
8 9 10 |
# File 'lib/jenkins-client/client.rb', line 8 def username @username end |
Class Method Details
.configure {|_self| ... } ⇒ Object
10 11 12 13 |
# File 'lib/jenkins-client/client.rb', line 10 def configure yield self setup_connection end |
.get(path) ⇒ Object
24 25 26 |
# File 'lib/jenkins-client/client.rb', line 24 def get(path) connection.get(path) end |
.post(path, body) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/jenkins-client/client.rb', line 28 def post(path, body) resp = @connection.post do |req| req.headers['Content-Type'] = 'application/xml' req.url path req.body = body end resp.status == 200 end |
.setup_connection ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/jenkins-client/client.rb', line 15 def setup_connection @connection = Faraday.new(:url => url) do |builder| builder.use FaradayMiddleware::Rashify builder.use FaradayMiddleware::ParseJson builder.adapter :net_http end @connection.basic_auth username, password end |