n_able_rails 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 163ab657ef304faa50d80584cc28b6edd07cc64f
4
+ data.tar.gz: ffdb95fd03266830d1f1fc6ef8c308efc074a107
5
+ SHA512:
6
+ metadata.gz: f5fd517e6f5541eb39c80a616052a09246a80dba400dfdd7e06162ae87bdafd3f5e1092cc74a79f54e9eceb8871516ec15bac1bb6e7c86ee2183aba207fe22ad
7
+ data.tar.gz: 41c3b4c15563ee1de0ae374749380a74a0c899d9f6847309e30039848dcf6ce879268cb892b91cf46c69657e479340a7796e53780bb4447329c6de18443a5965
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.6
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in n_able_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Alex Myers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # NAbleRails
2
+
3
+ A simple Ruby wrapper to interact with N-able's API.
4
+
5
+ V0.1 This is a Read-Only version of the gem.
6
+ No changes will be made directly to the server only information will
7
+ be pulled from the server. This may change in different versions.
8
+
9
+ Instructions to your N-able server is
10
+ [Here](https://secure.n-able.com/webhelp/NC_9-1-0_SO_en/Content/SA_docs/API_Level_Integration/API_Integration_WebServiceLevel.html)
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'n_able_rails'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install n_able_rails
27
+
28
+ ## Usage
29
+
30
+ Start by initializing the N-Able Gem with the sas_url, the username, and
31
+ password.
32
+
33
+ The user must be an SO-Admin on the N-able Server.
34
+
35
+ ```ruby
36
+ NAbleRails.initialize("http://sasurl.com", "Bob_Ross",
37
+ "Happy_Little_Password123")
38
+ ```
39
+
40
+ ## Methods
41
+
42
+ Get the server version info.
43
+
44
+ ```ruby
45
+ NAbleRails.version_info
46
+ ```
47
+
48
+ List all devices for a customer
49
+ ```ruby
50
+ NAbleRails.list_devices("customer_id")
51
+ ```
52
+
53
+ Get a specific devices information
54
+ ```ruby
55
+ NAbleRails.get_device_info("device_id")
56
+ ```
57
+
58
+ List all properties of a device
59
+ ```ruby
60
+ NAbleRails.list_device_property("device_id")
61
+ ```
62
+
63
+ List all customers
64
+ ```ruby
65
+ NAbleRails.list_customers
66
+ ```
67
+
68
+ Get the device status
69
+ ```ruby
70
+ NAbleRails.device_status("device_id")
71
+ ```
72
+
73
+ ## Development
74
+
75
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
76
+
77
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
78
+
79
+ ## License
80
+
81
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
82
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "n_able_rails"
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
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ module NAbleRails
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,62 @@
1
+ require "n_able_rails/version"
2
+ require 'savon'
3
+
4
+ module NAbleRails
5
+ attr_accessor :username, :password
6
+
7
+ # Initialize required params to begin calls
8
+ def self.initialize(sas_url, username, password)
9
+ @username = username
10
+ @password = password
11
+
12
+ # create a client for the service
13
+ @client = Savon.client(wsdl: "#{sas_url}/dms/services/ServerEI?wsdl")
14
+ end
15
+
16
+ # List all available operations for the api.
17
+ def self.operations
18
+ @client.operations
19
+ end
20
+
21
+ # Sanity Check to see if you can hit the server.
22
+ def self.version_info
23
+ @client.call(:version_info_get)
24
+ end
25
+
26
+ def self.list_devices(customer_id)
27
+ @client.call(:device_list, message: { Username: @username, Password: @password, Settings:
28
+ { "@xsi:type" => "impl:ArrayOf_tns1_T_KeyPair", "@env:arrayType" => "impl:T_KeyPair[]",
29
+ Setting:{key: "customerID", value: customer_id} }
30
+ })
31
+ end
32
+
33
+ def self.get_device_info(device_id)
34
+ @client.call(:device_get, message: { Username: @username, Password: @password, Settings:
35
+ { Setting:{key: "deviceID", value: device_id} }
36
+ } )
37
+ end
38
+
39
+ def self.list_device_property(device_id)
40
+ @client.call(:device_property_list, message: { Username: @username, Password: @password, DeviceIDs: { DeviceID: device_id}, DeviceNames:{}, FilterIDs:{}, FilterNames:{}, ReverseOrder: false })
41
+ end
42
+
43
+ def self.list_customers
44
+ @client.call(:customer_list, message: { Username: @username, Password: @password, Settings: { } })
45
+ end
46
+
47
+ def self.device_asset_info_export2ById(device_id)
48
+ @client.call(:device_asset_info_export2, message: { Version: "0.0", Username: @username, Password: @password, Settings:
49
+ { Setting:{Key: 'TargetByDeviceID', Value: {Value: device_id} } }
50
+ } )
51
+ end
52
+
53
+ def self.device_asset_info_export2()
54
+ @client.call(:device_asset_info_export2, message: { Version: "0.0", Username: @username, Password: @password })
55
+ end
56
+
57
+ def self.device_status(device_id)
58
+ @client.call(:device_get_status, message: { Username: @username, Password: @password, Settings:
59
+ { Setting:{key: "deviceID", value: device_id} }
60
+ } )
61
+ end
62
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'n_able_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "n_able_rails"
8
+ spec.version = NAbleRails::VERSION
9
+ spec.authors = ["Alex Myers"]
10
+ spec.email = ["dev.alex.myers@gmail.com"]
11
+ spec.description = "An Api wrapper for N-Able from SolarWinds"
12
+
13
+ spec.summary = %q{Ruby Wrapper for N-Able API}
14
+ spec.homepage = "https://github.com/enspiresoftware/n_able_rails"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", '~> 0'
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ # spec.add_development_dependency "minitest", "~> 5.0"
25
+ # spec.add_development_dependency "minitest-emoji"
26
+ # spec.add_development_dependency "pry"
27
+
28
+ spec.add_runtime_dependency 'savon', '~> 2.3'
29
+ spec.add_runtime_dependency 'wasabi', '~> 3.2'
30
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: n_able_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Myers
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: savon
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: wasabi
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.2'
69
+ description: An Api wrapper for N-Able from SolarWinds
70
+ email:
71
+ - dev.alex.myers@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - lib/n_able_rails.rb
85
+ - lib/n_able_rails/version.rb
86
+ - n_able_rails.gemspec
87
+ homepage: https://github.com/enspiresoftware/n_able_rails
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.4.8
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Ruby Wrapper for N-Able API
111
+ test_files: []
112
+ has_rdoc: