netbox-client-ruby 0.10.3 → 0.12.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 +4 -4
- data/README.md +6 -1
- data/lib/netbox_client_ruby/api/dcim/site.rb +1 -0
- data/lib/netbox_client_ruby/api/tenancy/contact.rb +15 -0
- data/lib/netbox_client_ruby/api/tenancy/contact_group.rb +15 -0
- data/lib/netbox_client_ruby/api/tenancy/contact_groups.rb +20 -0
- data/lib/netbox_client_ruby/api/tenancy/contacts.rb +20 -0
- data/lib/netbox_client_ruby/api/tenancy.rb +6 -2
- data/lib/netbox_client_ruby/connection.rb +1 -1
- data/lib/netbox_client_ruby.rb +1 -0
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0ec3f9f7eeecdfbf0ea27be99fcdc749b371e176836b33827768777ec1860e0
|
4
|
+
data.tar.gz: b3cf23880550f48e8d2e5c3bf84f1d882a99a45d4e0eafafeed8e6a64130a59a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2ca9232342a5442b2560a9b1d13c1cd6c1405966d93756d6ff13acc44bad289bc0c910996fbeb520cd2abf49b212a9f10a1f305d787e35961a1155d10669965
|
7
|
+
data.tar.gz: 19cf2457e0c1abdfc787fdb199dbcdf041264fb59e5cb6381d54e626c07937ca367862681396dedc25863f23e14c07fb51e75df07d3eb9fe0ca2636d3f53b2e6
|
data/README.md
CHANGED
@@ -47,7 +47,10 @@ NetboxClientRuby.configure do |config|
|
|
47
47
|
config.netbox.auth.rsa_private_key.password = ''
|
48
48
|
config.netbox.pagination.default_limit = 50
|
49
49
|
config.faraday.adapter = Faraday.default_adapter
|
50
|
+
# https://lostisland.github.io/faraday/#/customization/request-options
|
50
51
|
config.faraday.request_options = { open_timeout: 1, timeout: 5 }
|
52
|
+
# see: https://lostisland.github.io/faraday/#/customization/ssl-options
|
53
|
+
config.faraday.ssl_options = { verify: true }
|
51
54
|
config.faraday.logger = :logger # built-in options: :logger, :detailed_logger; default: nil
|
52
55
|
end
|
53
56
|
```
|
@@ -191,6 +194,8 @@ Not all objects which the Netbox API exposes are currently implemented. Implemen
|
|
191
194
|
* Tenancy:
|
192
195
|
* Tenant: `NetboxClientRuby.tenancy.tenants`
|
193
196
|
* Tenant Groups: `NetboxClientRuby.tenancy.tenant_groups`
|
197
|
+
* Contact: `NetboxClientRuby.tenancy.contacts`
|
198
|
+
* Contact Groups: `NetboxClientRuby.tenancy.contact_groups`
|
194
199
|
* Virtualization:
|
195
200
|
* Cluster Types: `NetboxClientRuby.virtualization.cluster_types`
|
196
201
|
* Cluster Groups: `NetboxClientRuby.virtualization.cluster_groups`
|
@@ -240,7 +245,7 @@ Before opening a PR, please
|
|
240
245
|
* extend the existing specs
|
241
246
|
* run rspec
|
242
247
|
* run rubocop and fix your warnings
|
243
|
-
* check if this README.md file needs adjustments
|
248
|
+
* check if this `README.md` file needs adjustments
|
244
249
|
|
245
250
|
## License
|
246
251
|
|
@@ -19,6 +19,7 @@ module NetboxClientRuby
|
|
19
19
|
path 'dcim/sites/:id/'
|
20
20
|
creation_path 'dcim/sites/'
|
21
21
|
object_fields(
|
22
|
+
tenant: proc { |raw_region| Tenancy::Tenant.new raw_region['id'] },
|
22
23
|
region: proc { |raw_region| DCIM::Region.new raw_region['id'] },
|
23
24
|
status: proc do |raw_status|
|
24
25
|
STATUS_VALUES.key(raw_status['value']) || raw_status['value']
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NetboxClientRuby
|
4
|
+
module Tenancy
|
5
|
+
class Contact
|
6
|
+
include Entity
|
7
|
+
|
8
|
+
id id: :id
|
9
|
+
deletable true
|
10
|
+
path 'tenancy/contacts/:id/'
|
11
|
+
creation_path 'tenancy/contacts/'
|
12
|
+
object_fields group: proc { |raw_data| ContactGroup.new raw_data['id'] }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NetboxClientRuby
|
4
|
+
module Tenancy
|
5
|
+
class ContactGroup
|
6
|
+
include Entity
|
7
|
+
|
8
|
+
id id: :id
|
9
|
+
deletable true
|
10
|
+
path 'tenancy/contact-groups/:id/'
|
11
|
+
creation_path 'tenancy/contact-groups/'
|
12
|
+
object_fields parent: proc { |raw_data| ContactGroup.new raw_data['id'] }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NetboxClientRuby
|
4
|
+
module Tenancy
|
5
|
+
class ContactGroups
|
6
|
+
include Entities
|
7
|
+
|
8
|
+
path 'tenancy/contact-groups/'
|
9
|
+
data_key 'results'
|
10
|
+
count_key 'count'
|
11
|
+
entity_creator :entity_creator
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def entity_creator(raw_entity)
|
16
|
+
ContactGroup.new raw_entity['id']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NetboxClientRuby
|
4
|
+
module Tenancy
|
5
|
+
class Contacts
|
6
|
+
include Entities
|
7
|
+
|
8
|
+
path 'tenancy/contacts/'
|
9
|
+
data_key 'results'
|
10
|
+
count_key 'count'
|
11
|
+
entity_creator :entity_creator
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def entity_creator(raw_entity)
|
16
|
+
Contact.new raw_entity['id']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -4,7 +4,9 @@ module NetboxClientRuby
|
|
4
4
|
module Tenancy
|
5
5
|
{
|
6
6
|
tenants: Tenants,
|
7
|
-
tenant_groups: TenantGroups
|
7
|
+
tenant_groups: TenantGroups,
|
8
|
+
contacts: Contacts,
|
9
|
+
contact_groups: ContactGroups
|
8
10
|
}.each_pair do |method_name, class_name|
|
9
11
|
define_method(method_name) { class_name.new }
|
10
12
|
module_function(method_name)
|
@@ -12,7 +14,9 @@ module NetboxClientRuby
|
|
12
14
|
|
13
15
|
{
|
14
16
|
tenant: Tenant,
|
15
|
-
tenant_group: TenantGroup
|
17
|
+
tenant_group: TenantGroup,
|
18
|
+
contact: Contact,
|
19
|
+
contact_group: ContactGroup
|
16
20
|
}.each_pair do |method_name, class_name|
|
17
21
|
define_method(method_name) { |id| class_name.new id }
|
18
22
|
module_function(method_name)
|
@@ -28,7 +28,7 @@ module NetboxClientRuby
|
|
28
28
|
|
29
29
|
private_class_method def self.build_faraday(request_encoding: :json)
|
30
30
|
config = NetboxClientRuby.config
|
31
|
-
Faraday.new(url: config.netbox.api_base_url, headers: headers) do |faraday|
|
31
|
+
Faraday.new(url: config.netbox.api_base_url, headers: headers, ssl: config.faraday.ssl_options) do |faraday|
|
32
32
|
faraday.request request_encoding
|
33
33
|
faraday.response config.faraday.logger if config.faraday.logger
|
34
34
|
faraday.response :json, content_type: /\bjson$/
|
data/lib/netbox_client_ruby.rb
CHANGED
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.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nine Internet Solutions AG
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: 2.6.0
|
109
|
-
description:
|
109
|
+
description:
|
110
110
|
email:
|
111
111
|
- support@nine.ch
|
112
112
|
executables: []
|
@@ -225,6 +225,10 @@ files:
|
|
225
225
|
- lib/netbox_client_ruby/api/secrets/secrets.rb
|
226
226
|
- lib/netbox_client_ruby/api/secrets/session_key.rb
|
227
227
|
- lib/netbox_client_ruby/api/tenancy.rb
|
228
|
+
- lib/netbox_client_ruby/api/tenancy/contact.rb
|
229
|
+
- lib/netbox_client_ruby/api/tenancy/contact_group.rb
|
230
|
+
- lib/netbox_client_ruby/api/tenancy/contact_groups.rb
|
231
|
+
- lib/netbox_client_ruby/api/tenancy/contacts.rb
|
228
232
|
- lib/netbox_client_ruby/api/tenancy/tenant.rb
|
229
233
|
- lib/netbox_client_ruby/api/tenancy/tenant_group.rb
|
230
234
|
- lib/netbox_client_ruby/api/tenancy/tenant_groups.rb
|
@@ -254,7 +258,7 @@ licenses:
|
|
254
258
|
- MIT
|
255
259
|
metadata:
|
256
260
|
allowed_push_host: https://rubygems.org
|
257
|
-
post_install_message:
|
261
|
+
post_install_message:
|
258
262
|
rdoc_options: []
|
259
263
|
require_paths:
|
260
264
|
- lib
|
@@ -270,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
274
|
version: '0'
|
271
275
|
requirements: []
|
272
276
|
rubygems_version: 3.4.19
|
273
|
-
signing_key:
|
277
|
+
signing_key:
|
274
278
|
specification_version: 4
|
275
279
|
summary: A read/write client for Netbox v2.
|
276
280
|
test_files: []
|