netbox-client-ruby 0.5.4 → 0.6.0

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
  SHA256:
3
- metadata.gz: 67bf42f57fa35176857fba1a7ec57797b0345ccf5de0c4074f5bcf2c5be77c04
4
- data.tar.gz: 20002e43346be5ce7d5a276656406b7096b302eaf055ef87a81844ae5f72a343
3
+ metadata.gz: 63568afc97653757809347e5b44d878e6d66294e2c8190068d471dedc680ef86
4
+ data.tar.gz: 961c454e7e81c28a216c323604743a0d24b5bd01a3e6fe95231b42f1d99d664b
5
5
  SHA512:
6
- metadata.gz: 1db48b81125135817a7fe7aeed34a3b9ec589e1415bdf12c6fe26b8c69119ca540daca0d3077221f4c77aa6ff84289de765ff6b0aff1764c21652d08371eb5bf
7
- data.tar.gz: feb71125dcb8896ca6777333f7a857032ac247b286c004d971d2d22fff256e294926adecf713466e092637455a75eb206056dd5297830e32630bf1b72bf573f7
6
+ metadata.gz: b1cce1d8566e42c11a12cc636b6996e3ed4f984d84157c37f376c75adc0a25609e38609191dd376ea406ae862d2931c9a264d5c492e81e98188216cff417c0bf
7
+ data.tar.gz: 347a7b25e339e3c06cf422bf012607c39216ea63908e993b1e76f716c99eef8e5135090d4a28d65445f928f11914c373adbaa94b9a8d0b968c26f427d21f3f8d
@@ -14,7 +14,7 @@ jobs:
14
14
  fail-fast: false
15
15
  matrix:
16
16
  os: [ubuntu-latest]
17
- ruby: [2.5, 2.6, 2.7, 3.0]
17
+ ruby: [2.6, 2.7, 3.0]
18
18
  runs-on: ${{ matrix.os }}
19
19
  steps:
20
20
  - uses: actions/checkout@v2
data/README.md CHANGED
@@ -162,6 +162,10 @@ Not all objects which the Netbox API exposes are currently implemented. Implemen
162
162
  * Virtual Chassis: `NetboxClientRuby.dcim.virtual_chassis_list`
163
163
  (⚠️ Exception: The access is different and the class is called `VirtualChassisList` because the plural and singular
164
164
  names are the same and this poses a conflict.)
165
+ * Extras:
166
+ * Config Contexts: `NetboxClientRuby.extras.config_contexts`
167
+ * Journal Entries: `NetboxClientRuby.extras.journal_entries`
168
+ * Tags: `NetboxClientRuby.extras.tags`
165
169
  * IPAM:
166
170
  * Aggregates: `NetboxClientRuby.ipam.aggregates`
167
171
  * IP Addresses: `NetboxClientRuby.ipam.ip_addresses`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.6.0
@@ -29,6 +29,7 @@ module NetboxClientRuby
29
29
  primary_ip4: proc { |raw_data| IPAM::IpAddress.new raw_data['id'] },
30
30
  primary_ip6: proc { |raw_data| IPAM::IpAddress.new raw_data['id'] },
31
31
  virtual_chassis: proc { |raw_data| DCIM::VirtualChassis.new raw_data['id'] },
32
+ tags: proc { |raw_data| Extras::Tag.new raw_data['id'] },
32
33
  )
33
34
  end
34
35
  end
