artifactory-permissions 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1161328888803592d738756747044a3d022b4d6d590b06d65113edbfe1ecdc48
4
- data.tar.gz: f01a33dc6d38fc78d49840d4927815bb597c55c80078ab8989bcc6dfc3ff7da7
3
+ metadata.gz: 8bf020b2ec9adf639c3b7f002b13e944a2c43ac9ad0da32419378e407d17e55b
4
+ data.tar.gz: 1dc6e70c69e7588fdaf0e1ae3c905d8f19a5d5a395311131a080faf02155144d
5
5
  SHA512:
6
- metadata.gz: 3cdb700bf58cc589b79cb296eda1bed6547ebb4c6733a12289d4d753a1d304f971a4a4a0c757677074c691cc46f897bc1523aa1b739d70689dac1fa2d2c1487c
7
- data.tar.gz: ec5ce848b5c6fd17e2e110cdb901d2250fa63a6f180b906b2ae144c24d6d560dba9301a88b20ea93c368f6568f1600f98c3ab62560803a520eaad2fa0cfcc156
6
+ metadata.gz: 1cac073029443d01e0c24ef068ea545e180df1487d855e30eff881b39bc899a9776690f615b6c0a10905f2e0bae1e5d2d353227604deb25abd6be5b1fe6cba68
7
+ data.tar.gz: 80849b609522af18b3a47ea60b0460468f80eb525c514b596b0522e2bde0f6525774fb5e1d72b317c99a734cc1f7df02b5f68a60ac36e9c1adfd8d8f3bf1d81d
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in artifactory-permissions.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
8
- gem "webmock", "~> 3.8"
9
- gem "byebug", "~> 11.1"
6
+ gem "rake", "~> 12.3"
7
+ gem "rspec", "~> 3.13"
8
+ gem "webmock", "~> 3.25"
9
+ gem "byebug", "~> 12.0"
data/README.md CHANGED
@@ -27,7 +27,7 @@ Or install it yourself as:
27
27
  ### List permission targets accessible to your user
28
28
  ```ruby
29
29
  api_client = Artifactory::Permissions.api_client endpoint: 'http://artifactory.local',
30
- api_key: 'your-api-key'
30
+ access_token: 'your-access-token'
31
31
 
32
32
 
33
33
  Artifactory::Permissions.list api_client: api_client
@@ -37,7 +37,7 @@ Artifactory::Permissions.list api_client: api_client
37
37
  ### Show / find / get permission target
38
38
  ```ruby
39
39
  api_client = Artifactory::Permissions.api_client endpoint: 'http://artifactory.local',
40
- api_key: 'your-api-key'
40
+ access_token: 'your-access-token'
41
41
 
42
42
 
43
43
  _status, permission_target = Artifactory::Permissions.find name: "<pt-name>",
@@ -52,7 +52,7 @@ _status, permission_target = Artifactory::Permissions.get "<permission-target-re
52
52
  ### Add / update / delete users and groups
53
53
  ```ruby
54
54
  api_client = Artifactory::Permissions.api_client endpoint: 'http://artifactory.local',
55
- api_key: 'your-api-key'
55
+ access_token: 'your-access-token'
56
56
 
57
57
  _status, permission_target = Artifactory::Permissions.find name: "<permission-target-name>",
58
58
  api_client: api_client
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.summary = %q{Ruby Lib for managing Artifactory PermissionTargets}
10
10
  spec.description = %q{Ruby Lib for managing Artifactory PermissionTargets}
11
11
  spec.homepage = "https://github.com/tscholz/artifactory-permissions"
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
13
13
 
14
14
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
15
15
 
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_dependency "httparty", "~> 0.18"
29
+ spec.add_dependency "httparty", "~> 0.23.1"
30
30
  end
@@ -1,12 +1,14 @@
1
1
  module Artifactory
2
2
  module Permissions
3
3
  class Errors
4
+ attr_reader :errors
5
+
4
6
  def initialize
5
7
  @errors = Hash.new { |h, k| h[k] = [] }
6
8
  end
7
9
 
8
10
  def add(key, msg)
9
- @errors[key] << msg
11
+ errors[key] << msg
10
12
  self
11
13
  end
12
14
 
@@ -17,22 +19,22 @@ module Artifactory
17
19
  alias_method :none?, :empty?
18
20
 
19
21
  def any?
20
- @errors.values.flatten.any?
22
+ errors.values.flatten.any?
21
23
  end
22
24
 
23
25
  def full_messages
24
- @errors
26
+ errors
25
27
  .keys
26
28
  .map { |key| [key, full_message(key)].join(": ") }
27
29
  .join("; ")
28
30
  end
29
31
 
30
32
  def full_message(key)
31
- @errors[key].join(", ")
33
+ errors[key].join(", ")
32
34
  end
33
35
 
34
36
  def to_h
35
- @errors.dup
37
+ errors.dup
36
38
  end
37
39
  end
38
40
  end
@@ -20,11 +20,11 @@ module Artifactory
20
20
 
21
21
  HANDLED_ERRORS = [SocketError] + HTTP_ERRORS
22
22
 
23
- attr_reader :endpoint, :api_key
23
+ attr_reader :endpoint, :access_token
24
24
 
25
- def initialize(endpoint:, api_key:)
26
- @endpoint = endpoint
27
- @api_key = api_key
25
+ def initialize(endpoint:, access_token:)
26
+ @endpoint = endpoint
27
+ @access_token = access_token
28
28
  end
29
29
 
30
30
  def list_permissions
@@ -50,7 +50,7 @@ module Artifactory
50
50
 
51
51
  def put(path, data)
52
52
  response = self.class.put uri_for(path),
53
- body: data.to_json,
53
+ body: data.to_json,
54
54
  headers: headers
55
55
 
56
56
  handle_response response
@@ -89,7 +89,7 @@ module Artifactory
89
89
  end
90
90
 
91
91
  def auth_headers
92
- { "X-JFrog-Art-Api" => api_key }
92
+ { "Authorization" => "Bearer #{access_token}" }
93
93
  end
94
94
 
95
95
  def url_safe(string)
@@ -8,9 +8,9 @@ module Artifactory
8
8
  module V2
9
9
  module_function
10
10
 
11
- def api_client(endpoint:, api_key:)
12
- ApiClient.new endpoint: endpoint,
13
- api_key: api_key
11
+ def api_client(endpoint:, access_token:)
12
+ ApiClient.new endpoint: endpoint,
13
+ access_token: access_token
14
14
  end
15
15
 
16
16
  def parse_permission_target(payload)
@@ -1,5 +1,5 @@
1
1
  module Artifactory
2
2
  module Permissions
3
- VERSION = "0.1.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -76,9 +76,9 @@ module Artifactory
76
76
  [permission_target.errors? ? :error : :ok, permission_target, permission_target.errors]
77
77
  end
78
78
 
79
- def api_client(endpoint:, api_key:)
79
+ def api_client(endpoint:, access_token:)
80
80
  V2.api_client endpoint: endpoint,
81
- api_key: api_key
81
+ access_token: access_token
82
82
  end
83
83
  end
84
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artifactory-permissions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Scholz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-14 00:00:00.000000000 Z
11
+ date: 2025-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.18'
19
+ version: 0.23.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.18'
26
+ version: 0.23.1
27
27
  description: Ruby Lib for managing Artifactory PermissionTargets
28
28
  email:
29
29
  - thomas.scholz@rubyapps.ch
@@ -72,14 +72,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 2.3.0
75
+ version: 3.2.0
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.0.3
82
+ rubygems_version: 3.5.22
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Ruby Lib for managing Artifactory PermissionTargets