upguard 0.0.1 → 0.0.9

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.
Files changed (38) hide show
  1. checksums.yaml +2 -5
  2. data/lib/upguard.rb +19 -0
  3. data/lib/upguard/Account.rb +346 -102
  4. data/lib/upguard/BaseObject.rb +23 -22
  5. data/lib/upguard/ConnectionManager.rb +18 -3
  6. data/lib/upguard/ConnectionManagerGroup.rb +31 -9
  7. data/lib/upguard/ConnectionManagerGroupList.rb +47 -0
  8. data/lib/upguard/ConnectionManagerList.rb +47 -0
  9. data/lib/upguard/Environment.rb +34 -11
  10. data/lib/upguard/EnvironmentList.rb +47 -0
  11. data/lib/upguard/Event.rb +3 -3
  12. data/lib/upguard/EventAction.rb +8 -2
  13. data/lib/upguard/EventActionList.rb +47 -0
  14. data/lib/upguard/Incident.rb +33 -0
  15. data/lib/upguard/IncidentList.rb +47 -0
  16. data/lib/upguard/Job.rb +60 -0
  17. data/lib/upguard/JobList.rb +47 -0
  18. data/lib/upguard/MediumType.rb +2 -2
  19. data/lib/upguard/Node.rb +54 -18
  20. data/lib/upguard/NodeGroup.rb +80 -8
  21. data/lib/upguard/NodeGroupList.rb +47 -0
  22. data/lib/upguard/NodeGroupUser.rb +21 -0
  23. data/lib/upguard/NodeGroupUserList.rb +58 -0
  24. data/lib/upguard/NodeList.rb +47 -0
  25. data/lib/upguard/NodeType.rb +2 -2
  26. data/lib/upguard/OperatingSystem.rb +3 -3
  27. data/lib/upguard/OperatingSystemFamily.rb +8 -8
  28. data/lib/upguard/OperatingSystemFamilyList.rb +47 -0
  29. data/lib/upguard/OperatingSystemList.rb +47 -0
  30. data/lib/upguard/Policy.rb +79 -0
  31. data/lib/upguard/PolicyList.rb +47 -0
  32. data/lib/upguard/ScheduledJob.rb +6 -3
  33. data/lib/upguard/ScheduledJobList.rb +47 -0
  34. data/lib/upguard/SystemMetric.rb +2 -2
  35. data/lib/upguard/SystemMetricList.rb +47 -0
  36. data/lib/upguard/User.rb +2 -2
  37. data/lib/upguard/UserList.rb +58 -0
  38. metadata +23 -4
@@ -1,11 +1,13 @@
1
1
  module UpGuard
2
2
  class ScheduledJob < BaseObject
3
+ attr_accessor :data
3
4
  attr_accessor :id
4
5
  attr_accessor :source_id
5
6
  attr_accessor :source_name
6
7
  attr_accessor :source_type
7
8
  attr_accessor :status
8
9
  def from_hash(h)
10
+ self.data = h['data'] if h.include?('data')
9
11
  self.id = h['id'] if h.include?('id')
10
12
  self.source_id = h['source_id'] if h.include?('source_id')
11
13
  self.source_name = h['source_name'] if h.include?('source_name')
@@ -14,6 +16,7 @@ module UpGuard
14
16
  end
15
17
  def to_hash
16
18
  h = {}
19
+ h['data'] = self.data
17
20
  h['id'] = self.id
18
21
  h['source_id'] = self.source_id
19
22
  h['source_name'] = self.source_name
@@ -21,13 +24,13 @@ module UpGuard
21
24
  h['status'] = self.status
22
25
  return h
23
26
  end
24
- def to_json
27
+ def to_json(options = nil)
25
28
  h = to_hash
26
- return h.to_json
29
+ return h.to_json(options)
27
30
  end
28
31
 
29
32
  def load
30
- obj = http_get("/api/v2/scheduledu_jobs/#{self.id}.json")
33
+ obj = http_get("/api/v2/scheduled_jobs/#{self.id}.json")
31
34
  from_hash(obj)
32
35
  end
33
36
 
@@ -0,0 +1,47 @@
1
+ module UpGuard
2
+ class ScheduledJobList < 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
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure)
14
+ super(appliance_url, appliance_api_key, sec_key, insecure)
15
+ @inner_list = []
16
+ end
17
+
18
+ def count
19
+ return @inner_list.count
20
+ end
21
+
22
+ def [](idx)
23
+ return @inner_list[idx]
24
+ end
25
+
26
+
27
+
28
+ def each(&block)
29
+ @inner_list.each(&block)
30
+ end
31
+
32
+
33
+
34
+ def <<(obj)
35
+ @inner_list << obj
36
+ end
37
+
38
+
39
+
40
+ def to_json
41
+ return @inner_list.to_json
42
+ end
43
+
44
+
45
+
46
+ end
47
+ end
@@ -15,9 +15,9 @@ module UpGuard
15
15
  h['timestamp'] = self.timestamp