@@ -0,0 +1,25 @@
1
+ require 'netbox_client_ruby/entity'
2
+
3
+ module NetboxClientRuby
4
+ module Extras
5
+ class ConfigContext
6
+ include Entity
7
+
8
+ id id: :id
9
+ deletable true
10
+ path 'extras/config-contexts/:id.json'
11
+ creation_path 'extras/config-contexts/'
12
+ object_fields(
13
+ regions: proc { |raw_data| DCIM::Region.new raw_data['id'] },
14
+ sites: proc { |raw_data| DCIM::Site.new raw_data['id'] },
15
+ roles: proc { |raw_data| DCIM::DeviceRole.new raw_data['id'] },
16
+ platforms: proc { |raw_data| DCIM::Platform.new raw_data['id'] },
17
+ cluster_groups: proc { |raw_data| Virtualization::ClusterGroup.new raw_data['id'] },
18
+ clusters: proc { |raw_data| Virtualization::Cluster.new raw_data['id'] },
19
+ tenant_groups: proc { |raw_data| Tenancy::TenantGroup.new raw_data['id'] },
20
+ tenants: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] },
21
+ tags: proc { |raw_data| Tag.new raw_data['id'] }
22
+ )
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,21 @@
1
+ require 'netbox_client_ruby/entities'
2
+ require 'netbox_client_ruby/api/extras/config_context'
3
+
4
+ module NetboxClientRuby
5
+ module Extras
6
+ class ConfigContexts
7
+ include Entities
8
+
9
+ path 'extras/config-contexts.json'
10
+ data_key 'results'
11
+ count_key 'count'
12
+ entity_creator :entity_creator
13
+
14
+ private
15
+
16
+ def entity_creator(raw_entity)
17
+ ConfigContext.new raw_entity['id']
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ require 'netbox_client_ruby/entities'
2
+ require 'netbox_client_ruby/api/extras/journal_entry'
3
+
4
+ module NetboxClientRuby
5
+ module Extras
6
+ class JournalEntries
7
+ include Entities
8
+
9
+ path 'extras/journal-entries.json'
10
+ data_key 'results'
11
+ count_key 'count'
12
+ entity_creator :entity_creator
13
+
14
+ private
15
+
16
+ def entity_creator(raw_entity)
17
+ JournalEntry.new raw_entity['id']
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ require 'netbox_client_ruby/entity'
2
+
3
+ module NetboxClientRuby
4
+ module Extras
5
+ class JournalEntry
6
+ include Entity
7
+
8
+ id id: :id
9
+ deletable true
10
+ path 'extras/journal-entries/:id.json'
11
+ creation_path 'extras/journal-entries/'
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'netbox_client_ruby/entity'
2
+
3
+ module NetboxClientRuby
4
+ module Extras
5
+ class Tag
6
+ include Entity
7
+
8
+ id id: :id
9
+ deletable true
10
+ path 'extras/tags/:id.json'
11
+ creation_path 'extras/tags/'
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ require 'netbox_client_ruby/entities'
2
+ require 'netbox_client_ruby/api/extras/tag'
3
+
4
+ module NetboxClientRuby
5
+ module Extras
6
+ class Tags
7
+ include Entities
8
+
9
+ path 'extras/tags.json'
10
+ data_key 'results'
11
+ count_key 'count'
12
+ entity_creator :entity_creator
13
+
14
+ private
15
+
16
+ def entity_creator(raw_entity)
17
+ Tag.new raw_entity['id']
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,28 @@
1
+ require 'netbox_client_ruby/api/extras/config_context'
2
+ require 'netbox_client_ruby/api/extras/config_contexts'
3
+ require 'netbox_client_ruby/api/extras/journal_entry'
4
+ require 'netbox_client_ruby/api/extras/journal_entries'
5
+ require 'netbox_client_ruby/api/extras/tag'
6
+ require 'netbox_client_ruby/api/extras/tags'
7
+
8
+ module NetboxClientRuby
9
+ module Extras
10
+ {
11
+ config_contexts: ConfigContexts,
12
+ journal_entries: JournalEntries,
13
+ tags: Tags
14
+ }.each_pair do |method_name, class_name|
15
+ define_method(method_name) { class_name.new }
16
+ module_function(method_name)
17
+ end
18
+
19
+ {
20
+ config_context: ConfigContext,
21
+ journal_entry: JournalEntry,
22
+ tag: Tag
23
+ }.each_pair do |method_name, class_name|
24
+ define_method(method_name) { |id| class_name.new id }
25
+ module_function(method_name)
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,6 @@
1
1
  require 'netbox_client_ruby/api/circuits'
