artifactory 2.5.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +9 -13
  5. data/README.md +10 -1
  6. data/Rakefile +16 -7
  7. data/appveyor.yml +4 -2
  8. data/artifactory.gemspec +14 -14
  9. data/lib/artifactory.rb +26 -26
  10. data/lib/artifactory/client.rb +25 -23
  11. data/lib/artifactory/configurable.rb +1 -0
  12. data/lib/artifactory/defaults.rb +24 -15
  13. data/lib/artifactory/errors.rb +2 -2
  14. data/lib/artifactory/resources/artifact.rb +34 -33
  15. data/lib/artifactory/resources/backup.rb +5 -5
  16. data/lib/artifactory/resources/base.rb +7 -7
  17. data/lib/artifactory/resources/build.rb +15 -15
  18. data/lib/artifactory/resources/build_component.rb +4 -4
  19. data/lib/artifactory/resources/group.rb +4 -4
  20. data/lib/artifactory/resources/layout.rb +3 -3
  21. data/lib/artifactory/resources/ldap_setting.rb +7 -6
  22. data/lib/artifactory/resources/mail_server.rb +3 -3
  23. data/lib/artifactory/resources/permission_target.rb +20 -20
  24. data/lib/artifactory/resources/plugin.rb +1 -1
  25. data/lib/artifactory/resources/repository.rb +20 -20
  26. data/lib/artifactory/resources/system.rb +6 -6
  27. data/lib/artifactory/resources/url_base.rb +4 -3
  28. data/lib/artifactory/resources/user.rb +4 -4
  29. data/lib/artifactory/util.rb +10 -10
  30. data/lib/artifactory/version.rb +1 -1
  31. data/spec/integration/resources/artifact_spec.rb +31 -31
  32. data/spec/integration/resources/backup.rb +7 -7
  33. data/spec/integration/resources/build_component_spec.rb +18 -18
  34. data/spec/integration/resources/build_spec.rb +15 -15
  35. data/spec/integration/resources/group_spec.rb +16 -16
  36. data/spec/integration/resources/layout_spec.rb +7 -7
  37. data/spec/integration/resources/ldap_setting_spec.rb +7 -7
  38. data/spec/integration/resources/mail_server_spec.rb +7 -7
  39. data/spec/integration/resources/permission_target_spec.rb +35 -35
  40. data/spec/integration/resources/repository_spec.rb +14 -14
  41. data/spec/integration/resources/system_spec.rb +20 -21
  42. data/spec/integration/resources/url_base_spec.rb +7 -7
  43. data/spec/integration/resources/user_spec.rb +16 -16
  44. data/spec/spec_helper.rb +11 -11
  45. data/spec/support/api_server.rb +13 -13
  46. data/spec/support/api_server/artifact_endpoints.rb +94 -94
  47. data/spec/support/api_server/build_component_endpoints.rb +18 -18
  48. data/spec/support/api_server/build_endpoints.rb +76 -76
  49. data/spec/support/api_server/group_endpoints.rb +24 -24
  50. data/spec/support/api_server/permission_target_endpoints.rb +24 -24
  51. data/spec/support/api_server/repository_endpoints.rb +82 -82
  52. data/spec/support/api_server/status_endpoints.rb +5 -5
  53. data/spec/support/api_server/system_endpoints.rb +17 -18
  54. data/spec/support/api_server/user_endpoints.rb +30 -30
  55. data/spec/unit/artifactory_spec.rb +17 -17
  56. data/spec/unit/client_spec.rb +43 -43
  57. data/spec/unit/resources/artifact_spec.rb +256 -256
  58. data/spec/unit/resources/backup_spec.rb +8 -8
  59. data/spec/unit/resources/base_spec.rb +51 -51
  60. data/spec/unit/resources/build_component_spec.rb +45 -45
  61. data/spec/unit/resources/build_spec.rb +98 -98
  62. data/spec/unit/resources/defaults_spec.rb +4 -4
  63. data/spec/unit/resources/group_spec.rb +36 -36
  64. data/spec/unit/resources/layout_spec.rb +8 -8
  65. data/spec/unit/resources/ldap_setting_spec.rb +8 -8
  66. data/spec/unit/resources/mail_server_spec.rb +8 -8
  67. data/spec/unit/resources/permission_target_spec.rb +79 -79
  68. data/spec/unit/resources/plugin_spec.rb +7 -7
  69. data/spec/unit/resources/repository_spec.rb +98 -98
  70. data/spec/unit/resources/system_spec.rb +30 -30
  71. data/spec/unit/resources/url_base_spec.rb +8 -8
  72. data/spec/unit/resources/user_spec.rb +40 -40
  73. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 807a2f1639d5c32dff15a9cc23d7d129396d9847
