kaseya 0.2.1 → 0.3.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: b5ad6c0a0415b68bdc9ca495a9fbee4babb2a4349de954cad1567f2c0cd85c25
4
- data.tar.gz: 0c5283ff6cec97289dd4c1daf1302cb89eb6437a29532437b346b669b3cecdef
3
+ metadata.gz: 94e0d3ecfa7451e7a2cfc5545e6bbfee00c6b178500ed4ba5cccf466f7abc31b
4
+ data.tar.gz: 71ad0f0316370bf15b72fc79b1e922bf77e0e9357dc9754136f4519d47780e16
5
5
  SHA512:
6
- metadata.gz: 024ed23ad0256c5bc8bdfca5d135135aedd314e3589366b7f5c8564feedd7e662a20c93bd6d3c51ad635387f55b5250a8818eafbbc4f139cb6931e78b5a8ab69
7
- data.tar.gz: 91052f7d6d62c39e26469eb0d6f3220cead6a393abf6ee5591964c44bb38a95c449759289b31aec16721ac76c913a988028a9bc40edd4ad666c47d6c78d139e7
6
+ metadata.gz: dd92a57f3cf460bdbbdae7afeb31a79883f2a4f0be346e87b0bc3775940583c0272d3e17623d21493729f79c3adcc90ef7f1cd3094d0c28284cba8ca9043d2c1
7
+ data.tar.gz: 3fbcad66ca43de9f97f9e2aa391f826cb0fb6f9b53cb704f18be61188cded930176404ce89bbe26711e68856b2986b03d558b35911003f4b0b3e0d3bb9952106
data/.env.template ADDED
@@ -0,0 +1,4 @@
1
+ BMS_HOST=host
2
+ BMS_USERNAME=username
3
+ BMS_PASSWORD=password
4
+ BMS_TENANT=tenant
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /.idea
2
3
  /.yardoc
3
4
  /_yardoc/
4
5
  /coverage/
@@ -13,4 +14,5 @@
13
14
  # Debugging history
14
15
  .byebug_history
15
16
 
16
- Gemfile.lock
17
+ Gemfile.lock
18
+ .env
data/kaseya.gemspec CHANGED
@@ -23,12 +23,13 @@ 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_development_dependency "bundler", "~> 1.16"
27
- spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "bundler", "~> 2.1"
27
+ spec.add_development_dependency "rake", ">= 12.3.3"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  spec.add_development_dependency "byebug"
30
+ spec.add_development_dependency "webmock"
31
+ spec.add_development_dependency "dotenv"
30
32
 
31
- spec.add_dependency "faraday", "~> 0.15.0"
32
- spec.add_dependency "faraday_middleware", "~> 0.13.1"
33
+ spec.add_dependency "faraday", "~> 1.0"
33
34
  spec.add_dependency "activesupport", ">= 5.0"
34
35
  end
@@ -3,5 +3,9 @@ module Kaseya::BMS
3
3
  def new(params = {})
4
4
  post "servicedesk/tickets", params
5
5
  end
6
+
7
+ def find(id)
8
+ get_one "servicedesk/tickets/#{id}"
9
+ end
6
10
  end
7
11
  end
@@ -1,5 +1,5 @@
1
1
  module Kaseya::BMS
2
- class HttpErrors < Faraday::Response::Middleware
2
+ class HttpErrors < Faraday::Middleware
3
3
  def on_complete(env)
4
4
  case env[:status].to_i
5
5
  when 400..600
@@ -7,4 +7,4 @@ module Kaseya::BMS
7
7
  end
8
8
  end
9
9
  end
10
- end
10
+ end
data/lib/kaseya/bms.rb CHANGED
@@ -50,4 +50,4 @@ module Kaseya
50
50
  raise Kaseya::ConnectionFailed, e.message
51
51
  end
52
52
  end
53
- end
53
+ end
@@ -1,5 +1,4 @@
1
1
  require "faraday"
2
- require "faraday_middleware"
3
2
 
4
3
  module Kaseya
5
4
  class Connection
@@ -15,7 +14,7 @@ module Kaseya
15
14
  conn.use klass
16
15
  end
17
16
 
18
- conn.authorization :Bearer, @token
17
+ conn.request :authorization, :Bearer, @token
19
18
  conn.request :json
20
19
  conn.response :json
21
20
  conn.adapter Faraday.default_adapter
@@ -57,4 +56,4 @@ module Kaseya
57
56
  end
58
57
  end
59
58
  end
