jenkins2-api 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/client.rb +11 -2
- data/lib/endpoints/configuration.rb +27 -0
- data/lib/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dc51dd8cb6002895b38bd52dcf06d5f03906fcd
|
4
|
+
data.tar.gz: 3ed37d6dac2519080c51c159efedc94c6f453280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dca04af0bc21825a78a59c2d30ae1d07fc164bb7ef47fd8ca11d9c74c0df35d8d5e4a5b74a2f8b22ff7c9c80914af6e69148ab3088eea4a5d4bd0371d73d37ba
|
7
|
+
data.tar.gz: c5dcdd1e9c09beebef6a1ae5d1c82f972569d3fd71d2ae85481087ab5e3c8dfcf7499a662b1b410462008fb4b14aac49380a4831171ecc98b2aa8eae68e38fd4
|
data/lib/client.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative './endpoints/artifact'
|
|
5
5
|
require_relative './endpoints/build'
|
6
6
|
require_relative './endpoints/job'
|
7
7
|
require_relative './endpoints/node'
|
8
|
+
require_relative './endpoints/configuration'
|
8
9
|
|
9
10
|
# Jenkins2API codebase wrapper
|
10
11
|
module Jenkins2API
|
@@ -46,6 +47,12 @@ module Jenkins2API
|
|
46
47
|
@artifact ||= Endpoint::Artifact.new(self)
|
47
48
|
end
|
48
49
|
|
50
|
+
# Configuration related endpoints.
|
51
|
+
# Creates new +Jenkins2API::Endpoint::Configuration+ instance
|
52
|
+
def configuration
|
53
|
+
@configuration ||= Endpoint::Configuration.new(self)
|
54
|
+
end
|
55
|
+
|
49
56
|
# Node/Computer related endpoints.
|
50
57
|
# Creates new +Jenkins2API::Endpoint::Node+ instance
|
51
58
|
def node
|
@@ -66,7 +73,9 @@ module Jenkins2API
|
|
66
73
|
yield req if block_given?
|
67
74
|
|
68
75
|
req.content_type ||= 'application/x-www-form-urlencoded'
|
69
|
-
response = Net::HTTP.start(
|
76
|
+
response = Net::HTTP.start(
|
77
|
+
req.uri.hostname, req.uri.port, use_ssl: req.uri.scheme == 'https'
|
78
|
+
) do |http|
|
70
79
|
http.request(req)
|
71
80
|
end
|
72
81
|
|
@@ -81,7 +90,7 @@ module Jenkins2API
|
|
81
90
|
parts = [@server, URI.escape(path)]
|
82
91
|
parts << 'api/json' if response_type == :json
|
83
92
|
uri = URI(File.join(parts))
|
84
|
-
uri.query = URI.encode_www_form(opts)
|
93
|
+
uri.query = URI.encode_www_form(opts)
|
85
94
|
|
86
95
|
case method
|
87
96
|
when :get then Net::HTTP::Get
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'base_endpoint'
|
2
|
+
|
3
|
+
module Jenkins2API
|
4
|
+
module Endpoint
|
5
|
+
# This class contains all the calls to reach
|
6
|
+
# Jenkins2 Configuration
|
7
|
+
class Configuration < BaseEndpoint
|
8
|
+
# list all installed plugin
|
9
|
+
def plugin_list
|
10
|
+
@client.api_request(:get, '/pluginManager', depth: 10)['plugins']
|
11
|
+
end
|
12
|
+
|
13
|
+
# Install a plugin
|
14
|
+
def plugin_install(name, short)
|
15
|
+
json = { name => { default: true } }
|
16
|
+
@client.api_request(
|
17
|
+
:post,
|
18
|
+
'/pluginManager/install',
|
19
|
+
:raw,
|
20
|
+
json: json.to_json,
|
21
|
+
dynamicLoad: 'Install without restart',
|
22
|
+
:"plugin.#{short}.default" => 'on'
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins2-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Balazs Nadasdi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/endpoints/artifact.rb
|
126
126
|
- lib/endpoints/base_endpoint.rb
|
127
127
|
- lib/endpoints/build.rb
|
128
|
+
- lib/endpoints/configuration.rb
|
128
129
|
- lib/endpoints/job.rb
|
129
130
|
- lib/endpoints/node.rb
|
130
131
|
- lib/jenkins2-api.rb
|
@@ -149,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
150
|
requirements:
|
150
151
|
- - ">="
|
151
152
|
- !ruby/object:Gem::Version
|
152
|
-
version: '2.
|
153
|
+
version: '2.1'
|
153
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
155
|
requirements:
|
155
156
|
- - ">="
|
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
158
|
version: '0'
|
158
159
|
requirements: []
|
159
160
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.4.5.1
|
161
162
|
signing_key:
|
162
163
|
specification_version: 4
|
163
164
|
summary: API client for Jenkins 2.
|