netbox-client-ruby 0.13.0 → 0.13.1
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/VERSION +1 -0
- data/lib/netbox_client_ruby/api/circuits/circuit.rb +2 -2
- data/lib/netbox_client_ruby/api/circuits/circuit_termination.rb +1 -1
- data/lib/netbox_client_ruby/api/circuits.rb +4 -6
- data/lib/netbox_client_ruby/api/dcim/device_type.rb +1 -1
- data/lib/netbox_client_ruby/api/dcim/platform.rb +1 -1
- data/lib/netbox_client_ruby/api/dcim/site.rb +2 -2
- data/lib/netbox_client_ruby/api/dcim.rb +4 -6
- data/lib/netbox_client_ruby/api/extras/config_context.rb +1 -1
- data/lib/netbox_client_ruby/api/extras.rb +4 -6
- data/lib/netbox_client_ruby/api/ipam/ip_address.rb +5 -4
- data/lib/netbox_client_ruby/api/ipam/ip_range.rb +1 -1
- data/lib/netbox_client_ruby/api/ipam/prefix.rb +1 -1
- data/lib/netbox_client_ruby/api/ipam/service.rb +1 -1
- data/lib/netbox_client_ruby/api/ipam.rb +4 -6
- data/lib/netbox_client_ruby/api/secrets/rsa_key_pair.rb +1 -1
- data/lib/netbox_client_ruby/api/secrets/session_key.rb +6 -1
- data/lib/netbox_client_ruby/api/secrets.rb +4 -6
- data/lib/netbox_client_ruby/api/tenancy.rb +4 -6
- data/lib/netbox_client_ruby/api/virtualization.rb +2 -4
- data/lib/netbox_client_ruby/communication.rb +13 -28
- data/lib/netbox_client_ruby/connection.rb +3 -3
- data/lib/netbox_client_ruby/entities.rb +8 -10
- data/lib/netbox_client_ruby/entity.rb +49 -24
- data/lib/netbox_client_ruby/version.rb +11 -0
- data/lib/netbox_client_ruby.rb +10 -0
- metadata +10 -28
- data/.dockerignore +0 -17
- data/.github/workflows/codeql-analysis.yml +0 -42
- data/.github/workflows/gem-push.yml +0 -26
- data/.github/workflows/rspec.yml +0 -45
- data/.gitignore +0 -21
- data/.rspec +0 -1
- data/Appraisals +0 -17
- data/Dockerfile +0 -14
- data/Gemfile +0 -19
- data/Rakefile +0 -8
- data/bin/console +0 -36
- data/bin/setup +0 -7
- data/docker/start.sh +0 -3
- data/docker/start.test.sh +0 -3
- data/docker-compose.test.yml +0 -16
- data/docker-compose.yml +0 -31
- data/dump.sql +0 -9895
- data/gemfiles/faraday0.gemfile +0 -16
- data/gemfiles/faraday1.gemfile +0 -16
- data/gemfiles/faraday2.gemfile +0 -16
- data/netbox-client-ruby.gemspec +0 -30
- data/netbox-client-ruby_rsa +0 -51
- data/netbox-client-ruby_rsa.pub +0 -1
- data/netbox.env +0 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module NetboxClientRuby
|
|
4
|
-
module Entity
|
|
4
|
+
module Entity # rubocop:disable Metrics/ModuleLength
|
|
5
5
|
include NetboxClientRuby::Communication
|
|
6
6
|
|
|
7
7
|
def self.included(other_klass)
|
|
@@ -26,20 +26,7 @@ module NetboxClientRuby
|
|
|
26
26
|
|
|
27
27
|
raise ArgumentError, "No 'id' was defined, but one is expected." if fields.empty?
|
|
28
28
|
|
|
29
|
-
@id_fields =
|
|
30
|
-
if fields.first.is_a?(Hash)
|
|
31
|
-
fields.first.each { |key, value| @id_fields[key.to_s] = value.to_s }
|
|
32
|
-
else
|
|
33
|
-
fields.map(&:to_s).each do |field|
|
|
34
|
-
field_as_string = field.to_s
|
|
35
|
-
@id_fields[field_as_string] = field_as_string
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
@id_fields.keys.each do |field|
|
|
40
|
-
define_method(field) { instance_variable_get :"@#{field}" }
|
|
41
|
-
end
|
|
42
|
-
|
|
29
|
+
@id_fields = load_attributes(fields)
|
|
43
30
|
@id_fields
|
|
44
31
|
end
|
|
45
32
|
|
|
@@ -49,7 +36,7 @@ module NetboxClientRuby
|
|
|
49
36
|
@readonly_fields = fields.map(&:to_s)
|
|
50
37
|
end
|
|
51
38
|
|
|
52
|
-
def deletable(deletable = false)
|
|
39
|
+
def deletable(deletable = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
53
40
|
@deletable ||= deletable
|
|
54
41
|
end
|
|
55
42
|
|
|
@@ -88,7 +75,9 @@ module NetboxClientRuby
|
|
|
88
75
|
end
|
|
89
76
|
end
|
|
90
77
|
|
|
91
|
-
|
|
78
|
+
private
|
|
79
|
+
|
|
80
|
+
def sanitize_mapping(fields_to_class_map) # rubocop:disable Metrics/MethodLength
|
|
92
81
|
fields_map = {}
|
|
93
82
|
fields_to_class_map.each do |field_definition|
|
|
94
83
|
if field_definition.is_a?(Hash)
|
|
@@ -101,9 +90,28 @@ module NetboxClientRuby
|
|
|
101
90
|
end
|
|
102
91
|
fields_map
|
|
103
92
|
end
|
|
93
|
+
|
|
94
|
+
def load_attributes(fields) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
95
|
+
id_fields = {}
|
|
96
|
+
|
|
97
|
+
if fields.first.is_a?(Hash)
|
|
98
|
+
fields.first.each { |key, value| id_fields[key.to_s] = value.to_s }
|
|
99
|
+
else
|
|
100
|
+
fields.map(&:to_s).each do |field|
|
|
101
|
+
field_as_string = field.to_s
|
|
102
|
+
id_fields[field_as_string] = field_as_string
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
id_fields.each_key do |field|
|
|
107
|
+
define_method(field) { instance_variable_get :"@#{field}" }
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
id_fields
|
|
111
|
+
end
|
|
104
112
|
end
|
|
105
113
|
|
|
106
|
-
def initialize(given_values = nil)
|
|
114
|
+
def initialize(given_values = nil) # rubocop:disable Metrics/MethodLength
|
|
107
115
|
return self if given_values.nil?
|
|
108
116
|
|
|
109
117
|
if id_fields.count == 1 && !given_values.is_a?(Hash)
|
|
@@ -138,6 +146,7 @@ module NetboxClientRuby
|
|
|
138
146
|
|
|
139
147
|
def save
|
|
140
148
|
return post unless ids_set?
|
|
149
|
+
|
|
141
150
|
patch
|
|
142
151
|
end
|
|
143
152
|
|
|
@@ -158,7 +167,7 @@ module NetboxClientRuby
|
|
|
158
167
|
self
|
|
159
168
|
end
|
|
160
169
|
|
|
161
|
-
def update(new_values)
|
|
170
|
+
def update(new_values) # rubocop:disable Metrics/MethodLength
|
|
162
171
|
new_values.each do |attribute, values|
|
|
163
172
|
s_attribute = attribute.to_s
|
|
164
173
|
next if readonly_fields.include? s_attribute
|
|
@@ -191,7 +200,7 @@ module NetboxClientRuby
|
|
|
191
200
|
dirty_data[name.to_s] = value
|
|
192
201
|
end
|
|
193
202
|
|
|
194
|
-
def method_missing(name_as_symbol, *args, &block)
|
|
203
|
+
def method_missing(name_as_symbol, *args, &block) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
|
195
204
|
name = name_as_symbol.to_s
|
|
196
205
|
|
|
197
206
|
if name.end_with?('=')
|
|
@@ -212,7 +221,7 @@ module NetboxClientRuby
|
|
|
212
221
|
super
|
|
213
222
|
end
|
|
214
223
|
|
|
215
|
-
def respond_to_missing?(name_as_symbol, *args)
|
|
224
|
+
def respond_to_missing?(name_as_symbol, *args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
216
225
|
name = name_as_symbol.to_s
|
|
217
226
|
|
|
218
227
|
return false if name.end_with?('=') && readonly_fields.include?(name[0..-2])
|
|
@@ -275,6 +284,23 @@ module NetboxClientRuby
|
|
|
275
284
|
self.class.object_fields
|
|
276
285
|
end
|
|
277
286
|
|
|
287
|
+
def hash_to_object(hash)
|
|
288
|
+
objectified_class = Class.new
|
|
289
|
+
objectified_instance = objectified_class.new
|
|
290
|
+
hash.each do |k, v|
|
|
291
|
+
variable_name = sanitize_variable_name(k)
|
|
292
|
+
variable_name = "_#{variable_name}" if objectified_instance.methods.map(&:to_s).include?(variable_name)
|
|
293
|
+
|
|
294
|
+
objectified_instance.instance_variable_set(:"@#{variable_name}", v)
|
|
295
|
+
objectified_class.send(:define_method, variable_name, proc { instance_variable_get(:"@#{variable_name}") })
|
|
296
|
+
end
|
|
297
|
+
objectified_instance
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def sanitize_variable_name(raw_name)
|
|
301
|
+
raw_name.gsub(/[^a-zA-Z0-9_]/, '_')
|
|
302
|
+
end
|
|
303
|
+
|
|
278
304
|
def data_to_obj(raw_data, klass_or_proc = nil)
|
|
279
305
|
if klass_or_proc.nil?
|
|
280
306
|
hash_to_object raw_data
|
|
@@ -308,6 +334,7 @@ module NetboxClientRuby
|
|
|
308
334
|
path.scan(/:([a-zA-Z_][a-zA-Z0-9_]+[!?=]?)/) do |match, *|
|
|
309
335
|
path_variable_value = send(match)
|
|
310
336
|
return interpreted_path.gsub! ":#{match}", path_variable_value.to_s unless path_variable_value.nil?
|
|
337
|
+
|
|
311
338
|
raise LocalError, "Received 'nil' while replacing ':#{match}' in '#{path}' with a value."
|
|
312
339
|
end
|
|
313
340
|
interpreted_path
|
|
@@ -323,9 +350,7 @@ module NetboxClientRuby
|
|
|
323
350
|
|
|
324
351
|
def extract_ids
|
|
325
352
|
id_fields.each do |id_attr, id_field|
|
|
326
|
-
unless data.key?(id_field)
|
|
327
|
-
raise LocalError, "Can't find the id field '#{id_field}' in the received data."
|
|
328
|
-
end
|
|
353
|
+
raise LocalError, "Can't find the id field '#{id_field}' in the received data." unless data.key?(id_field)
|
|
329
354
|
|
|
330
355
|
instance_variable_set(:"@#{id_attr}", data[id_field])
|
|
331
356
|
end
|
data/lib/netbox_client_ruby.rb
CHANGED
|
@@ -68,6 +68,16 @@ module NetboxClientRuby
|
|
|
68
68
|
setting :ssl_options, default: { verify: true }
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
def self.load_collection(collection, method_name, class_name)
|
|
72
|
+
collection.define_method(method_name) { class_name.new }
|
|
73
|
+
collection.__send__(:module_function, method_name)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def self.load_entity(entity, method_name, class_name)
|
|
77
|
+
entity.define_method(method_name) { |id| class_name.new id }
|
|
78
|
+
entity.__send__(:module_function, method_name)
|
|
79
|
+
end
|
|
80
|
+
|
|
71
81
|
def self.circuits
|
|
72
82
|
NetboxClientRuby::Circuits
|
|
73
83
|
end
|
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.13.
|
|
4
|
+
version: 0.13.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nine Internet Solutions AG
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dry-configurable
|
|
@@ -96,14 +96,14 @@ dependencies:
|
|
|
96
96
|
name: zeitwerk
|
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
|
98
98
|
requirements:
|
|
99
|
-
- - "
|
|
99
|
+
- - ">="
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
101
|
version: 2.6.0
|
|
102
102
|
type: :runtime
|
|
103
103
|
prerelease: false
|
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
|
106
|
-
- - "
|
|
106
|
+
- - ">="
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
108
|
version: 2.6.0
|
|
109
109
|
description:
|
|
@@ -113,28 +113,9 @@ executables: []
|
|
|
113
113
|
extensions: []
|
|
114
114
|
extra_rdoc_files: []
|
|
115
115
|
files:
|
|
116
|
-
- ".dockerignore"
|
|
117
|
-
- ".github/workflows/codeql-analysis.yml"
|
|
118
|
-
- ".github/workflows/gem-push.yml"
|
|
119
|
-
- ".github/workflows/rspec.yml"
|
|
120
|
-
- ".gitignore"
|
|
121
|
-
- ".rspec"
|
|
122
|
-
- Appraisals
|
|
123
|
-
- Dockerfile
|
|
124
|
-
- Gemfile
|
|
125
116
|
- LICENSE.txt
|
|
126
117
|
- README.md
|
|
127
|
-
-
|
|
128
|
-
- bin/console
|
|
129
|
-
- bin/setup
|
|
130
|
-
- docker-compose.test.yml
|
|
131
|
-
- docker-compose.yml
|
|
132
|
-
- docker/start.sh
|
|
133
|
-
- docker/start.test.sh
|
|
134
|
-
- dump.sql
|
|
135
|
-
- gemfiles/faraday0.gemfile
|
|
136
|
-
- gemfiles/faraday1.gemfile
|
|
137
|
-
- gemfiles/faraday2.gemfile
|
|
118
|
+
- VERSION
|
|
138
119
|
- lib/netbox-client-ruby.rb
|
|
139
120
|
- lib/netbox_client_ruby.rb
|
|
140
121
|
- lib/netbox_client_ruby/api/circuits.rb
|
|
@@ -251,15 +232,16 @@ files:
|
|
|
251
232
|
- lib/netbox_client_ruby/entities.rb
|
|
252
233
|
- lib/netbox_client_ruby/entity.rb
|
|
253
234
|
- lib/netbox_client_ruby/error.rb
|
|
254
|
-
-
|
|
255
|
-
- netbox-client-ruby_rsa
|
|
256
|
-
- netbox-client-ruby_rsa.pub
|
|
257
|
-
- netbox.env
|
|
235
|
+
- lib/netbox_client_ruby/version.rb
|
|
258
236
|
homepage: https://github.com/ninech/netbox-client-ruby
|
|
259
237
|
licenses:
|
|
260
238
|
- MIT
|
|
261
239
|
metadata:
|
|
262
240
|
allowed_push_host: https://rubygems.org
|
|
241
|
+
homepage_uri: https://github.com/ninech/netbox-client-ruby
|
|
242
|
+
changelog_uri: https://github.com/ninech/netbox-client-ruby/releases
|
|
243
|
+
source_code_uri: https://github.com/ninech/netbox-client-ruby
|
|
244
|
+
bug_tracker_uri: https://github.com/ninech/netbox-client-ruby/issues
|
|
263
245
|
post_install_message:
|
|
264
246
|
rdoc_options: []
|
|
265
247
|
require_paths:
|
data/.dockerignore
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
name: "CodeQL"
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ master ]
|
|
6
|
-
pull_request:
|
|
7
|
-
# The branches below must be a subset of the branches above
|
|
8
|
-
branches: [ master ]
|
|
9
|
-
schedule:
|
|
10
|
-
- cron: '25 2 * * 6'
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
analyze:
|
|
14
|
-
name: Analyze
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
permissions:
|
|
17
|
-
actions: read
|
|
18
|
-
contents: read
|
|
19
|
-
security-events: write
|
|
20
|
-
|
|
21
|
-
strategy:
|
|
22
|
-
fail-fast: false
|
|
23
|
-
matrix:
|
|
24
|
-
language: [ 'ruby' ]
|
|
25
|
-
|
|
26
|
-
steps:
|
|
27
|
-
- name: Checkout repository
|
|
28
|
-
uses: actions/checkout@v2
|
|
29
|
-
|
|
30
|
-
# Initializes the CodeQL tools for scanning.
|
|
31
|
-
- name: Initialize CodeQL
|
|
32
|
-
uses: github/codeql-action/init@v1
|
|
33
|
-
with:
|
|
34
|
-
languages: ${{ matrix.language }}
|
|
35
|
-
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
36
|
-
# By default, queries listed here will override any specified in a config file.
|
|
37
|
-
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
38
|
-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
39
|
-
- name: Autobuild
|
|
40
|
-
uses: github/codeql-action/autobuild@v1
|
|
41
|
-
- name: Perform CodeQL Analysis
|
|
42
|
-
uses: github/codeql-action/analyze@v1
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Ruby Gem
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "*"
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
name: Build + Publish
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
- uses: ruby/setup-ruby@v1
|
|
15
|
-
with:
|
|
16
|
-
ruby-version: 3.2
|
|
17
|
-
- name: Publish to RubyGems
|
|
18
|
-
run: |
|
|
19
|
-
mkdir -p $HOME/.gem
|
|
20
|
-
touch $HOME/.gem/credentials
|
|
21
|
-
chmod 0600 $HOME/.gem/credentials
|
|
22
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
23
|
-
gem build *.gemspec
|
|
24
|
-
gem push *.gem
|
|
25
|
-
env:
|
|
26
|
-
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.github/workflows/rspec.yml
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
-
# They are provided by a third-party and are governed by
|
|
3
|
-
# separate terms of service, privacy policy, and support
|
|
4
|
-
# documentation.
|
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
-
|
|
8
|
-
name: Ruby CI
|
|
9
|
-
|
|
10
|
-
on: [push, pull_request]
|
|
11
|
-
jobs:
|
|
12
|
-
test:
|
|
13
|
-
strategy:
|
|
14
|
-
fail-fast: false
|
|
15
|
-
matrix:
|
|
16
|
-
os: [ubuntu-latest]
|
|
17
|
-
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
|
18
|
-
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
|
|
19
|
-
gemfile:
|
|
20
|
-
[
|
|
21
|
-
'gemfiles/faraday1.gemfile',
|
|
22
|
-
'gemfiles/faraday2.gemfile',
|
|
23
|
-
]
|
|
24
|
-
# Faraday 0.x with Ruby 3.x not supported
|
|
25
|
-
exclude:
|
|
26
|
-
- ruby: '3.0'
|
|
27
|
-
gemfile: gemfiles/faraday0.gemfile
|
|
28
|
-
- ruby: '3.1'
|
|
29
|
-
gemfile: gemfiles/faraday0.gemfile
|
|
30
|
-
- ruby: '3.2'
|
|
31
|
-
gemfile: gemfiles/faraday0.gemfile
|
|
32
|
-
- ruby: '3.3'
|
|
33
|
-
gemfile: gemfiles/faraday0.gemfile
|
|
34
|
-
runs-on: ${{ matrix.os }}
|
|
35
|
-
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
|
36
|
-
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
|
|
37
|
-
steps:
|
|
38
|
-
- uses: actions/checkout@v4
|
|
39
|
-
with:
|
|
40
|
-
fetch-depth: 0
|
|
41
|
-
- uses: ruby/setup-ruby@v1
|
|
42
|
-
with:
|
|
43
|
-
ruby-version: ${{ matrix.ruby }}
|
|
44
|
-
bundler-cache: true
|
|
45
|
-
- run: bundle exec rake spec
|
data/.gitignore
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/.bundle/
|
|
2
|
-
/.yardoc
|
|
3
|
-
/_yardoc/
|
|
4
|
-
/coverage/
|
|
5
|
-
/doc/
|
|
6
|
-
/pkg/
|
|
7
|
-
/spec/reports/
|
|
8
|
-
/tmp/
|
|
9
|
-
|
|
10
|
-
# rspec failure tracking
|
|
11
|
-
.rspec_status
|
|
12
|
-
|
|
13
|
-
quickstart.rb
|
|
14
|
-
*.gz
|
|
15
|
-
|
|
16
|
-
vendor/
|
|
17
|
-
Gemfile.lock
|
|
18
|
-
*.gemfile.lock
|
|
19
|
-
|
|
20
|
-
# Ignore MacOS files
|
|
21
|
-
.DS_Store
|
data/.rspec
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--color
|
data/Appraisals
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
appraise 'faraday0' do
|
|
4
|
-
gem 'faraday', '< 1.0'
|
|
5
|
-
gem 'faraday_middleware', '< 1'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
appraise 'faraday1' do
|
|
9
|
-
gem 'faraday', '= 1.0'
|
|
10
|
-
gem 'faraday_middleware', '< 2'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
appraise 'faraday2' do
|
|
14
|
-
gem 'faraday', '< 3'
|
|
15
|
-
gem 'faraday-net_http_persistent'
|
|
16
|
-
remove_gem "faraday_middleware"
|
|
17
|
-
end
|
data/Dockerfile
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
ARG RUBY_VERSION=3.2.2
|
|
2
|
-
FROM ruby:${RUBY_VERSION}-alpine
|
|
3
|
-
|
|
4
|
-
RUN apk add --no-cache git openssl-dev build-base
|
|
5
|
-
|
|
6
|
-
RUN mkdir /app
|
|
7
|
-
WORKDIR /app
|
|
8
|
-
|
|
9
|
-
COPY Gemfile Gemfile.lock netbox-client-ruby.gemspec VERSION ./
|
|
10
|
-
RUN bundle install --jobs 4 --deployment --quiet
|
|
11
|
-
|
|
12
|
-
COPY . ./
|
|
13
|
-
|
|
14
|
-
CMD docker/start.sh
|
data/Gemfile
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source 'https://rubygems.org'
|
|
4
|
-
|
|
5
|
-
# Specify your gem dependencies in netbox-client-ruby.gemspec
|
|
6
|
-
gemspec
|
|
7
|
-
|
|
8
|
-
gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git'
|
|
9
|
-
gem 'pry'
|
|
10
|
-
gem 'rake'
|
|
11
|
-
gem 'rspec'
|
|
12
|
-
gem 'rubocop'
|
|
13
|
-
gem 'rubocop-performance'
|
|
14
|
-
gem 'rubocop-rake'
|
|
15
|
-
gem 'rubocop-rspec'
|
|
16
|
-
|
|
17
|
-
# fallback to faraday 1.x in dev environment
|
|
18
|
-
gem 'faraday', '~> 1.10'
|
|
19
|
-
gem 'faraday_middleware'
|
data/Rakefile
DELETED
data/bin/console
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'bundler/setup'
|
|
4
|
-
require 'netbox-client-ruby'
|
|
5
|
-
|
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
-
|
|
9
|
-
NetboxClientRuby.configure do |c|
|
|
10
|
-
c.netbox.auth.token = '0123456789abcdef0123456789abcdef01234567'
|
|
11
|
-
c.netbox.auth.rsa_private_key.path =
|
|
12
|
-
File.expand_path('../netbox-client-ruby_rsa', __dir__)
|
|
13
|
-
c.netbox.auth.rsa_private_key.password = nil
|
|
14
|
-
c.netbox.api_base_url = "http://#{`docker-compose port nginx 8080`.strip}/api/"
|
|
15
|
-
c.faraday.logger = :detailed_logger
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
NCR = NetboxClientRuby
|
|
19
|
-
|
|
20
|
-
version = File.read(File.expand_path('../VERSION', __dir__)).strip
|
|
21
|
-
|
|
22
|
-
puts <<~WELCOME_TEXT
|
|
23
|
-
This is using NetboxClientRuby v#{version}.
|
|
24
|
-
`NetboxClientRuby` has been abbreviated to `NCR` in this console.
|
|
25
|
-
You will be talking to '#{NetboxClientRuby.config.netbox.api_base_url}'.
|
|
26
|
-
|
|
27
|
-
Wondering how many regions you have in your Netbox?
|
|
28
|
-
Type: NetboxClientRuby.dcim.regions.count
|
|
29
|
-
Or Short: NCR.dcim.regions.count
|
|
30
|
-
WELCOME_TEXT
|
|
31
|
-
|
|
32
|
-
require 'pry'
|
|
33
|
-
Pry.start
|
|
34
|
-
|
|
35
|
-
# require 'irb'
|
|
36
|
-
# IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/docker/start.sh
DELETED
data/docker/start.test.sh
DELETED
data/docker-compose.test.yml
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
version: '2'
|
|
2
|
-
services:
|
|
3
|
-
app:
|
|
4
|
-
build:
|
|
5
|
-
context: .
|
|
6
|
-
args:
|
|
7
|
-
RUBY_VERSION: 3.2.2
|
|
8
|
-
image: netbox-client-ruby:3.2.2
|
|
9
|
-
command: 'docker/start.test.sh'
|
|
10
|
-
app27:
|
|
11
|
-
build:
|
|
12
|
-
context: .
|
|
13
|
-
args:
|
|
14
|
-
RUBY_VERSION: 2.7.8
|
|
15
|
-
image: netbox-client-ruby:2.7.8
|
|
16
|
-
command: 'docker/start.test.sh'
|
data/docker-compose.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
version: '2'
|
|
2
|
-
services:
|
|
3
|
-
nginx:
|
|
4
|
-
image: nginx:1.14-alpine
|
|
5
|
-
command: nginx -c /etc/netbox-nginx/nginx.conf
|
|
6
|
-
depends_on:
|
|
7
|
-
- netbox
|
|
8
|
-
volumes:
|
|
9
|
-
- netbox-nginx-config:/etc/netbox-nginx/
|
|
10
|
-
- netbox-static-files:/opt/netbox/netbox/static
|
|
11
|
-
ports:
|
|
12
|
-
- 80:8080
|
|
13
|
-
netbox:
|
|
14
|
-
image: ninech/netbox:v2.4.3
|
|
15
|
-
depends_on:
|
|
16
|
-
- postgres
|
|
17
|
-
volumes:
|
|
18
|
-
- netbox-static-files:/opt/netbox/netbox/static
|
|
19
|
-
- netbox-nginx-config:/etc/netbox-nginx/
|
|
20
|
-
env_file: 'netbox.env'
|
|
21
|
-
postgres:
|
|
22
|
-
image: postgres:10.4-alpine
|
|
23
|
-
environment:
|
|
24
|
-
POSTGRES_USER: netbox
|
|
25
|
-
POSTGRES_PASSWORD: netbox
|
|
26
|
-
POSTGRES_DB: netbox
|
|
27
|
-
volumes:
|
|
28
|
-
netbox-static-files:
|
|
29
|
-
driver: local
|
|
30
|
-
netbox-nginx-config:
|
|
31
|
-
driver: local
|