petstroepack 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +86 -0
  4. data/lib/ctd_documentation/api_helper.rb +10 -0
  5. data/lib/ctd_documentation/client.rb +140 -0
  6. data/lib/ctd_documentation/configuration.rb +103 -0
  7. data/lib/ctd_documentation/controllers/activities_controller.rb +69 -0
  8. data/lib/ctd_documentation/controllers/alerts_controller.rb +170 -0
  9. data/lib/ctd_documentation/controllers/assets_controller.rb +409 -0
  10. data/lib/ctd_documentation/controllers/base_controller.rb +65 -0
  11. data/lib/ctd_documentation/controllers/custom_attributes_categories_controller.rb +50 -0
  12. data/lib/ctd_documentation/controllers/events_controller.rb +67 -0
  13. data/lib/ctd_documentation/controllers/groups_controller.rb +28 -0
  14. data/lib/ctd_documentation/controllers/insights_controller.rb +111 -0
  15. data/lib/ctd_documentation/controllers/license_controller.rb +73 -0
  16. data/lib/ctd_documentation/controllers/login_controller.rb +31 -0
  17. data/lib/ctd_documentation/controllers/queries_controller.rb +128 -0
  18. data/lib/ctd_documentation/controllers/sensors_controller.rb +26 -0
  19. data/lib/ctd_documentation/controllers/sites_controller.rb +39 -0
  20. data/lib/ctd_documentation/controllers/tasks_controller.rb +148 -0
  21. data/lib/ctd_documentation/controllers/tasks_queries_controller.rb +29 -0
  22. data/lib/ctd_documentation/controllers/users_controller.rb +28 -0
  23. data/lib/ctd_documentation/exceptions/api_exception.rb +10 -0
  24. data/lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb +48 -0
  25. data/lib/ctd_documentation/http/auth/custom_header_auth.rb +25 -0
  26. data/lib/ctd_documentation/http/http_call_back.rb +10 -0
  27. data/lib/ctd_documentation/http/http_method_enum.rb +10 -0
  28. data/lib/ctd_documentation/http/http_request.rb +10 -0
  29. data/lib/ctd_documentation/http/http_response.rb +10 -0
  30. data/lib/ctd_documentation/models/actionable.rb +70 -0
  31. data/lib/ctd_documentation/models/actionable_asset.rb +80 -0
  32. data/lib/ctd_documentation/models/actionable_cap.rb +80 -0
  33. data/lib/ctd_documentation/models/actionable_information.rb +80 -0
  34. data/lib/ctd_documentation/models/actionable_policy.rb +361 -0
  35. data/lib/ctd_documentation/models/actionable_related_asset.rb +142 -0
  36. data/lib/ctd_documentation/models/active_history.rb +311 -0
  37. data/lib/ctd_documentation/models/activities_object.rb +150 -0
  38. data/lib/ctd_documentation/models/activities_response.rb +100 -0
  39. data/lib/ctd_documentation/models/activity.rb +150 -0
  40. data/lib/ctd_documentation/models/add_license_response.rb +79 -0
  41. data/lib/ctd_documentation/models/alert.rb +455 -0
  42. data/lib/ctd_documentation/models/alert_severity_enum.rb +23 -0
  43. data/lib/ctd_documentation/models/asset.rb +527 -0
  44. data/lib/ctd_documentation/models/assets_with_insights.rb +252 -0
  45. data/lib/ctd_documentation/models/assets_with_insights_response.rb +90 -0
  46. data/lib/ctd_documentation/models/authenticate.rb +57 -0
  47. data/lib/ctd_documentation/models/base_model.rb +58 -0
  48. data/lib/ctd_documentation/models/base_task.rb +198 -0
  49. data/lib/ctd_documentation/models/cap.rb +90 -0
  50. data/lib/ctd_documentation/models/code_sections.rb +70 -0
  51. data/lib/ctd_documentation/models/content_type_enum.rb +14 -0
  52. data/lib/ctd_documentation/models/create_a_new_query.rb +57 -0
  53. data/lib/ctd_documentation/models/create_a_new_query_response.rb +57 -0
  54. data/lib/ctd_documentation/models/create_group_response.rb +48 -0
  55. data/lib/ctd_documentation/models/create_user_response.rb +48 -0
  56. data/lib/ctd_documentation/models/createanewtask.rb +57 -0
  57. data/lib/ctd_documentation/models/createanewtask_response.rb +57 -0
  58. data/lib/ctd_documentation/models/ctd_login_exception.rb +81 -0
  59. data/lib/ctd_documentation/models/ctd_login_response.rb +101 -0
  60. data/lib/ctd_documentation/models/custom_attribute_category.rb +90 -0
  61. data/lib/ctd_documentation/models/db_statistics.rb +50 -0
  62. data/lib/ctd_documentation/models/delete_a_query_response.rb +48 -0
  63. data/lib/ctd_documentation/models/delete_a_task_response.rb +48 -0
  64. data/lib/ctd_documentation/models/destination_virtual_zone.rb +60 -0
  65. data/lib/ctd_documentation/models/detail.rb +60 -0
  66. data/lib/ctd_documentation/models/discovery_params.rb +82 -0
  67. data/lib/ctd_documentation/models/entity.rb +70 -0
  68. data/lib/ctd_documentation/models/event.rb +175 -0
  69. data/lib/ctd_documentation/models/find_asset_by_id_response.rb +547 -0
  70. data/lib/ctd_documentation/models/format1_enum.rb +22 -0
  71. data/lib/ctd_documentation/models/format_enum.rb +20 -0
  72. data/lib/ctd_documentation/models/get_active_detection_history_response.rb +90 -0
  73. data/lib/ctd_documentation/models/get_alerts_response.rb +90 -0
  74. data/lib/ctd_documentation/models/get_all_sites_response.rb +90 -0
  75. data/lib/ctd_documentation/models/get_assets_response.rb +90 -0
  76. data/lib/ctd_documentation/models/get_custom_attribute_categories_response.rb +90 -0
  77. data/lib/ctd_documentation/models/get_events_response.rb +90 -0
  78. data/lib/ctd_documentation/models/get_license_details_response.rb +81 -0
  79. data/lib/ctd_documentation/models/get_queries_ids_and_assigned_task_response.rb +70 -0
  80. data/lib/ctd_documentation/models/get_queries_response.rb +90 -0
  81. data/lib/ctd_documentation/models/get_tasks_response.rb +90 -0
  82. data/lib/ctd_documentation/models/get_types_response.rb +57 -0
  83. data/lib/ctd_documentation/models/group.rb +73 -0
  84. data/lib/ctd_documentation/models/identifiable.rb +70 -0
  85. data/lib/ctd_documentation/models/indicator_info.rb +90 -0
  86. data/lib/ctd_documentation/models/indicators.rb +122 -0
  87. data/lib/ctd_documentation/models/information.rb +183 -0
  88. data/lib/ctd_documentation/models/insight_status_enum.rb +20 -0
  89. data/lib/ctd_documentation/models/insight_status_exact1_enum.rb +21 -0
  90. data/lib/ctd_documentation/models/insight_status_exact_enum.rb +20 -0
  91. data/lib/ctd_documentation/models/license_request.rb +48 -0
  92. data/lib/ctd_documentation/models/network.rb +80 -0
  93. data/lib/ctd_documentation/models/new_queryobject.rb +199 -0
  94. data/lib/ctd_documentation/models/new_taskobject.rb +199 -0
  95. data/lib/ctd_documentation/models/object.rb +70 -0
  96. data/lib/ctd_documentation/models/paginated_response.rb +71 -0
  97. data/lib/ctd_documentation/models/policy.rb +331 -0
  98. data/lib/ctd_documentation/models/queryextraparams.rb +60 -0
  99. data/lib/ctd_documentation/models/ranger_system_check_response.rb +57 -0
  100. data/lib/ctd_documentation/models/risk_vector.rb +89 -0
  101. data/lib/ctd_documentation/models/selection_params.rb +58 -0
  102. data/lib/ctd_documentation/models/selection_params1.rb +80 -0
  103. data/lib/ctd_documentation/models/site.rb +256 -0
  104. data/lib/ctd_documentation/models/site_list_slim_enum.rb +14 -0
  105. data/lib/ctd_documentation/models/slim_insight.rb +139 -0
  106. data/lib/ctd_documentation/models/sort1_enum.rb +65 -0
  107. data/lib/ctd_documentation/models/sort31_enum.rb +59 -0
  108. data/lib/ctd_documentation/models/sort3_enum.rb +59 -0
  109. data/lib/ctd_documentation/models/sort41_enum.rb +41 -0
  110. data/lib/ctd_documentation/models/sort4_enum.rb +41 -0
  111. data/lib/ctd_documentation/models/sort5_enum.rb +35 -0
  112. data/lib/ctd_documentation/models/sort6_enum.rb +41 -0
  113. data/lib/ctd_documentation/models/sort_enum.rb +125 -0
  114. data/lib/ctd_documentation/models/source_virtual_zone.rb +60 -0
  115. data/lib/ctd_documentation/models/special_hint_enum.rb +26 -0
  116. data/lib/ctd_documentation/models/special_hint_exact_enum.rb +26 -0
  117. data/lib/ctd_documentation/models/status_enum.rb +17 -0
  118. data/lib/ctd_documentation/models/status_exact_enum.rb +23 -0
  119. data/lib/ctd_documentation/models/subnet.rb +50 -0
  120. data/lib/ctd_documentation/models/task.rb +281 -0
  121. data/lib/ctd_documentation/models/taskextraparams.rb +71 -0
  122. data/lib/ctd_documentation/models/update_a_single_query_response.rb +57 -0
  123. data/lib/ctd_documentation/models/update_a_single_task_response.rb +57 -0
  124. data/lib/ctd_documentation/models/update_license_response.rb +79 -0
  125. data/lib/ctd_documentation/models/user.rb +88 -0
  126. data/lib/ctd_documentation/models/virtual_zones.rb +118 -0
  127. data/lib/ctd_documentation/utilities/date_time_helper.rb +11 -0
  128. data/lib/ctd_documentation/utilities/file_wrapper.rb +16 -0
  129. data/lib/ctd_documentation.rb +155 -0
  130. data/test/controllers/controller_test_base.rb +29 -0
  131. data/test/controllers/test_activities_controller.rb +64 -0
  132. data/test/controllers/test_alerts_controller.rb +16 -0
  133. data/test/controllers/test_assets_controller.rb +79 -0
  134. data/test/controllers/test_custom_attributes_categories_controller.rb +52 -0
  135. data/test/controllers/test_events_controller.rb +55 -0
  136. data/test/controllers/test_login_controller.rb +45 -0
  137. data/test/controllers/test_queries_controller.rb +292 -0
  138. data/test/controllers/test_sites_controller.rb +53 -0
  139. data/test/controllers/test_tasks_controller.rb +250 -0
  140. data/test/http_response_catcher.rb +19 -0
  141. metadata +259 -0
