upguard 0.0.1 → 0.0.2
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/lib/upguard/Account.rb +41 -0
- data/lib/upguard/Incident.rb +33 -0
- data/lib/upguard.rb +1 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b683026e4527311504fdc094069f88cf2316bd9a
|
4
|
+
data.tar.gz: dc37e5246f08faf9bb48276d82a55f97080d36bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d818fd9c9654bd4f0734ab41bf023d38d06268426bde802b9b2903c60514598ee2c0afe58a7461ad21c82ea9e30e77dfb8cc715925fc54df5b36605eab5baf45
|
7
|
+
data.tar.gz: 035215c2a4cbec42e2579c880797925ea6e7ab1fba69eaea16ad40c5657b675f423dab5efc331ad747835797f5190cafad17896e32011f748dd1d657517537bb
|
data/lib/upguard/Account.rb
CHANGED
@@ -105,6 +105,39 @@ module UpGuard
|
|
105
105
|
return list
|
106
106
|
end
|
107
107
|
|
108
|
+
|
109
|
+
def incidents
|
110
|
+
obj = http_get("/api/v2/incidents.json")
|
111
|
+
list = []
|
112
|
+
obj.each do |x|
|
113
|
+
elem = Incident.new(self.appliance_hostname, self.api_key, self.sec_key, self.insecure)
|
114
|
+
elem.id = x["id"]
|
115
|
+
elem.external_id = x["external_id"]
|
116
|
+
elem.short_description = x["short_description"]
|
117
|
+
elem.started_at = x["started_at"]
|
118
|
+
elem.ended_at = x["ended_at"]
|
119
|
+
elem.url = x["url"]
|
120
|
+
list << elem
|
121
|
+
end
|
122
|
+
return list
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
def jobs
|
127
|
+
obj = http_get("/api/v2/jobs.json")
|
128
|
+
list = []
|
129
|
+
obj.each do |x|
|
130
|
+
elem = Job.new(self.appliance_hostname, self.api_key, self.sec_key, self.insecure)
|
131
|
+
elem.id = x["id"]
|
132
|
+
elem.organisation_id = x["organisation_id"]
|
133
|
+
elem.source_id = x["source_id"]
|
134
|
+
elem.source_type = x["source_type"]
|
135
|
+
elem.status = x["status"]
|
136
|
+
list << elem
|
137
|
+
end
|
138
|
+
return list
|
139
|
+
end
|
140
|
+
|
108
141
|
def new_node
|
109
142
|
return Node.new(self.appliance_hostname, self.api_key, self.sec_key, self.insecure)
|
110
143
|
end
|
@@ -222,6 +255,14 @@ module UpGuard
|
|
222
255
|
return elem
|
223
256
|
end
|
224
257
|
|
258
|
+
def find_node_by_id(id)
|
259
|
+
url = /api/v2/nodes/#{self.id}.json?id=#{id}
|
260
|
+
obj = http_get(url)
|
261
|
+
elem = Node.new(self.appliance_hostname, self.api_key, self.sec_key, self.insecure)
|
262
|
+
elem.from_hash(obj)
|
263
|
+
return elem
|
264
|
+
end
|
265
|
+
|
225
266
|
|
226
267
|
end
|
227
268
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class Incident < BaseObject
|
3
|
+
attr_accessor :ended_at
|
4
|
+
attr_accessor :external_id
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :short_description
|
7
|
+
attr_accessor :started_at
|
8
|
+
attr_accessor :url
|
9
|
+
def from_hash(h)
|
10
|
+
self.ended_at = h['ended_at'] if h.include?('ended_at')
|
11
|
+
self.external_id = h['external_id'] if h.include?('external_id')
|
12
|
+
self.id = h['id'] if h.include?('id')
|
13
|
+
self.short_description = h['short_description'] if h.include?('short_description')
|
14
|
+
self.started_at = h['started_at'] if h.include?('started_at')
|
15
|
+
self.url = h['url'] if h.include?('url')
|
16
|
+
end
|
17
|
+
def to_hash
|
18
|
+
h = {}
|
19
|
+
h['ended_at'] = self.ended_at
|
20
|
+
h['external_id'] = self.external_id
|
21
|
+
h['id'] = self.id
|
22
|
+
h['short_description'] = self.short_description
|
23
|
+
h['started_at'] = self.started_at
|
24
|
+
h['url'] = self.url
|
25
|
+
return h
|
26
|
+
end
|
27
|
+
def to_json
|
28
|
+
h = to_hash
|
29
|
+
return h.to_json
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/lib/upguard.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative 'upguard/ConnectionManagerGroup'
|
|
5
5
|
require_relative 'upguard/Environment'
|
6
6
|
require_relative 'upguard/Event'
|
7
7
|
require_relative 'upguard/EventAction'
|
8
|
+
require_relative 'upguard/Incident'
|
8
9
|
require_relative 'upguard/MediumType'
|
9
10
|
require_relative 'upguard/Node'
|
10
11
|
require_relative 'upguard/NodeGroup'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upguard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- UpGuard Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- lib/upguard/Environment.rb
|
54
54
|
- lib/upguard/Event.rb
|
55
55
|
- lib/upguard/EventAction.rb
|
56
|
+
- lib/upguard/Incident.rb
|
56
57
|
- lib/upguard/MediumType.rb
|
57
58
|
- lib/upguard/Node.rb
|
58
59
|
- lib/upguard/NodeGroup.rb
|
@@ -81,8 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
82
|
version: '0'
|
82
83
|
requirements: []
|
83
84
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.6.14
|
85
86
|
signing_key:
|
86
87
|
specification_version: 4
|
87
|
-
summary: UpGuard Ruby
|
88
|
+
summary: UpGuard SDK for Ruby
|
88
89
|
test_files: []
|