upguard 0.0.9 → 0.0.10

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 CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  SHA512:
3
- metadata.gz: bc7ad7ee10a1cc327b0b9d7573b7fdbe430ed0fa9e99d88c954409f528db607e88285f4192ea4b9bb6263f4ece1c0e0c2b0c3a1da789ef65ef90d919f69abafe
4
- data.tar.gz: 8507ab1d252f8c03c9c93779e25fda91f7127760ab845ff4e6e7dd5ab99383133a953fe10a5b5f37c20a3944d09b4a3d64d7b49863872b4ae2d06bff1be80cb7
3
+ metadata.gz: 73a3f8cdabc58e33984017a37b30cf51a019be1fa5c97ce1697a083c464dc5ec990f1daf59d4db8c1930a07153baafbd9ffb3251206fe85b432c1b71b11e7e12
4
+ data.tar.gz: f23fe2899775985d9d55041ba81ae53c38fe07df39718a3e56f5a7d2e2bc354585bc0cba59291f4793a815bb1a88f9b378c0a5c26dda51cc971043a484a4dec5
@@ -1,4 +1,5 @@
1
1
  require_relative 'upguard/BaseObject'
2
+ require_relative 'upguard/Version'
2
3
  require_relative 'upguard/Account'
3
4
  require_relative 'upguard/ConnectionManager'
4
5
  require_relative 'upguard/ConnectionManagerList'
@@ -118,7 +118,7 @@ module UpGuard
118
118
  def events_with_view_name(view_name)
119
119
  url = "/api/v2/events.json?view_name=#{view_name}"
120
120
  obj = http_get(url)
121
- the_list = []
121
+ the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure
122
122
  obj.each do |x|
123
123
  elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
124
124
  elem.id = x["id"]
@@ -133,7 +133,7 @@ module UpGuard
133
133
  def events_with_query(query)
134
134
  url = "/api/v2/events.json?query=#{query}"
135
135
  obj = http_get(url)
136
- the_list = []
136
+ the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure
137
137
  obj.each do |x|
138
138
  elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
139
139
  elem.id = x["id"]
@@ -449,6 +449,7 @@ module UpGuard
449
449
  elem.name = x["name"] if x.include?("name")
450
450
  elem.role = x["role"] if x.include?("role")
451
451
  elem.surname = x["surname"] if x.include?("surname")
452
+ elem.external_id = x["external_id"] if x.include?("external_id")
452
453
  the_list << elem
453
454
  end
454
455
  return the_list
@@ -42,6 +42,17 @@ module UpGuard
42
42
  end
43
43
 
44
44
 
45
+
46
+ def find_by_id(id)
47
+ @inner_list.each do |x|
48
+ if x.id.to_s == id.to_s
49
+ return x
50
+ end
51
+ end
52
+ return nil
53
+ end
54
+
55
+
45
56
 
46
57
  end
47
58
  end
@@ -10,7 +10,17 @@ module UpGuard
10
10
  h = to_hash
11
11
  return h.to_json(options)
12
12
  end
13
+ SERVICE = "SC"
13
14
  SERVER = "SV"
15
+ DATABASE = "DB"
16
+ DESKTOP = "DT"
17
+ SWITCH = "SW"
18
+ FIREWALL = "FW"
19
+ ROUTER = "RT"
20
+ SMART_PHONE = "PH"
21
+ ROBOT = "RB"
22
+ SAN_STORAGE = "SS"
23
+ WEBSITE = "WS"
14
24
 
15
25
  end
16
26
  end
@@ -8,6 +8,7 @@ module UpGuard
8
8
  attr_accessor :invited
9
9
  attr_accessor :last_sign_in_at
10
10
  attr_accessor :expiry
11
+ attr_accessor :external_id
11
12
  def from_hash(h)
12
13
  self.id = h['id'] if h.include?('id')
13
14
  self.name = h['name'] if h.include?('name')
@@ -17,6 +18,7 @@ module UpGuard
17
18
  self.invited = h['invited'] if h.include?('invited')
18
19
  self.last_sign_in_at = h['last_sign_in_at'] if h.include?('last_sign_in_at')
19
20
  self.expiry = h['expiry'] if h.include?('expiry')
21
+ self.external_id = h['external_id'] if h.include?('external_id')
20
22
  end
21
23
  def to_hash
22
24
  h = {}
@@ -28,6 +30,7 @@ module UpGuard
28
30
  h['invited'] = self.invited
29
31
  h['last_sign_in_at'] = self.last_sign_in_at
30
32
  h['expiry'] = self.expiry
33
+ h['external_id'] = self.external_id
31
34
  return h
32
35
  end
33
36
  def to_json(options = nil)
@@ -40,6 +43,18 @@ module UpGuard
40
43
  return obj
41
44
  end
42
45
 
46
+
47
+ def update
48
+ h = to_hash
49
+ h.delete("id")
50
+ h.delete("email")
51
+ h.delete("role")
52
+ h.delete("invited")
53
+ h.delete("last_sign_in_at")
54
+ h.delete("expiry")
55
+ http_put("/api/v2/users/#{self.id}.json", h)
56
+ end
57
+
43
58
 
44
59
  end
45
60
  end
@@ -43,6 +43,17 @@ module UpGuard
43
43
 
44
44
 
45
45
 
46
+ def find_by_id(id)
47
+ @inner_list.each do |x|
48
+ if x.id.to_s == id.to_s
49
+ return x
50
+ end
51
+ end
52
+ return nil
53
+ end
54
+
55
+
56
+
46
57
  def find_by_email(email)
47
58
  @inner_list.each do |x|
48
59
  if x.email == email
@@ -0,0 +1,21 @@
1
+ module UpGuard
2
+ class Version < BaseObject
3
+ def from_hash(h)
4
+ end
5
+ def to_hash
6
+ h = {}
7
+ return h
8
+ end
9
+ def to_json(options = nil)
10
+ h = to_hash
11
+ return h.to_json(options)
12
+ end
13
+
14
+ def version
15
+ return "0.0.10"
16
+ end
17
+
18
+
19
+
20
+ end
21
+ end
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.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - UpGuard Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-02 00:00:00.000000000 Z
11
+ date: 2020-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -81,6 +81,7 @@ files:
81
81
  - lib/upguard/SystemMetricList.rb
82
82
  - lib/upguard/User.rb
83
83
  - lib/upguard/UserList.rb
84
+ - lib/upguard/Version.rb
84
85
  homepage: https://www.upguard.com
85
86
  licenses: []
86
87
  metadata: {}