2
2
  require 'netbox_client_ruby/api/dcim'
3
+ require 'netbox_client_ruby/api/extras'
3
4
  require 'netbox_client_ruby/api/ipam'
4
5
  require 'netbox_client_ruby/api/secrets'
5
6
  require 'netbox_client_ruby/api/tenancy'
@@ -15,6 +16,10 @@ module NetboxClientRuby
15
16
  NetboxClientRuby::DCIM
16
17
  end
17
18
 
19
+ def self.extras
20
+ NetboxClientRuby::Extras
21
+ end
22
+
18
23
  def self.ipam
19
24
  NetboxClientRuby::IPAM
20
25
  end
@@ -13,19 +13,19 @@ module NetboxClientRuby
13
13
  setting :rsa_private_key do
14
14
  # the default is intentionally not `~/.ssh/id_rsa`,
15
15
  # to not accidentally leak someone's main rsa private key
16
- setting :path, '~/.ssh/netbox_rsa'
16
+ setting :path, default: '~/.ssh/netbox_rsa'
17
17
  setting :password
18
18
  end
19
19
  end
20
20
  setting :pagination do
21
- setting :default_limit, 50
22
- setting :max_limit, MAX_SIGNED_64BIT_INT
21
+ setting :default_limit, default: 50
22
+ setting :max_limit, default: MAX_SIGNED_64BIT_INT
23
23
  end
24
24
  end
25
25
 
26
26
  setting :faraday do
27
- setting :adapter, :net_http
27
+ setting :adapter, default: :net_http
28
28
  setting :logger
29
- setting :request_options, open_timeout: 1, timeout: 5
29
+ setting :request_options, default: { open_timeout: 1, timeout: 5 }
30
30
  end
31
31
  end
@@ -23,7 +23,9 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_runtime_dependency 'dry-configurable', '~> 0.1'
26
+ spec.required_ruby_version = '>= 2.6.0'
27
+
28
+ spec.add_runtime_dependency 'dry-configurable', '~> 0.13.0'
27
29
  spec.add_runtime_dependency 'faraday', '~> 0.11', '>= 0.11.0'
28
30
  spec.add_runtime_dependency 'faraday-detailed_logger', '~> 2.1'
29
31
  spec.add_runtime_dependency 'faraday_middleware', '~> 0.11'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netbox-client-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Mäder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-19 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: 0.13.0
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.1'
26
+ version: 0.13.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +276,13 @@ files:
276
276
  - lib/netbox_client_ruby/api/dcim/sites.rb
277
277
  - lib/netbox_client_ruby/api/dcim/virtual_chassis.rb
278
278
  - lib/netbox_client_ruby/api/dcim/virtual_chassis_list.rb
279
+ - lib/netbox_client_ruby/api/extras.rb
280
+ - lib/netbox_client_ruby/api/extras/config_context.rb
281
+ - lib/netbox_client_ruby/api/extras/config_contexts.rb
282
+ - lib/netbox_client_ruby/api/extras/journal_entries.rb
283
+ - lib/netbox_client_ruby/api/extras/journal_entry.rb
284
+ - lib/netbox_client_ruby/api/extras/tag.rb
285
+ - lib/netbox_client_ruby/api/extras/tags.rb
279
286
  - lib/netbox_client_ruby/api/ipam.rb
280
287
  - lib/netbox_client_ruby/api/ipam/aggregate.rb
281
288
  - lib/netbox_client_ruby/api/ipam/aggregates.rb
@@ -340,7 +347,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
340
347
  requirements:
341
348
  - - ">="
342
349
  - !ruby/object:Gem::Version
343
- version: '0'
350
+ version: 2.6.0
344
351
  required_rubygems_version: !ruby/object:Gem::Requirement
345
352
  requirements:
346
353
  - - ">="