60
- end
59
+ end
@@ -19,4 +19,4 @@ module Kaseya
19
19
  !error?
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module Kaseya
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,19 @@
1
+ module Kaseya::VSA
2
+ class Client::Alarms < Api
3
+ def all(params = {})
4
+ get_many "assetmgmt/alarms/true", params
5
+ end
6
+
7
+ def new_alarms(params = {})
8
+ get_many "assetmgmt/alarms/false", params
9
+ end
10
+
11
+ def find(id)
12
+ get_one "assetmgmt/alarms/#{id}"
13
+ end
14
+
15
+ def close(id)
16
+ put "assetmgmt/alarms/#{id}/close"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ module Kaseya::VSA
2
+ class Client::Assets < Api
3
+ def all(params = {})
4
+ get_many "assetmgmt/assets", params
5
+ end
6
+
7
+ def find(id)
8
+ get_one "assetmgmt/assets/#{id}"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Kaseya::VSA
2
+ class Client::Logs < Api
3
+ def alarms_by_agent(agent_guid, params = {})
4
+ get_many "assetmgmt/logs/#{agent_guid}/alarms", params
5
+ end
6
+ end
7
+ end
@@ -19,5 +19,17 @@ module Kaseya::VSA
19
19
  def organizations
20
20
  @organizations ||= Client::Organizations.new(@connection)
21
21
  end
22
+
23
+ def assets
24
+ @assets ||= Client::Assets.new(@connection)
25
+ end
26
+
27
+ def alarms
28
+ @alarms ||= Client::Alarms.new(@connection)
29
+ end
30
+
31
+ def logs
32
+ @logs ||= Client::Logs.new(@connection)
33
+ end
22
34
  end
23
35
  end
@@ -1,5 +1,5 @@
1
1
  module Kaseya::VSA
2
- class HttpErrors < Faraday::Response::Middleware
2
+ class HttpErrors < Faraday::Middleware
3
3
  def on_complete(env)
4
4
  case env[:status].to_i
5
5
  when 400..600
@@ -7,4 +7,4 @@ module Kaseya::VSA
7
7
  end
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Kaseya::VSA
2
- class JsonErrors < Faraday::Response::Middleware
2
+ class JsonErrors < Faraday::Middleware
3
3
  def on_complete(env)
4
4
  unless env.response.body["ResponseCode"] == 0
5
5
  raise VSAError, env.response
data/lib/kaseya/vsa.rb CHANGED
@@ -26,7 +26,7 @@ module Kaseya
26
26
  faraday.use JsonErrors
27
27
  faraday.use HttpErrors
28
28
 
29
- faraday.authorization :Basic, auth
29
+ faraday.request :authorization, :Basic, auth
30
30
  faraday.request :url_encoded
31
31
  faraday.response :json
32
32
  faraday.adapter Faraday.default_adapter
@@ -39,4 +39,4 @@ module Kaseya
39
39
  raise Kaseya::ConnectionFailed, e.message
40
40
  end
41
41
  end
42
- end
42
+ end
data/lib/kaseya.rb CHANGED
@@ -2,6 +2,7 @@ require "kaseya/version"
2
2
 
3
3
  require "active_support"
4
4
  require "active_support/core_ext/hash"
5
+ require "active_support/core_ext/module/delegation"
5
6
 
6
7
  module Kaseya
7
8
  require "kaseya/collection"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaseya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Bisnett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-02 00:00:00.000000000 Z
11
+ date: 2023-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.1'
20
20
  type: :development
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: '1.16'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,33 +67,47 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: faraday
70
+ name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.15.0
76
- type: :runtime
75
+ version: '0'
76
+ type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.15.0
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: faraday_middleware
84
+ name: dotenv
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: faraday
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: 0.13.1
103
+ version: '1.0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: 0.13.1
110
+ version: '1.0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: activesupport
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +129,7 @@ executables: []
115
129
  extensions: []
116
130
  extra_rdoc_files: []
117
131
  files:
132
+ - ".env.template"
118
133
  - ".gitignore"
119
134
  - ".rspec"
120
135
  - ".travis.yml"
@@ -152,6 +167,9 @@ files:
152
167
  - lib/kaseya/vsa/api.rb
153
168
  - lib/kaseya/vsa/client.rb
154
169
  - lib/kaseya/vsa/client/agents.rb
170
+ - lib/kaseya/vsa/client/alarms.rb
171
+ - lib/kaseya/vsa/client/assets.rb
172
+ - lib/kaseya/vsa/client/logs.rb
155
173
  - lib/kaseya/vsa/client/machine_groups.rb
156
174
  - lib/kaseya/vsa/client/organizations.rb
157
175
  - lib/kaseya/vsa/configuration.rb
@@ -178,8 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
196
  - !ruby/object:Gem::Version
179
197
  version: '0'
180
198
  requirements: []
181
- rubyforge_project:
182
- rubygems_version: 2.7.6.2
199
+ rubygems_version: 3.1.6
183
200
  signing_key:
184
201
  specification_version: 4
185
202
  summary: Ruby client for the Kaseya BMS and VSA APIs