16
16
  return h
17
17
  end
18
- def to_json
18
+ def to_json(options = nil)
19
19
  h = to_hash
20
- return h.to_json
20
+ return h.to_json(options)
21
21
  end
22
22
 
23
23
  end
@@ -0,0 +1,47 @@
1
+ module UpGuard
2
+ class SystemMetricList < 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
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure)
14
+ super(appliance_url, appliance_api_key, sec_key, insecure)
15
+ @inner_list = []
16
+ end
17
+
18
+ def count
19
+ return @inner_list.count
20
+ end
21
+
22
+ def [](idx)
23
+ return @inner_list[idx]
24
+ end
25
+
26
+
27
+
28
+ def each(&block)
29
+ @inner_list.each(&block)
30
+ end
31
+
32
+
33
+
34
+ def <<(obj)
35
+ @inner_list << obj
36
+ end
37
+
38
+
39
+
40
+ def to_json
41
+ return @inner_list.to_json
42
+ end
43
+
44
+
45
+
46
+ end
47
+ end
@@ -30,9 +30,9 @@ module UpGuard
30
30
  h['expiry'] = self.expiry
31
31
  return h
32
32
  end
33
- def to_json
33
+ def to_json(options = nil)
34
34
  h = to_hash
35
- return h.to_json
35
+ return h.to_json(options)
36
36
  end
37
37
  def update_role(role)
38
38
  url = "/api/v2/users/update_role.json?role=#{role}"
@@ -0,0 +1,58 @@
1
+ module UpGuard
2
+ class UserList < 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
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure)
14
+ super(appliance_url, appliance_api_key, sec_key, insecure)
15
+ @inner_list = []
16
+ end
17
+
18
+ def count
19
+ return @inner_list.count
20
+ end
21
+
22
+ def [](idx)
23
+ return @inner_list[idx]
24
+ end
25
+
26
+
27
+
28
+ def each(&block)
29
+ @inner_list.each(&block)
30
+ end
31
+
32
+
33
+
34
+ def <<(obj)
35
+ @inner_list << obj
36
+ end
37
+
38
+
39
+
40
+ def to_json
41
+ return @inner_list.to_json
42
+ end
43
+
44
+
45
+
46
+ def find_by_email(email)
47
+ @inner_list.each do |x|
48
+ if x.email == email
49
+ return x
50
+ end
51
+ end
52
+ return nil
53
+ end
54
+
55
+
56
+
57
+ end
58
+ 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.1
4
+ version: 0.0.9
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-09 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -50,19 +50,38 @@ files:
50
50
  - lib/upguard/BaseObject.rb
51
51
  - lib/upguard/ConnectionManager.rb
52
52
  - lib/upguard/ConnectionManagerGroup.rb
53
+ - lib/upguard/ConnectionManagerGroupList.rb
54
+ - lib/upguard/ConnectionManagerList.rb
53
55
  - lib/upguard/Environment.rb
56
+ - lib/upguard/EnvironmentList.rb
54
57
  - lib/upguard/Event.rb
55
58
  - lib/upguard/EventAction.rb
59
+ - lib/upguard/EventActionList.rb
60
+ - lib/upguard/Incident.rb
61
+ - lib/upguard/IncidentList.rb
62
+ - lib/upguard/Job.rb
63
+ - lib/upguard/JobList.rb
56
64
  - lib/upguard/MediumType.rb
57
65
  - lib/upguard/Node.rb
58
66
  - lib/upguard/NodeGroup.rb
67
+ - lib/upguard/NodeGroupList.rb
68
+ - lib/upguard/NodeGroupUser.rb
69
+ - lib/upguard/NodeGroupUserList.rb
70
+ - lib/upguard/NodeList.rb
59
71
  - lib/upguard/NodeType.rb
60
72
  - lib/upguard/OperatingSystem.rb
61
73
  - lib/upguard/OperatingSystemFamily.rb
74
+ - lib/upguard/OperatingSystemFamilyList.rb
75
+ - lib/upguard/OperatingSystemList.rb
76
+ - lib/upguard/Policy.rb
77
+ - lib/upguard/PolicyList.rb
62
78
  - lib/upguard/ScheduledJob.rb
79
+ - lib/upguard/ScheduledJobList.rb
63
80
  - lib/upguard/SystemMetric.rb
81
+ - lib/upguard/SystemMetricList.rb
64
82
  - lib/upguard/User.rb
65
- homepage:
83
+ - lib/upguard/UserList.rb
84
+ homepage: https://www.upguard.com
66
85
  licenses: []
67
86
  metadata: {}
68
87
  post_install_message:
@@ -84,5 +103,5 @@ rubyforge_project:
84
103
  rubygems_version: 2.5.1
85
104
  signing_key:
86
105
  specification_version: 4
87
- summary: UpGuard Ruby SDK
106
+ summary: UpGuard Core SDK for Ruby
88
107
  test_files: []