4
- data.tar.gz: 063be4bd80cb37f69f04492bf9cdcda5c92fb565
3
+ metadata.gz: b78870ce533114a24a58309118aa1371b8148e84
4
+ data.tar.gz: 70072323490ca5caa97a9f26c5ada37076df82a1
5
5
  SHA512:
6
- metadata.gz: 20e6cdf9a45f0da723ff60dc4bcab19c5cf06dd1be1ce54fab35cad878b167474740cb807fbe1aa2818edcd26993342bcce7d2cbee1283c82e77f36601f99161
7
- data.tar.gz: 4646fa8579e83c41a2733c35c336257aab79fb869d3f4ea8f8122a03ef8e6d85a21dd093dcbe148d1fbc48992fec903d1b4616c721fba463dae18fb263a39bad
6
+ metadata.gz: acb5a08f27fe3551f4b4bb97ce45720194295a71e9ed6123cb03d47784e38fae528a1b1de37a96efb6468dff407082e147a0e7f5b2eda6091ce57cad6312fe17
7
+ data.tar.gz: eda4087d4293e24272959d44d58b1673546c1b096fb7349384b3407cd3d60cb6154f6dc62b8e61ebb9144dccbd54b66fc4f6dbba1ad9df5e81c26e9089ec211b
@@ -1,7 +1,8 @@
1
1
  rvm:
2
- - 1.9.3
3
- - 2.0.0
4
2
  - 2.1
3
+ - 2.2
4
+ - 2.3
5
+ - 2.4.0
5
6
 
6
7
  bundler_args: --jobs 7
7
8
 
@@ -3,6 +3,12 @@ Artifactory Client CHANGELOG
3
3
  This file is used to document the changes between releases of the Artifactory
4
4
  Ruby client.
5
5
 
6
+ v2.6.0 (02-02-2017)
7
+ -------------------
8
+ - Add API Key authentication
9
+ - Add new Ruby versions to test matrix
10
+ - Add ChefStyle for linting
11
+
6
12
  v2.5.2 (01-27-2017)
7
13
  -------------------
8
14
  - Update tests to run properly on Windows
data/Gemfile CHANGED
@@ -1,18 +1,14 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  group :test do
5
- gem 'sinatra', '~> 1.4'
6
- gem 'rspec', '~> 3.0'
7
- gem 'webmock', '~> 1.17'
8
- if RUBY_VERSION =~ /^1\.9\.3.*/
9
- # gaurd that webmock only brings in addressable with 1.9.3 support.
10
- gem 'addressable', '<= 2.4.0'
11
- # guard simplecov import of json gem
12
- gem 'json', '<= 1.8.3'
13
- end
5
+ gem "chefstyle"
6
+ gem "sinatra", "~> 1.4"
7
+ gem "rspec", "~> 3.0"
8
+ gem "webmock", "~> 2.3"
9
+ gem "rainbow", "< 2.2.1"
14
10
  # rspec-mocks 3.4.1 breaks tests with 'System level too deep' errors.