@@ -0,0 +1,252 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # AssetsWithInsights Model.
8
+ class AssetsWithInsights < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :resource_id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :id
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Integer]
22
+ attr_accessor :site_id
23
+
24
+ # The number represents the Asset type
25
+ # @return [Integer]
26
+ attr_accessor :asset_type
27
+
28
+ # The label of the Asset type
29
+ # @return [String]
30
+ attr_accessor :asset_type___name
31
+
32
+ # The number represent the Asset criticality
33
+ # @return [Integer]
34
+ attr_accessor :criticality
35
+
36
+ # The label of the Asset criticality
37
+ # @return [String]
38
+ attr_accessor :criticality___name
39
+
40
+ # The Asset firmware
41
+ # @return [String]
42
+ attr_accessor :firmware
43
+
44
+ # Asset who has only incoming communications, i.e. asset that never replied
45
+ # @return [TrueClass|FalseClass]
46
+ attr_accessor :ghost
47
+
48
+ # Asset who has only incoming communications, i.e. asset that never replied
49
+ # @return [List of SlimInsight]
50
+ attr_accessor :insights
51
+
52
+ # The IPv4 addresses related to the Asset
53
+ # @return [List of String]
54
+ attr_accessor :i_pv4
55
+
56
+ # The IPv6 addresses related to the Asset
57
+ # @return [List of String]
58
+ attr_accessor :i_pv6
59
+
60
+ # The MAC addresses that related to the Asset
61
+ # @return [List of String]
62
+ attr_accessor :mac
63
+
64
+ # The Asset's model
65
+ # @return [String]
66
+ attr_accessor :model
67
+
68
+ # The Asset's name
69
+ # @return [String]
70
+ attr_accessor :name
71
+
72
+ # The Asset's network ID number
73
+ # @return [Integer]
74
+ attr_accessor :network_id
75
+
76
+ # The level of the Asset's vulnerability to attacks
77
+ # @return [Integer]
78
+ attr_accessor :risk_level
79
+
80
+ # The name of the Site that the Asset is related to
81
+ # @return [String]
82
+ attr_accessor :site_name
83
+
84
+ # The total CVEs number that are related to the Asset
85
+ # @return [Integer]
86
+ attr_accessor :total_cves_count
87
+
88
+ # the Asset's vendor
89
+ # @return [String]
90
+ attr_accessor :vendor
91
+
92
+ # A mapping from model property names to API property names.
93
+ def self.names
94
+ @_hash = {} if @_hash.nil?
95
+ @_hash['resource_id'] = 'resource_id'
96
+ @_hash['id'] = 'id'
97
+ @_hash['site_id'] = 'site_id'
98
+ @_hash['asset_type'] = 'asset_type'
99
+ @_hash['asset_type___name'] = 'asset_type__(name)'
100
+ @_hash['criticality'] = 'criticality'
101
+ @_hash['criticality___name'] = 'criticality__(name)'
102
+ @_hash['firmware'] = 'firmware'
103
+ @_hash['ghost'] = 'ghost'
104
+ @_hash['insights'] = 'insights'
105
+ @_hash['i_pv4'] = 'IPv4'
106
+ @_hash['i_pv6'] = 'IPv6'
107
+ @_hash['mac'] = 'mac'
108
+ @_hash['model'] = 'model'
109
+ @_hash['name'] = 'name'
110
+ @_hash['network_id'] = 'network_id'
111
+ @_hash['risk_level'] = 'risk_level'
112
+ @_hash['site_name'] = 'site_name'
113
+ @_hash['total_cves_count'] = 'total_cves_count'
114
+ @_hash['vendor'] = 'vendor'
115
+ @_hash
116
+ end
117
+
118
+ # An array for optional fields
119
+ def self.optionals
120
+ %w[
121
+ resource_id
122
+ id
123
+ site_id
124
+ asset_type
125
+ asset_type___name
126
+ criticality
127
+ criticality___name
128
+ firmware
129
+ ghost
130
+ insights
131
+ i_pv4
132
+ i_pv6
133
+ mac
134
+ model
135
+ name
136
+ network_id
137
+ risk_level
138
+ site_name
139
+ total_cves_count
140
+ vendor
141
+ ]
142
+ end
143
+
144
+ # An array for nullable fields
145
+ def self.nullables
146
+ []
147
+ end
148
+
149
+ def initialize(resource_id = SKIP,
150
+ id = SKIP,
151
+ site_id = SKIP,
152
+ asset_type = SKIP,
153
+ asset_type___name = SKIP,
154
+ criticality = SKIP,
155
+ criticality___name = SKIP,
156
+ firmware = SKIP,
157
+ ghost = SKIP,
158
+ insights = SKIP,
159
+ i_pv4 = SKIP,
160
+ i_pv6 = SKIP,
161
+ mac = SKIP,
162
+ model = SKIP,
163
+ name = SKIP,
164
+ network_id = SKIP,
165
+ risk_level = SKIP,
166
+ site_name = SKIP,
167
+ total_cves_count = SKIP,
168
+ vendor = SKIP)
169
+ @resource_id = resource_id unless resource_id == SKIP
170
+ @id = id unless id == SKIP
171
+ @site_id = site_id unless site_id == SKIP
172
+ @asset_type = asset_type unless asset_type == SKIP
173
+ @asset_type___name = asset_type___name unless asset_type___name == SKIP
174
+ @criticality = criticality unless criticality == SKIP
175
+ @criticality___name = criticality___name unless criticality___name == SKIP
176
+ @firmware = firmware unless firmware == SKIP
177
+ @ghost = ghost unless ghost == SKIP
178
+ @insights = insights unless insights == SKIP
179
+ @i_pv4 = i_pv4 unless i_pv4 == SKIP
180
+ @i_pv6 = i_pv6 unless i_pv6 == SKIP
181
+ @mac = mac unless mac == SKIP
182
+ @model = model unless model == SKIP
183
+ @name = name unless name == SKIP
184
+ @network_id = network_id unless network_id == SKIP
185
+ @risk_level = risk_level unless risk_level == SKIP
186
+ @site_name = site_name unless site_name == SKIP
187
+ @total_cves_count = total_cves_count unless total_cves_count == SKIP
188
+ @vendor = vendor unless vendor == SKIP
189
+ end
190
+
191
+ # Creates an instance of the object from a hash.
192
+ def self.from_hash(hash)
193
+ return nil unless hash
194
+
195
+ # Extract variables from the hash.
196
+ resource_id = hash.key?('resource_id') ? hash['resource_id'] : SKIP
197
+ id = hash.key?('id') ? hash['id'] : SKIP
198
+ site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
199
+ asset_type = hash.key?('asset_type') ? hash['asset_type'] : SKIP
200
+ asset_type___name =
201
+ hash.key?('asset_type__(name)') ? hash['asset_type__(name)'] : SKIP
202
+ criticality = hash.key?('criticality') ? hash['criticality'] : SKIP
203
+ criticality___name =
204
+ hash.key?('criticality__(name)') ? hash['criticality__(name)'] : SKIP
205
+ firmware = hash.key?('firmware') ? hash['firmware'] : SKIP
206
+ ghost = hash.key?('ghost') ? hash['ghost'] : SKIP
207
+ # Parameter is an array, so we need to iterate through it
208
+ insights = nil
209
+ unless hash['insights'].nil?
210
+ insights = []
211
+ hash['insights'].each do |structure|
212
+ insights << (SlimInsight.from_hash(structure) if structure)
213
+ end
214
+ end
215
+
216
+ insights = SKIP unless hash.key?('insights')
217
+ i_pv4 = hash.key?('IPv4') ? hash['IPv4'] : SKIP
218
+ i_pv6 = hash.key?('IPv6') ? hash['IPv6'] : SKIP
219
+ mac = hash.key?('mac') ? hash['mac'] : SKIP
220
+ model = hash.key?('model') ? hash['model'] : SKIP
221
+ name = hash.key?('name') ? hash['name'] : SKIP
222
+ network_id = hash.key?('network_id') ? hash['network_id'] : SKIP
223
+ risk_level = hash.key?('risk_level') ? hash['risk_level'] : SKIP
224
+ site_name = hash.key?('site_name') ? hash['site_name'] : SKIP
225
+ total_cves_count =
226
+ hash.key?('total_cves_count') ? hash['total_cves_count'] : SKIP
227
+ vendor = hash.key?('vendor') ? hash['vendor'] : SKIP
228
+
229
+ # Create object from extracted values.
230
+ AssetsWithInsights.new(resource_id,
231
+ id,
232
+ site_id,
233
+ asset_type,
234
+ asset_type___name,
235
+ criticality,
236
+ criticality___name,
237
+ firmware,
238
+ ghost,
239
+ insights,
240
+ i_pv4,
241
+ i_pv6,
242
+ mac,
243
+ model,
244
+ name,
245
+ network_id,
246
+ risk_level,
247
+ site_name,
248
+ total_cves_count,
249
+ vendor)
250
+ end
251
+ end
252
+ end
@@ -0,0 +1,90 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # AssetsWithInsightsResponse Model.
8
+ class AssetsWithInsightsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :count_filtered
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :count_in_page
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Integer]
22
+ attr_accessor :count_total
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [List of AssetsWithInsights]
26
+ attr_accessor :objects
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['count_filtered'] = 'count_filtered'
32
+ @_hash['count_in_page'] = 'count_in_page'
33
+ @_hash['count_total'] = 'count_total'
34
+ @_hash['objects'] = 'objects'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ count_filtered
42
+ count_in_page
43
+ count_total
44
+ objects
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(count_filtered = SKIP,
54
+ count_in_page = SKIP,
55
+ count_total = SKIP,
56
+ objects = SKIP)
57
+ @count_filtered = count_filtered unless count_filtered == SKIP
58
+ @count_in_page = count_in_page unless count_in_page == SKIP
59
+ @count_total = count_total unless count_total == SKIP
60
+ @objects = objects unless objects == SKIP
61
+ end
62
+
63
+ # Creates an instance of the object from a hash.
64
+ def self.from_hash(hash)
65
+ return nil unless hash
66
+
67
+ # Extract variables from the hash.
68
+ count_filtered =
69
+ hash.key?('count_filtered') ? hash['count_filtered'] : SKIP
70
+ count_in_page = hash.key?('count_in_page') ? hash['count_in_page'] : SKIP
71
+ count_total = hash.key?('count_total') ? hash['count_total'] : SKIP
72
+ # Parameter is an array, so we need to iterate through it
73
+ objects = nil
74
+ unless hash['objects'].nil?
75
+ objects = []
76
+ hash['objects'].each do |structure|
77
+ objects << (AssetsWithInsights.from_hash(structure) if structure)
78
+ end
79
+ end
80
+
81
+ objects = SKIP unless hash.key?('objects')
82
+
83
+ # Create object from extracted values.
84
+ AssetsWithInsightsResponse.new(count_filtered,
85
+ count_in_page,
86
+ count_total,
87
+ objects)
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,57 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # Authenticate Model.
8
+ class Authenticate < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :username
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :password
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['username'] = 'username'
24
+ @_hash['password'] = 'password'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(username = nil,
39
+ password = nil)
40
+ @username = username
41
+ @password = password
42
+ end
43
+
44
+ # Creates an instance of the object from a hash.
45
+ def self.from_hash(hash)
46
+ return nil unless hash
47
+
48
+ # Extract variables from the hash.
49
+ username = hash.key?('username') ? hash['username'] : nil
50
+ password = hash.key?('password') ? hash['password'] : nil
51
+
52
+ # Create object from extracted values.
53
+ Authenticate.new(username,
54
+ password)
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,58 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # Base model.
8
+ class BaseModel < CoreLibrary::BaseModel
9
+ # Returns a Hash representation of the current object.
10
+ def to_hash
11
+ hash = {}
12
+ instance_variables.each do |name|
13
+ value = instance_variable_get(name)
14
+ name = name[1..]
15
+ key = self.class.names.key?(name) ? self.class.names[name] : name
16
+
17
+ optional_fields = self.class.optionals
18
+ nullable_fields = self.class.nullables
19
+ if value.nil?
20
+ next unless nullable_fields.include?(name)
21
+
22
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
23
+ raise ArgumentError,
24
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
25
+ end
26
+ end
27
+
28
+ hash[key] = nil
29
+ unless value.nil?
30
+ if respond_to?("to_#{name}")
31
+ if (value.instance_of? Array) || (value.instance_of? Hash)
32
+ params = [hash, key]
33
+ hash[key] = send("to_#{name}", *params)
34
+ else
35
+ hash[key] = send("to_#{name}")
36
+ end
37
+ elsif value.instance_of? Array
38
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
39
+ elsif value.instance_of? Hash
40
+ hash[key] = {}
41
+ value.each do |k, v|
42
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
43
+ end
44
+ else
45
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
46
+ end
47
+ end
48
+ end
49
+ hash
50
+ end
51
+
52
+ # Returns a JSON representation of the curent object.
53
+ def to_json(options = {})
54
+ hash = to_hash
55
+ hash.to_json(options)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,198 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # BaseTask Model.
8
+ class BaseTask < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A string that represents specific days in a week, Sunday being 0 and
13
+ # Friday being 6. To select more than a specific day just concatenate the
14
+ # day number to the string
15
+ # @return [String]
16
+ attr_accessor :allowed_days
17
+
18
+ # A string that represents specific days in a week, Sunday being 0 and
19
+ # Friday being 6. To select more than a specific day just concatenate the
20
+ # day number to the string
21
+ # @return [String]
22
+ attr_accessor :allowed_run_time_end
23
+
24
+ # A string that represents specific days in a week, Sunday being 0 and
25
+ # Friday being 6. To select more than a specific day just concatenate the
26
+ # day number to the string
27
+ # @return [String]
28
+ attr_accessor :allowed_run_time_start
29
+
30
+ # A string that represents specific days in a week, Sunday being 0 and
31
+ # Friday being 6. To select more than a specific day just concatenate the
32
+ # day number to the string
33
+ # @return [Integer]
34
+ attr_accessor :type
35
+
36
+ # A string that represents specific days in a week, Sunday being 0 and
37
+ # Friday being 6. To select more than a specific day just concatenate the
38
+ # day number to the string
39
+ # @return [String]
40
+ attr_accessor :end_time
41
+
42
+ # A string that represents specific days in a week, Sunday being 0 and
43
+ # Friday being 6. To select more than a specific day just concatenate the
44
+ # day number to the string
45
+ # @return [String]
46
+ attr_accessor :interval
47
+
48
+ # A string that represents specific days in a week, Sunday being 0 and
49
+ # Friday being 6. To select more than a specific day just concatenate the
50
+ # day number to the string
51
+ # @return [TrueClass|FalseClass]
52
+ attr_accessor :is_recurring
53
+
54
+ # A string that represents specific days in a week, Sunday being 0 and
55
+ # Friday being 6. To select more than a specific day just concatenate the
56
+ # day number to the string
57
+ # @return [String]
58
+ attr_accessor :name
59
+
60
+ # A string that represents specific days in a week, Sunday being 0 and
61
+ # Friday being 6. To select more than a specific day just concatenate the
62
+ # day number to the string
63
+ # @return [String]
64
+ attr_accessor :resource_id
65
+
66
+ # A string that represents specific days in a week, Sunday being 0 and
67
+ # Friday being 6. To select more than a specific day just concatenate the
68
+ # day number to the string
69
+ # @return [Float]
70
+ attr_accessor :site_id
71
+
72
+ # A string that represents specific days in a week, Sunday being 0 and
73
+ # Friday being 6. To select more than a specific day just concatenate the
74
+ # day number to the string
75
+ # @return [String]
76
+ attr_accessor :status
77
+
78
+ # A string that represents specific days in a week, Sunday being 0 and
79
+ # Friday being 6. To select more than a specific day just concatenate the
80
+ # day number to the string
81
+ # @return [TrueClass|FalseClass]
82
+ attr_accessor :valid
83
+
84
+ # A string that represents specific days in a week, Sunday being 0 and
85
+ # Friday being 6. To select more than a specific day just concatenate the
86
+ # day number to the string
87
+ # @return [String]
88
+ attr_accessor :start_time
89
+
90
+ # A mapping from model property names to API property names.
91
+ def self.names
92
+ @_hash = {} if @_hash.nil?
93
+ @_hash['allowed_days'] = 'allowed_days'
94
+ @_hash['allowed_run_time_end'] = 'allowed_run_time_end'
95
+ @_hash['allowed_run_time_start'] = 'allowed_run_time_start'
96
+ @_hash['type'] = 'type'
97
+ @_hash['end_time'] = 'end_time'
98
+ @_hash['interval'] = 'interval'
99
+ @_hash['is_recurring'] = 'is_recurring'
100
+ @_hash['name'] = 'name'
101
+ @_hash['resource_id'] = 'resource_id'
102
+ @_hash['site_id'] = 'site_id'
103
+ @_hash['status'] = 'status'
104
+ @_hash['valid'] = 'valid'
105
+ @_hash['start_time'] = 'start_time'
106
+ @_hash
107
+ end
108
+
109
+ # An array for optional fields
110
+ def self.optionals
111
+ %w[
112
+ allowed_days
113
+ allowed_run_time_end
114
+ allowed_run_time_start
115
+ type
116
+ end_time
117
+ interval
118
+ is_recurring
119
+ name
120
+ resource_id
121
+ site_id
122
+ status
123
+ valid
124
+ start_time
125
+ ]
126
+ end
127
+
128
+ # An array for nullable fields
129
+ def self.nullables
130
+ []
131
+ end
132
+
133
+ def initialize(allowed_days = SKIP,
134
+ allowed_run_time_end = SKIP,
135
+ allowed_run_time_start = SKIP,
136
+ type = SKIP,
137
+ end_time = SKIP,
138
+ interval = SKIP,
139
+ is_recurring = SKIP,
140
+ name = SKIP,
141
+ resource_id = SKIP,
142
+ site_id = SKIP,
143
+ status = SKIP,
144
+ valid = SKIP,
145
+ start_time = SKIP)
146
+ @allowed_days = allowed_days unless allowed_days == SKIP
147
+ @allowed_run_time_end = allowed_run_time_end unless allowed_run_time_end == SKIP
148
+ @allowed_run_time_start = allowed_run_time_start unless allowed_run_time_start == SKIP
149
+ @type = type unless type == SKIP
150
+ @end_time = end_time unless end_time == SKIP
151
+ @interval = interval unless interval == SKIP
152
+ @is_recurring = is_recurring unless is_recurring == SKIP
153
+ @name = name unless name == SKIP
154
+ @resource_id = resource_id unless resource_id == SKIP
155
+ @site_id = site_id unless site_id == SKIP
156
+ @status = status unless status == SKIP
157
+ @valid = valid unless valid == SKIP
158
+ @start_time = start_time unless start_time == SKIP
159
+ end
160
+
161
+ # Creates an instance of the object from a hash.
162
+ def self.from_hash(hash)
163
+ return nil unless hash
164
+
165
+ # Extract variables from the hash.
166
+ allowed_days = hash.key?('allowed_days') ? hash['allowed_days'] : SKIP
167
+ allowed_run_time_end =
168
+ hash.key?('allowed_run_time_end') ? hash['allowed_run_time_end'] : SKIP
169
+ allowed_run_time_start =
170
+ hash.key?('allowed_run_time_start') ? hash['allowed_run_time_start'] : SKIP
171
+ type = hash.key?('type') ? hash['type'] : SKIP
172
+ end_time = hash.key?('end_time') ? hash['end_time'] : SKIP
173
+ interval = hash.key?('interval') ? hash['interval'] : SKIP
174
+ is_recurring = hash.key?('is_recurring') ? hash['is_recurring'] : SKIP
175
+ name = hash.key?('name') ? hash['name'] : SKIP
176
+ resource_id = hash.key?('resource_id') ? hash['resource_id'] : SKIP
177
+ site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
178
+ status = hash.key?('status') ? hash['status'] : SKIP
179
+ valid = hash.key?('valid') ? hash['valid'] : SKIP
180
+ start_time = hash.key?('start_time') ? hash['start_time'] : SKIP
181
+
182
+ # Create object from extracted values.
183
+ BaseTask.new(allowed_days,
184
+ allowed_run_time_end,
185
+ allowed_run_time_start,
186
+ type,
187
+ end_time,
188
+ interval,
189
+ is_recurring,
190
+ name,
191
+ resource_id,
192
+ site_id,
193
+ status,
194
+ valid,
195
+ start_time)
196
+ end
197
+ end
198
+ end