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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d18beeec3f730b254c7f84069182eb41c4f34499
4
- data.tar.gz: 78ca9f046374d070be24c52c69e50932d953bd8e
3
+ metadata.gz: 0dc51dd8cb6002895b38bd52dcf06d5f03906fcd
4
+ data.tar.gz: 3ed37d6dac2519080c51c159efedc94c6f453280
5
5
  SHA512:
6
- metadata.gz: 0d04e29dea1d4994a176bf05de16e9770daf17cfd56abf3774afac739d0cd1d81d4404a119a0bf9ccb5afa100168cec0bca665619e65fa64378cc1364fc6b88d
7
- data.tar.gz: 249769dd56421fa8c5a04e94676f5b18f3fab162fe256a13bdf7dc6cdac692f12a2db467f361db80c61c2fbcc4922f8295759b0ed67ea8a537afeb1054edecfa
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(req.uri.hostname, req.uri.port) do |http|
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) if method == :post
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
@@ -1,5 +1,5 @@
1
1
  module Jenkins2API
2
2
  # Current version to publish
3
3
  # Gemspec also uses this constant
4
- VERSION = '1.0.10'.freeze
4
+ VERSION = '1.0.11'.freeze
5
5
  end
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.10
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-04-21 00:00:00.000000000 Z
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.0'
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.6.11
161
+ rubygems_version: 2.4.5.1
161
162
  signing_key:
162
163
  specification_version: 4
163
164
  summary: API client for Jenkins 2.