agent_push_kit 0.1.0

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 (199) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +145 -0
  4. data/LICENSE +21 -0
  5. data/README.md +195 -0
  6. data/Rakefile +10 -0
  7. data/agent_push_kit.gemspec +39 -0
  8. data/docs/AcceptedResponse.md +18 -0
  9. data/docs/AccountApi.md +137 -0
  10. data/docs/AddMemberInput.md +18 -0
  11. data/docs/AgentToken.md +30 -0
  12. data/docs/AgentTokenCreated.md +32 -0
  13. data/docs/AgentTokensApi.md +279 -0
  14. data/docs/ApiKeySummary.md +22 -0
  15. data/docs/AuthResponse.md +24 -0
  16. data/docs/AuthenticationApi.md +385 -0
  17. data/docs/CreateAgentTokenInput.md +18 -0
  18. data/docs/CreateOrganizationInput.md +18 -0
  19. data/docs/CurrentAccount.md +20 -0
  20. data/docs/CustomerAccountsApi.md +348 -0
  21. data/docs/DeletedResponse.md +18 -0
  22. data/docs/DeliverySummary.md +24 -0
  23. data/docs/Device.md +28 -0
  24. data/docs/DevicesApi.md +344 -0
  25. data/docs/DisabledResponse.md +18 -0
  26. data/docs/ErrorResponse.md +22 -0
  27. data/docs/EventDetail.md +36 -0
  28. data/docs/EventFilter.md +53 -0
  29. data/docs/EventPage.md +20 -0
  30. data/docs/EventSummary.md +32 -0
  31. data/docs/EventsApi.md +505 -0
  32. data/docs/FilterGroup.md +20 -0
  33. data/docs/FilterNot.md +20 -0
  34. data/docs/HealthApi.md +67 -0
  35. data/docs/HealthResponse.md +20 -0
  36. data/docs/IngestionResult.md +22 -0
  37. data/docs/InheritedResponse.md +18 -0
  38. data/docs/Membership.md +24 -0
  39. data/docs/MembershipUser.md +22 -0
  40. data/docs/Organization.md +32 -0
  41. data/docs/OrganizationApiKeyCreated.md +24 -0
  42. data/docs/OrganizationCount.md +20 -0
  43. data/docs/OrganizationCreated.md +20 -0
  44. data/docs/OrganizationRecord.md +24 -0
  45. data/docs/PasswordLoginInput.md +20 -0
  46. data/docs/PasswordResetCompleteInput.md +20 -0
  47. data/docs/PasswordResetRequestInput.md +18 -0
  48. data/docs/PreferenceRecord.md +24 -0
  49. data/docs/PreferencesApi.md +287 -0
  50. data/docs/ProviderLoginInput.md +20 -0
  51. data/docs/RegisterDeviceInput.md +24 -0
  52. data/docs/RegisterInput.md +22 -0
  53. data/docs/RegisterWebPushSubscriptionInput.md +20 -0
  54. data/docs/RegisterWebPushSubscriptionInputKeys.md +20 -0
  55. data/docs/RevokedResponse.md +18 -0
  56. data/docs/SearchEventsInput.md +22 -0
  57. data/docs/SendEventInput.md +32 -0
  58. data/docs/Service.md +26 -0
  59. data/docs/ServiceAllOfCount.md +18 -0
  60. data/docs/ServicePreference.md +26 -0
  61. data/docs/ServiceSummary.md +22 -0
  62. data/docs/SetEnabledInput.md +18 -0
  63. data/docs/TextFilterCondition.md +22 -0
  64. data/docs/TimeFilterCondition.md +22 -0
  65. data/docs/TypeOverride.md +22 -0
  66. data/docs/User.md +28 -0
  67. data/docs/WebPushConfiguration.md +20 -0
  68. data/docs/WebPushSubscription.md +22 -0
  69. data/git_push.sh +57 -0
  70. data/lib/agent_push_kit/api/account_api.rb +132 -0
  71. data/lib/agent_push_kit/api/agent_tokens_api.rb +274 -0
  72. data/lib/agent_push_kit/api/authentication_api.rb +418 -0
  73. data/lib/agent_push_kit/api/customer_accounts_api.rb +339 -0
  74. data/lib/agent_push_kit/api/devices_api.rb +339 -0
  75. data/lib/agent_push_kit/api/events_api.rb +520 -0
  76. data/lib/agent_push_kit/api/health_api.rb +77 -0
  77. data/lib/agent_push_kit/api/preferences_api.rb +308 -0
  78. data/lib/agent_push_kit/api_client.rb +397 -0
  79. data/lib/agent_push_kit/api_error.rb +58 -0
  80. data/lib/agent_push_kit/api_model_base.rb +88 -0
  81. data/lib/agent_push_kit/configuration.rb +325 -0
  82. data/lib/agent_push_kit/models/accepted_response.rb +164 -0
  83. data/lib/agent_push_kit/models/add_member_input.rb +173 -0
  84. data/lib/agent_push_kit/models/agent_token.rb +292 -0
  85. data/lib/agent_push_kit/models/agent_token_created.rb +364 -0
  86. data/lib/agent_push_kit/models/api_key_summary.rb +165 -0
  87. data/lib/agent_push_kit/models/auth_response.rb +228 -0
  88. data/lib/agent_push_kit/models/create_agent_token_input.rb +182 -0
  89. data/lib/agent_push_kit/models/create_organization_input.rb +182 -0
  90. data/lib/agent_push_kit/models/current_account.rb +192 -0
  91. data/lib/agent_push_kit/models/deleted_response.rb +164 -0
  92. data/lib/agent_push_kit/models/delivery_summary.rb +242 -0
  93. data/lib/agent_push_kit/models/device.rb +304 -0
  94. data/lib/agent_push_kit/models/disabled_response.rb +164 -0
  95. data/lib/agent_push_kit/models/error_response.rb +199 -0
  96. data/lib/agent_push_kit/models/event_detail.rb +393 -0
  97. data/lib/agent_push_kit/models/event_filter.rb +106 -0
  98. data/lib/agent_push_kit/models/event_page.rb +178 -0
  99. data/lib/agent_push_kit/models/event_summary.rb +318 -0
  100. data/lib/agent_push_kit/models/filter_group.rb +234 -0
  101. data/lib/agent_push_kit/models/filter_not.rb +214 -0
  102. data/lib/agent_push_kit/models/health_response.rb +216 -0
  103. data/lib/agent_push_kit/models/ingestion_result.rb +216 -0
  104. data/lib/agent_push_kit/models/inherited_response.rb +164 -0
  105. data/lib/agent_push_kit/models/membership.rb +266 -0
  106. data/lib/agent_push_kit/models/membership_user.rb +202 -0
  107. data/lib/agent_push_kit/models/organization.rb +337 -0
  108. data/lib/agent_push_kit/models/organization_api_key_created.rb +253 -0
  109. data/lib/agent_push_kit/models/organization_count.rb +156 -0
  110. data/lib/agent_push_kit/models/organization_created.rb +201 -0
  111. data/lib/agent_push_kit/models/organization_record.rb +242 -0
  112. data/lib/agent_push_kit/models/password_login_input.rb +217 -0
  113. data/lib/agent_push_kit/models/password_reset_complete_input.rb +217 -0
  114. data/lib/agent_push_kit/models/password_reset_request_input.rb +173 -0
  115. data/lib/agent_push_kit/models/preference_record.rb +242 -0
  116. data/lib/agent_push_kit/models/provider_login_input.rb +201 -0
  117. data/lib/agent_push_kit/models/register_device_input.rb +304 -0
  118. data/lib/agent_push_kit/models/register_input.rb +245 -0
  119. data/lib/agent_push_kit/models/register_web_push_subscription_input.rb +199 -0
  120. data/lib/agent_push_kit/models/register_web_push_subscription_input_keys.rb +226 -0
  121. data/lib/agent_push_kit/models/revoked_response.rb +164 -0
  122. data/lib/agent_push_kit/models/search_events_input.rb +212 -0
  123. data/lib/agent_push_kit/models/send_event_input.rb +427 -0
  124. data/lib/agent_push_kit/models/service.rb +275 -0
  125. data/lib/agent_push_kit/models/service_all_of_count.rb +164 -0
  126. data/lib/agent_push_kit/models/service_preference.rb +270 -0
  127. data/lib/agent_push_kit/models/service_summary.rb +216 -0
  128. data/lib/agent_push_kit/models/set_enabled_input.rb +164 -0
  129. data/lib/agent_push_kit/models/text_filter_condition.rb +260 -0
  130. data/lib/agent_push_kit/models/time_filter_condition.rb +242 -0
  131. data/lib/agent_push_kit/models/type_override.rb +216 -0
  132. data/lib/agent_push_kit/models/user.rb +280 -0
  133. data/lib/agent_push_kit/models/web_push_configuration.rb +176 -0
  134. data/lib/agent_push_kit/models/web_push_subscription.rb +216 -0
  135. data/lib/agent_push_kit/version.rb +15 -0
  136. data/lib/agent_push_kit.rb +101 -0
  137. data/spec/api/account_api_spec.rb +55 -0
  138. data/spec/api/agent_tokens_api_spec.rb +80 -0
  139. data/spec/api/authentication_api_spec.rb +101 -0
  140. data/spec/api/customer_accounts_api_spec.rb +91 -0
  141. data/spec/api/devices_api_spec.rb +89 -0
  142. data/spec/api/events_api_spec.rb +121 -0
  143. data/spec/api/health_api_spec.rb +45 -0
  144. data/spec/api/preferences_api_spec.rb +83 -0
  145. data/spec/models/accepted_response_spec.rb +36 -0
  146. data/spec/models/add_member_input_spec.rb +36 -0
  147. data/spec/models/agent_token_created_spec.rb +78 -0
  148. data/spec/models/agent_token_spec.rb +72 -0
  149. data/spec/models/api_key_summary_spec.rb +48 -0
  150. data/spec/models/auth_response_spec.rb +54 -0
  151. data/spec/models/create_agent_token_input_spec.rb +36 -0
  152. data/spec/models/create_organization_input_spec.rb +36 -0
  153. data/spec/models/current_account_spec.rb +42 -0
  154. data/spec/models/deleted_response_spec.rb +36 -0
  155. data/spec/models/delivery_summary_spec.rb +54 -0
  156. data/spec/models/device_spec.rb +70 -0
  157. data/spec/models/disabled_response_spec.rb +36 -0
  158. data/spec/models/error_response_spec.rb +48 -0
  159. data/spec/models/event_detail_spec.rb +90 -0
  160. data/spec/models/event_filter_spec.rb +32 -0
  161. data/spec/models/event_page_spec.rb +42 -0
  162. data/spec/models/event_summary_spec.rb +78 -0
  163. data/spec/models/filter_group_spec.rb +46 -0
  164. data/spec/models/filter_not_spec.rb +46 -0
  165. data/spec/models/health_response_spec.rb +50 -0
  166. data/spec/models/ingestion_result_spec.rb +48 -0
  167. data/spec/models/inherited_response_spec.rb +36 -0
  168. data/spec/models/membership_spec.rb +58 -0
  169. data/spec/models/membership_user_spec.rb +48 -0
  170. data/spec/models/organization_api_key_created_spec.rb +54 -0
  171. data/spec/models/organization_count_spec.rb +42 -0
  172. data/spec/models/organization_created_spec.rb +42 -0
  173. data/spec/models/organization_record_spec.rb +54 -0
  174. data/spec/models/organization_spec.rb +82 -0
  175. data/spec/models/password_login_input_spec.rb +42 -0
  176. data/spec/models/password_reset_complete_input_spec.rb +42 -0
  177. data/spec/models/password_reset_request_input_spec.rb +36 -0
  178. data/spec/models/preference_record_spec.rb +54 -0
  179. data/spec/models/provider_login_input_spec.rb +42 -0
  180. data/spec/models/register_device_input_spec.rb +58 -0
  181. data/spec/models/register_input_spec.rb +48 -0
  182. data/spec/models/register_web_push_subscription_input_keys_spec.rb +42 -0
  183. data/spec/models/register_web_push_subscription_input_spec.rb +42 -0
  184. data/spec/models/revoked_response_spec.rb +36 -0
  185. data/spec/models/search_events_input_spec.rb +48 -0
  186. data/spec/models/send_event_input_spec.rb +78 -0
  187. data/spec/models/service_all_of_count_spec.rb +36 -0
  188. data/spec/models/service_preference_spec.rb +60 -0
  189. data/spec/models/service_spec.rb +60 -0
  190. data/spec/models/service_summary_spec.rb +48 -0
  191. data/spec/models/set_enabled_input_spec.rb +36 -0
  192. data/spec/models/text_filter_condition_spec.rb +56 -0
  193. data/spec/models/time_filter_condition_spec.rb +56 -0
  194. data/spec/models/type_override_spec.rb +48 -0
  195. data/spec/models/user_spec.rb +66 -0
  196. data/spec/models/web_push_configuration_spec.rb +42 -0
  197. data/spec/models/web_push_subscription_spec.rb +48 -0
  198. data/spec/spec_helper.rb +111 -0
  199. metadata +344 -0