15
- gem 'rspec-mocks', '3.4.0'
16
- gem 'simplecov'
17
- gem 'simplecov-console'
11
+ gem "rspec-mocks", "3.4.0"
12
+ gem "simplecov"
13
+ gem "simplecov-console"
18
14
  end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Artifactory Client
2
2
  ==================
3
- [![Build Status](https://secure.travis-ci.org/chef/artifactory-client.png?branch=master)](http://travis-ci.org/chef/artifactory-client)
3
+ [![Gem Version](http://img.shields.io/gem/v/artifactory.svg)][gem] [![Travis Build Status](http://img.shields.io/travis/chef/artifactory-client.svg?label=Travis CI)][travis] [![AppVeyor Build Status](http://img.shields.io/appveyor/ci/chef/artifactory-client.svg?label=AppVeyor)][appveyor]
4
4
 
5
5
  A Ruby client and interface to the Artifactory API. **The majority of API endpoints are only exposed for Artifactory Pro customers!** As such, many of the resources and actions exposed by this gem also require Artifactory Pro.
6
6
 
@@ -56,6 +56,10 @@ Artifactory.configure do |config|
56
56
  config.username = 'admin'
57
57
  config.password = 'password'
58
58
 
59
+ # You can also use an API key for authentication, username and password
60
+ # take precedence so leave them off if you are using an API key.
61
+ config.api_key = 'XXXXXXXXXXXXXXXXXX'
62
+
59
63
  # Speaking of SSL, you can specify the path to a pem file with your custom
60
64
  # certificates and the gem will wire it all up for you (NOTE: it must be a
61
65
  # valid PEM file).
@@ -86,6 +90,7 @@ Or, if you want to be really Unixy, these parameters are all configurable via en
86
90
  export ARTIFACTORY_ENDPOINT=http://my.storage.server/artifactory
87
91
  export ARTIFACTORY_USERNAME=admin
88
92
  export ARTIFACTORY_PASSWORD=password
93
+ export ARTIFACTORY_API_KEY=XXXXXXXXXXXXXXXXXX
89
94
  export ARTIFACTORY_SSL_PEM_FILE=/path/to/my.pem
90
95
  ```
91
96
 
@@ -275,3 +280,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
275
280
  See the License for the specific language governing permissions and
276
281
  limitations under the License.
277
282
  ```
283
+
284
+ [appveyor]: https://ci.appveyor.com/project/chef/artifactory-client
285
+ [gem]: https://rubygems.org/gems/artifactory
286
+ [travis]: https://travis-ci.org/chef/artifactory-client
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
2
 
3
- require 'rspec/core/rake_task'
3
+ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:integration) do |t|
5
5
  t.rspec_opts = "--tag integration"
6
6
  end
@@ -8,12 +8,21 @@ RSpec::Core::RakeTask.new(:unit) do |t|
8
8
  t.rspec_opts = "--tag ~integration"
9
9
  end
10
10
 
11
- namespace :travis do
12
- desc 'Run tests on Travis'
13
- task :ci => [:unit,:integration]
11
+ require "chefstyle"
12
+ require "rubocop/rake_task"
13
+ desc "Run ChefStyle"
14
+ RuboCop::RakeTask.new(:chefstyle) do |task|
15
+ task.options << "--display-cop-names"
14
16
  end
15
17
 
16
- desc 'Generate coverage report'
18
+ desc "Generate coverage report"
17
19
  RSpec::Core::RakeTask.new(:coverage) do |t|
18
- ENV['COVERAGE'] = 'true'
20
+ ENV["COVERAGE"] = "true"
19
21
  end
22
+
23
+ namespace :travis do
24
+ desc "Run tests on Travis"
25
+ task ci: %w{chefstyle unit integration}
26
+ end
27
+
28
+ task default: %w{travis:ci}
@@ -6,8 +6,10 @@ environment:
6
6
  matrix:
7
7
  - RUBY_VERSION: 21
8
8
  - RUBY_VERSION: 21-x64
9
- - RUBY_VERSION: 200
10
- - RUBY_VERSION: 193
9
+ - RUBY_VERSION: 22
10
+ - RUBY_VERSION: 22-x64
11
+ - RUBY_VERSION: 23
12
+ - RUBY_VERSION: 23-x64
11
13
 
12
14
  install:
13
15
  - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
@@ -1,25 +1,25 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'artifactory/version'
4
+ require "artifactory/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = 'artifactory'
7
+ spec.name = "artifactory"
8
8
  spec.version = Artifactory::VERSION
9
- spec.author = 'Seth Vargo'
10
- spec.email = 'sethvargo@gmail.com'
11
- spec.description = 'A Ruby client for Artifactory'
12
- spec.summary = 'Artifactory is a simple, lightweight Ruby client for ' \
13
- 'interacting with the Artifactory and Artifactory Pro ' \
14
- 'APIs.'
15
- spec.homepage = 'https://github.com/opscode/artifactory-client'
16
- spec.license = 'Apache 2.0'
9
+ spec.author = "Seth Vargo"
10
+ spec.email = "sethvargo@gmail.com"
11
+ spec.description = "A Ruby client for Artifactory"
12
+ spec.summary = "Artifactory is a simple, lightweight Ruby client for " \
13
+ "interacting with the Artifactory and Artifactory Pro " \
14
+ "APIs."
15
+ spec.homepage = "https://github.com/opscode/artifactory-client"
16
+ spec.license = "Apache 2.0"
17
17
 
18
18
  spec.files = `git ls-files`.split($/)
19
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
- spec.require_paths = ['lib']
21
+ spec.require_paths = ["lib"]
22
22
 
23
- spec.add_development_dependency 'bundler'
24
- spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
25
  end
@@ -14,38 +14,38 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'pathname'
18
- require 'artifactory/version'
17
+ require "pathname"
18
+ require "artifactory/version"
19
19
 
20
20
  module Artifactory
21
- autoload :Client, 'artifactory/client'
22
- autoload :Configurable, 'artifactory/configurable'
23
- autoload :Defaults, 'artifactory/defaults'
24
- autoload :Error, 'artifactory/errors'
25
- autoload :Util, 'artifactory/util'
21
+ autoload :Client, "artifactory/client"
22
+ autoload :Configurable, "artifactory/configurable"
23
+ autoload :Defaults, "artifactory/defaults"
24
+ autoload :Error, "artifactory/errors"
25
+ autoload :Util, "artifactory/util"
26
26
 
27
27
  module Collection
28
- autoload :Artifact, 'artifactory/collections/artifact'
29
- autoload :Base, 'artifactory/collections/base'
30
- autoload :Build, 'artifactory/collections/build'
28
+ autoload :Artifact, "artifactory/collections/artifact"
29
+ autoload :Base, "artifactory/collections/base"
30
+ autoload :Build, "artifactory/collections/build"
31
31
  end
32
32
 
33
33
  module Resource
34
- autoload :Artifact, 'artifactory/resources/artifact'
35
- autoload :Backup, 'artifactory/resources/backup'
36
- autoload :Base, 'artifactory/resources/base'
37
- autoload :Build, 'artifactory/resources/build'
38
- autoload :BuildComponent, 'artifactory/resources/build_component'
39
- autoload :Group, 'artifactory/resources/group'
40
- autoload :Layout, 'artifactory/resources/layout'
41
- autoload :LDAPSetting, 'artifactory/resources/ldap_setting'
42
- autoload :MailServer, 'artifactory/resources/mail_server'
43
- autoload :PermissionTarget, 'artifactory/resources/permission_target'
44
- autoload :Plugin, 'artifactory/resources/plugin'
45
- autoload :Repository, 'artifactory/resources/repository'
46
- autoload :System, 'artifactory/resources/system'
47
- autoload :URLBase, 'artifactory/resources/url_base'
48
- autoload :User, 'artifactory/resources/user'
34
+ autoload :Artifact, "artifactory/resources/artifact"
35
+ autoload :Backup, "artifactory/resources/backup"
36
+ autoload :Base, "artifactory/resources/base"
37
+ autoload :Build, "artifactory/resources/build"
38
+ autoload :BuildComponent, "artifactory/resources/build_component"
39
+ autoload :Group, "artifactory/resources/group"
40
+ autoload :Layout, "artifactory/resources/layout"
41
+ autoload :LDAPSetting, "artifactory/resources/ldap_setting"
42
+ autoload :MailServer, "artifactory/resources/mail_server"
43
+ autoload :PermissionTarget, "artifactory/resources/permission_target"
44
+ autoload :Plugin, "artifactory/resources/plugin"
45
+ autoload :Repository, "artifactory/resources/repository"
46
+ autoload :System, "artifactory/resources/system"
47
+ autoload :URLBase, "artifactory/resources/url_base"
48
+ autoload :User, "artifactory/resources/user"
49
49
  end
50
50
 
51
51
  class << self
@@ -58,7 +58,7 @@ module Artifactory
58
58
  # @return [Pathname]
59
59
  #
60
60
  def root
61
- @root ||= Pathname.new(File.expand_path('../../', __FILE__))
61
+ @root ||= Pathname.new(File.expand_path("../../", __FILE__))
62
62
  end
63
63
 
64
64
  #
@@ -14,10 +14,10 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'cgi'
18
- require 'json'
19
- require 'net/http'
20
- require 'uri'
17
+ require "cgi"
18
+ require "json"
19
+ require "net/http"
20
+ require "uri"
21
21
 
22
22
  module Artifactory
23
23
  #
@@ -31,7 +31,7 @@ module Artifactory
31
31
  # @private
32
32
  #
33
33
  def proxy(klass)
34
- namespace = klass.name.split('::').last.downcase
34
+ namespace = klass.name.split("::").last.downcase
35
35
  klass.singleton_methods(false).each do |name|
36
36
  define_method("#{namespace}_#{name}") do |*args|
37
37
  if args.last.is_a?(Hash)
@@ -69,10 +69,10 @@ module Artifactory
69
69
  # Use any options given, but fall back to the defaults set on the module
70
70
  Artifactory::Configurable.keys.each do |key|
71
71
  value = if options[key].nil?
72
- Artifactory.instance_variable_get(:"@#{key}")
73
- else
74
- options[key]
75
- end
72
+ Artifactory.instance_variable_get(:"@#{key}")
73
+ else
74
+ options[key]
75
+ end
76
76
 
77
77
  instance_variable_set(:"@#{key}", value)
78
78
  end
@@ -193,6 +193,8 @@ module Artifactory
193
193
  # Add basic authentication
194
194
  if username && password
195
195
  request.basic_auth(username, password)
196
+ elsif api_key
197
+ request.add_field("X-JFrog-Art-Api", api_key)
196
198
  end
197
199
 
198
200
  # Setup PATCH/POST/PUT
@@ -219,8 +221,8 @@ module Artifactory
219
221
  connection.read_timeout = read_timeout
220
222
 
221
223
  # Apply SSL, if applicable
222
- if uri.scheme == 'https'
223
- require 'net/https' unless defined?(Net::HTTPS)
224
+ if uri.scheme == "https"
225
+ require "net/https" unless defined?(Net::HTTPS)
224
226
 
225
227
  # Turn on SSL
226
228
  connection.use_ssl = true
@@ -247,7 +249,7 @@ module Artifactory
247
249
 
248
250
  case response
249
251
  when Net::HTTPRedirection
250
- redirect = URI.parse(response['location'])
252
+ redirect = URI.parse(response["location"])
251
253
  request(verb, redirect, data, headers)
252
254
  when Net::HTTPSuccess
253
255
  success(response)
@@ -267,9 +269,9 @@ module Artifactory
267
269
  #
268
270
  def default_headers
269
271
  {
270
- 'Connection' => 'keep-alive',
271
- 'Keep-Alive' => '30',
272
- 'User-Agent' => user_agent,
272
+ "Connection" => "keep-alive",
273
+ "Keep-Alive" => "30",
274
+ "User-Agent" => user_agent,
273
275
  }
274
276
  end
275
277
 
@@ -294,7 +296,7 @@ module Artifactory
294
296
  def build_uri(verb, path, params = {})
295
297
  # Add any query string parameters
296
298
  if [:delete, :get].include?(verb)
297
- path = [path, to_query_string(params)].compact.join('?')
299
+ path = [path, to_query_string(params)].compact.join("?")
298
300
  end
299
301
 
300
302
  # Parse the URI
@@ -333,7 +335,7 @@ module Artifactory
333
335
  def to_query_string(hash)
334
336
  hash.map do |key, value|
335
337
  "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
336
- end.join('&')[/.+/]
338
+ end.join("&")[/.+/]
337
339
  end
338
340
 
339
341
  #
@@ -348,7 +350,7 @@ module Artifactory
348
350
  # the parsed response, as an object
349
351
  #
350
352
  def success(response)
351
- if (response.content_type || '').include?('json')
353
+ if (response.content_type || "").include?("json")
352
354
  JSON.parse(response.body)
353
355
  else
354
356
  response.body
@@ -365,20 +367,20 @@ module Artifactory
365
367
  # the response object from the request
366
368
  #
367
369
  def error(response)
368
- if (response.content_type || '').include?('json')
370
+ if (response.content_type || "").include?("json")
369
371
  # Attempt to parse the error as JSON
370
372
  begin
371
373
  json = JSON.parse(response.body)
372
374
 
373
- if json['errors'] && json['errors'].first
374
- raise Error::HTTPError.new(json['errors'].first)
375
+ if json["errors"] && json["errors"].first
376
+ raise Error::HTTPError.new(json["errors"].first)
375
377
  end
376
378
  rescue JSON::ParserError; end
377
379
  end
378
380
 
379
381
  raise Error::HTTPError.new(
380
- 'status' => response.code,
381
- 'message' => response.body,
382
+ "status" => response.code,
383
+ "message" => response.body
382
384
  )
383
385
  end
384
386
  end
@@ -31,6 +31,7 @@ module Artifactory
31
31
  :endpoint,
32
32
  :username,
33
33
  :password,
34
+ :api_key,
34
35
  :proxy_address,
35
36
  :proxy_password,
36
37
  :proxy_port,
@@ -14,12 +14,12 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require 'artifactory/version'
17
+ require "artifactory/version"
18
18
 
19
19
  module Artifactory
20
20
  module Defaults
21
21
  # Default API endpoint
22
- ENDPOINT = 'http://localhost:8080/artifactory'.freeze
22
+ ENDPOINT = "http://localhost:8080/artifactory".freeze
23
23
 
24
24
  # Default User Agent header string
25
25
  USER_AGENT = "Artifactory Ruby Gem #{Artifactory::VERSION}".freeze
@@ -40,7 +40,7 @@ module Artifactory
40
40
  # @return [String]
41
41
  #
42
42
  def endpoint
43
- ENV['ARTIFACTORY_ENDPOINT'] || ENDPOINT
43
+ ENV["ARTIFACTORY_ENDPOINT"] || ENDPOINT
44
44
  end
45
45
 
46
46
  #
@@ -49,7 +49,7 @@ module Artifactory
49
49
  # @return [String]
50
50
  #
51
51
  def user_agent
52
- ENV['ARTIFACTORY_USER_AGENT'] || USER_AGENT
52
+ ENV["ARTIFACTORY_USER_AGENT"] || USER_AGENT
53
53
  end
54
54
 
55
55
  #
@@ -58,7 +58,7 @@ module Artifactory
58
58
  # @return [String, nil]
59
59
  #
60
60
  def username
61
- ENV['ARTIFACTORY_USERNAME']
61
+ ENV["ARTIFACTORY_USERNAME"]
62
62
  end
63
63
 
64
64
  #
@@ -67,7 +67,16 @@ module Artifactory
67
67
  # @return [String, nil]
68
68
  #
69
69
  def password
70
- ENV['ARTIFACTORY_PASSWORD']
70
+ ENV["ARTIFACTORY_PASSWORD"]
71
+ end
72
+
73
+ #
74
+ # The API Key for authentication
75
+ #
76
+ # @return [String, nil]
77
+ #
78
+ def api_key
79
+ ENV["ARTIFACTORY_API_KEY"]
71
80
  end
72
81
 
73
82
  #
@@ -76,7 +85,7 @@ module Artifactory
76
85
  # @return [String, nil]
77
86
  #
78
87
  def proxy_address
79
- ENV['ARTIFACTORY_PROXY_ADDRESS']
88
+ ENV["ARTIFACTORY_PROXY_ADDRESS"]
80
89
  end
81
90
 
82
91
  #
@@ -85,7 +94,7 @@ module Artifactory
85
94
  # @return [String, nil]
86
95
  #
87
96
  def proxy_password
88
- ENV['ARTIFACTORY_PROXY_PASSWORD']
97
+ ENV["ARTIFACTORY_PROXY_PASSWORD"]
89
98
  end
90
99
 
91
100
  #
@@ -94,7 +103,7 @@ module Artifactory
94
103
  # @return [String, nil]
95
104
  #
96
105
  def proxy_port
97
- ENV['ARTIFACTORY_PROXY_PORT']
106
+ ENV["ARTIFACTORY_PROXY_PORT"]
98
107
  end
99
108
 
100
109
  #
@@ -103,7 +112,7 @@ module Artifactory
103
112
  # @return [String, nil]
104
113
  #
105
114
  def proxy_username
106
- ENV['ARTIFACTORY_PROXY_USERNAME']
115
+ ENV["ARTIFACTORY_PROXY_USERNAME"]
107
116
  end
108
117
 
109
118
  #
@@ -112,7 +121,7 @@ module Artifactory
112
121
  # @return [String, nil]
113
122
  #
114
123
  def ssl_pem_file
115
- ENV['ARTIFACTORY_SSL_PEM_FILE']
124
+ ENV["ARTIFACTORY_SSL_PEM_FILE"]
116
125
  end
117
126
 
118
127
  #
@@ -121,10 +130,10 @@ module Artifactory
121
130
  # @return [true, false]
122
131
  #
123
132
  def ssl_verify
124
- if ENV['ARTIFACTORY_SSL_VERIFY'].nil?
133
+ if ENV["ARTIFACTORY_SSL_VERIFY"].nil?
125
134
  true
126
135
  else
127
- %w[t y].include?(ENV['ARTIFACTORY_SSL_VERIFY'].downcase[0])
136
+ %w{t y}.include?(ENV["ARTIFACTORY_SSL_VERIFY"].downcase[0])
128
137
  end
129
138
  end
130
139
 
@@ -134,8 +143,8 @@ module Artifactory
134
143
  # @return [Integer]
135
144
  #
136
145
  def read_timeout
137
- if ENV['ARTIFACTORY_READ_TIMEOUT']
138
- ENV['ARTIFACTORY_READ_TIMEOUT'].to_i
146
+ if ENV["ARTIFACTORY_READ_TIMEOUT"]
147
+ ENV["ARTIFACTORY_READ_TIMEOUT"].to_i
139
148
  else
140
149
  120
141
150
  end