@@ -0,0 +1,199 @@
1
+ =begin
2
+ #Agent Push Kit API
3
+
4
+ #The complete Agent Push Kit REST API. Application event ingestion uses an organization key beginning with `apk_`. Authenticated user operations accept either an Agent Push Kit login JWT or an agent access token beginning with `apt_`.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AgentPushKit
17
+ class ErrorResponse < ApiModelBase
18
+ attr_accessor :status_code
19
+
20
+ attr_accessor :message
21
+
22
+ attr_accessor :error
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'status_code' => :'statusCode',
28
+ :'message' => :'message',
29
+ :'error' => :'error'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'status_code' => :'Integer',
47
+ :'message' => :'String',
48
+ :'error' => :'String'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AgentPushKit::ErrorResponse` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AgentPushKit::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'status_code')
75
+ self.status_code = attributes[:'status_code']
76
+ else
77
+ self.status_code = nil
78
+ end
79
+
80
+ if attributes.key?(:'message')
81
+ self.message = attributes[:'message']
82
+ else
83
+ self.message = nil
84
+ end
85
+
86
+ if attributes.key?(:'error')
87
+ self.error = attributes[:'error']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ if @status_code.nil?
97
+ invalid_properties.push('invalid value for "status_code", status_code cannot be nil.')
98
+ end
99
+
100
+ if @message.nil?
101
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
102
+ end
103
+
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ warn '[DEPRECATED] the `valid?` method is obsolete'
111
+ return false if @status_code.nil?
112
+ return false if @message.nil?
113
+ true
114
+ end
115
+
116
+ # Custom attribute writer method with validation
117
+ # @param [Object] status_code Value to be assigned
118
+ def status_code=(status_code)
119
+ if status_code.nil?
120
+ fail ArgumentError, 'status_code cannot be nil'
121
+ end
122
+
123
+ @status_code = status_code
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] message Value to be assigned
128
+ def message=(message)
129
+ if message.nil?
130
+ fail ArgumentError, 'message cannot be nil'
131
+ end
132
+
133
+ @message = message
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ status_code == o.status_code &&
142
+ message == o.message &&
143
+ error == o.error
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [status_code, message, error].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ attributes = attributes.transform_keys(&:to_sym)
164
+ transformed_hash = {}
165
+ openapi_types.each_pair do |key, type|
166
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = nil
168
+ elsif type =~ /\AArray<(.*)>/i
169
+ # check to ensure the input is an array given that the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[attribute_map[key]].is_a?(Array)
172
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
+ end
174
+ elsif !attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
176
+ end
177
+ end
178
+ new(transformed_hash)
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ end
198
+
199
+ end
@@ -0,0 +1,393 @@
1
+ =begin
2
+ #Agent Push Kit API
3
+
4
+ #The complete Agent Push Kit REST API. Application event ingestion uses an organization key beginning with `apk_`. Authenticated user operations accept either an Agent Push Kit login JWT or an agent access token beginning with `apt_`.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AgentPushKit
17
+ class EventDetail < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :type
21
+
22
+ attr_accessor :title
23
+
24
+ attr_accessor :body
25
+
26
+ attr_accessor :external_id
27
+
28
+ attr_accessor :action_url
29
+
30
+ attr_accessor :created_at
31
+
32
+ attr_accessor :service
33
+
34
+ attr_accessor :service_id
35
+
36
+ attr_accessor :metadata
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'id' => :'id',
42
+ :'type' => :'type',
43
+ :'title' => :'title',
44
+ :'body' => :'body',
45
+ :'external_id' => :'externalId',
46
+ :'action_url' => :'actionUrl',
47
+ :'created_at' => :'createdAt',
48
+ :'service' => :'service',
49
+ :'service_id' => :'serviceId',
50
+ :'metadata' => :'metadata'
51
+ }
52
+ end
53
+
54
+ # Returns attribute mapping this model knows about
55
+ def self.acceptable_attribute_map
56
+ attribute_map
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ acceptable_attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.openapi_types
66
+ {
67
+ :'id' => :'String',
68
+ :'type' => :'String',
69
+ :'title' => :'String',
70
+ :'body' => :'String',
71
+ :'external_id' => :'String',
72
+ :'action_url' => :'String',
73
+ :'created_at' => :'Time',
74
+ :'service' => :'ServiceSummary',
75
+ :'service_id' => :'String',
76
+ :'metadata' => :'Hash<String, Object>'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ :'metadata'
84
+ ])
85
+ end
86
+
87
+ # List of class defined in allOf (OpenAPI v3)
88
+ def self.openapi_all_of
89
+ [
90
+ :'EventSummary'
91
+ ]
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AgentPushKit::EventDetail` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AgentPushKit::EventDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'id')
111
+ self.id = attributes[:'id']
112
+ else
113
+ self.id = nil
114
+ end
115
+
116
+ if attributes.key?(:'type')
117
+ self.type = attributes[:'type']
118
+ else
119
+ self.type = nil
120
+ end
121
+
122
+ if attributes.key?(:'title')
123
+ self.title = attributes[:'title']
124
+ else
125
+ self.title = nil
126
+ end
127
+
128
+ if attributes.key?(:'body')
129
+ self.body = attributes[:'body']
130
+ else
131
+ self.body = nil
132
+ end
133
+
134
+ if attributes.key?(:'external_id')
135
+ self.external_id = attributes[:'external_id']
136
+ else
137
+ self.external_id = nil
138
+ end
139
+
140
+ if attributes.key?(:'action_url')
141
+ self.action_url = attributes[:'action_url']
142
+ else
143
+ self.action_url = nil
144
+ end
145
+
146
+ if attributes.key?(:'created_at')
147
+ self.created_at = attributes[:'created_at']
148
+ else
149
+ self.created_at = nil
150
+ end
151
+
152
+ if attributes.key?(:'service')
153
+ self.service = attributes[:'service']
154
+ else
155
+ self.service = nil
156
+ end
157
+
158
+ if attributes.key?(:'service_id')
159
+ self.service_id = attributes[:'service_id']
160
+ else
161
+ self.service_id = nil
162
+ end
163
+
164
+ if attributes.key?(:'metadata')
165
+ if (value = attributes[:'metadata']).is_a?(Hash)
166
+ self.metadata = value
167
+ end
168
+ else
169
+ self.metadata = nil
170
+ end
171
+ end
172
+
173
+ # Show invalid properties with the reasons. Usually used together with valid?
174
+ # @return Array for valid properties with the reasons
175
+ def list_invalid_properties
176
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
177
+ invalid_properties = Array.new
178
+ if @id.nil?
179
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
180
+ end
181
+
182
+ if @type.nil?
183
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
184
+ end
185
+
186
+ if @title.nil?
187
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
188
+ end
189
+
190
+ if @body.nil?
191
+ invalid_properties.push('invalid value for "body", body cannot be nil.')
192
+ end
193
+
194
+ if @external_id.nil?
195
+ invalid_properties.push('invalid value for "external_id", external_id cannot be nil.')
196
+ end
197
+
198
+ if @action_url.nil?
199
+ invalid_properties.push('invalid value for "action_url", action_url cannot be nil.')
200
+ end
201
+
202
+ if @created_at.nil?
203
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
204
+ end
205
+
206
+ if @service.nil?
207
+ invalid_properties.push('invalid value for "service", service cannot be nil.')
208
+ end
209
+
210
+ if @service_id.nil?
211
+ invalid_properties.push('invalid value for "service_id", service_id cannot be nil.')
212
+ end
213
+
214
+ invalid_properties
215
+ end
216
+
217
+ # Check to see if the all the properties in the model are valid
218
+ # @return true if the model is valid
219
+ def valid?
220
+ warn '[DEPRECATED] the `valid?` method is obsolete'
221
+ return false if @id.nil?
222
+ return false if @type.nil?
223
+ return false if @title.nil?
224
+ return false if @body.nil?
225
+ return false if @external_id.nil?
226
+ return false if @action_url.nil?
227
+ return false if @created_at.nil?
228
+ return false if @service.nil?
229
+ return false if @service_id.nil?
230
+ true
231
+ end
232
+
233
+ # Custom attribute writer method with validation
234
+ # @param [Object] id Value to be assigned
235
+ def id=(id)
236
+ if id.nil?
237
+ fail ArgumentError, 'id cannot be nil'
238
+ end
239
+
240
+ @id = id
241
+ end
242
+
243
+ # Custom attribute writer method with validation
244
+ # @param [Object] type Value to be assigned
245
+ def type=(type)
246
+ if type.nil?
247
+ fail ArgumentError, 'type cannot be nil'
248
+ end
249
+
250
+ @type = type
251
+ end
252
+
253
+ # Custom attribute writer method with validation
254
+ # @param [Object] title Value to be assigned
255
+ def title=(title)
256
+ if title.nil?
257
+ fail ArgumentError, 'title cannot be nil'
258
+ end
259
+
260
+ @title = title
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] body Value to be assigned
265
+ def body=(body)
266
+ if body.nil?
267
+ fail ArgumentError, 'body cannot be nil'
268
+ end
269
+
270
+ @body = body
271
+ end
272
+
273
+ # Custom attribute writer method with validation
274
+ # @param [Object] external_id Value to be assigned
275
+ def external_id=(external_id)
276
+ if external_id.nil?
277
+ fail ArgumentError, 'external_id cannot be nil'
278
+ end
279
+
280
+ @external_id = external_id
281
+ end
282
+
283
+ # Custom attribute writer method with validation
284
+ # @param [Object] action_url Value to be assigned
285
+ def action_url=(action_url)
286
+ if action_url.nil?
287
+ fail ArgumentError, 'action_url cannot be nil'
288
+ end
289
+
290
+ @action_url = action_url
291
+ end
292
+
293
+ # Custom attribute writer method with validation
294
+ # @param [Object] created_at Value to be assigned
295
+ def created_at=(created_at)
296
+ if created_at.nil?
297
+ fail ArgumentError, 'created_at cannot be nil'
298
+ end
299
+
300
+ @created_at = created_at
301
+ end
302
+
303
+ # Custom attribute writer method with validation
304
+ # @param [Object] service Value to be assigned
305
+ def service=(service)
306
+ if service.nil?
307
+ fail ArgumentError, 'service cannot be nil'
308
+ end
309
+
310
+ @service = service
311
+ end
312
+
313
+ # Custom attribute writer method with validation
314
+ # @param [Object] service_id Value to be assigned
315
+ def service_id=(service_id)
316
+ if service_id.nil?
317
+ fail ArgumentError, 'service_id cannot be nil'
318
+ end
319
+
320
+ @service_id = service_id
321
+ end
322
+
323
+ # Checks equality by comparing each attribute.
324
+ # @param [Object] Object to be compared
325
+ def ==(o)
326
+ return true if self.equal?(o)
327
+ self.class == o.class &&
328
+ id == o.id &&
329
+ type == o.type &&
330
+ title == o.title &&
331
+ body == o.body &&
332
+ external_id == o.external_id &&
333
+ action_url == o.action_url &&
334
+ created_at == o.created_at &&
335
+ service == o.service &&
336
+ service_id == o.service_id &&
337
+ metadata == o.metadata
338
+ end
339
+
340
+ # @see the `==` method
341
+ # @param [Object] Object to be compared
342
+ def eql?(o)
343
+ self == o
344
+ end
345
+
346
+ # Calculates hash code according to all attributes.
347
+ # @return [Integer] Hash code
348
+ def hash
349
+ [id, type, title, body, external_id, action_url, created_at, service, service_id, metadata].hash
350
+ end
351
+
352
+ # Builds the object from hash
353
+ # @param [Hash] attributes Model attributes in the form of hash
354
+ # @return [Object] Returns the model itself
355
+ def self.build_from_hash(attributes)
356
+ return nil unless attributes.is_a?(Hash)
357
+ attributes = attributes.transform_keys(&:to_sym)
358
+ transformed_hash = {}
359
+ openapi_types.each_pair do |key, type|
360
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
361
+ transformed_hash["#{key}"] = nil
362
+ elsif type =~ /\AArray<(.*)>/i
363
+ # check to ensure the input is an array given that the attribute
364
+ # is documented as an array but the input is not
365
+ if attributes[attribute_map[key]].is_a?(Array)
366
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
367
+ end
368
+ elsif !attributes[attribute_map[key]].nil?
369
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
370
+ end
371
+ end
372
+ new(transformed_hash)
373
+ end
374
+
375
+ # Returns the object in the form of hash
376
+ # @return [Hash] Returns the object in the form of hash
377
+ def to_hash
378
+ hash = {}
379
+ self.class.attribute_map.each_pair do |attr, param|
380
+ value = self.send(attr)
381
+ if value.nil?
382
+ is_nullable = self.class.openapi_nullable.include?(attr)
383
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
384
+ end
385
+
386
+ hash[param] = _to_hash(value)
387
+ end
388
+ hash
389
+ end
390
+
391
+ end
392
+
393
+ end
@@ -0,0 +1,106 @@
1
+ =begin
2
+ #Agent Push Kit API
3
+
4
+ #The complete Agent Push Kit REST API. Application event ingestion uses an organization key beginning with `apk_`. Authenticated user operations accept either an Agent Push Kit login JWT or an agent access token beginning with `apt_`.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AgentPushKit
17
+ module EventFilter
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'FilterGroup',
23
+ :'FilterNot',
24
+ :'TextFilterCondition',
25
+ :'TimeFilterCondition'
26
+ ]
27
+ end
28
+
29
+ # Builds the object
30
+ # @param [Mixed] Data to be matched against the list of oneOf items
31
+ # @return [Object] Returns the model or the data itself
32
+ def build(data)
33
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
34
+ # Note:
35
+ # - We do not attempt to check whether exactly one item matches.
36
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
37
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
38
+ # - TODO: scalar values are de facto behaving as if they were nullable.
39
+ # - TODO: logging when debugging is set.
40
+ openapi_one_of.each do |klass|
41
+ begin
42
+ next if klass == :AnyType # "nullable: true"
43
+ return find_and_cast_into_type(klass, data)
44
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
45
+ end
46
+ end
47
+
48
+ openapi_one_of.include?(:AnyType) ? data : nil
49
+ end
50
+
51
+ private
52
+
53
+ SchemaMismatchError = Class.new(StandardError)
54
+
55
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
56
+ def find_and_cast_into_type(klass, data)
57
+ return if data.nil?
58
+
59
+ case klass.to_s
60
+ when 'Boolean'
61
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
62
+ when 'Float'
63
+ return data if data.instance_of?(Float)
64
+ when 'Integer'
65
+ return data if data.instance_of?(Integer)
66
+ when 'Time'
67
+ return Time.parse(data)
68
+ when 'Date'
69
+ return Date.iso8601(data)
70
+ when 'String'
71
+ return data if data.instance_of?(String)
72
+ when 'Object' # "type: object"
73
+ return data if data.instance_of?(Hash)
74
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
75
+ if data.instance_of?(Array)
76
+ sub_type = Regexp.last_match[:sub_type]
77
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
78
+ end
79
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
80
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
81
+ sub_type = Regexp.last_match[:sub_type]
82
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
83
+ end
84
+ else # model
85
+ const = AgentPushKit.const_get(klass)
86
+ if const
87
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
88
+ model = const.build(data)
89
+ return model if model
90
+ else
91
+ # raise if data contains keys that are not known to the model
92
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
93
+ model = const.build_from_hash(data)
94
+ return model if model
95
+ end
96
+ end
97
+ end
98
+
99
+ raise # if no match by now, raise
100
+ rescue
101
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
102
+ end
103
+ end
104
+ end
105
+
106
+ end