onesignal 5.10.0 → 5.11.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 (186) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +3 -3
  5. data/docs/AuditLogActor.md +26 -0
  6. data/docs/AuditLogContext.md +24 -0
  7. data/docs/AuditLogEvent.md +36 -0
  8. data/docs/AuditLogTarget.md +24 -0
  9. data/docs/DefaultApi.md +267 -0
  10. data/docs/GetSegmentSuccessResponse.md +20 -0
  11. data/docs/ListAuditLogsSuccessResponse.md +22 -0
  12. data/docs/SegmentDetails.md +28 -0
  13. data/docs/UpdateSegmentRequest.md +22 -0
  14. data/docs/UpdateSegmentSuccessResponse.md +20 -0
  15. data/lib/onesignal/api/default_api.rb +273 -1
  16. data/lib/onesignal/api_client.rb +2 -2
  17. data/lib/onesignal/api_error.rb +1 -1
  18. data/lib/onesignal/configuration.rb +1 -1
  19. data/lib/onesignal/models/api_key_token.rb +1 -1
  20. data/lib/onesignal/models/api_key_tokens_list_response.rb +1 -1
  21. data/lib/onesignal/models/app.rb +1 -1
  22. data/lib/onesignal/models/audit_log_actor.rb +261 -0
  23. data/lib/onesignal/models/audit_log_context.rb +251 -0
  24. data/lib/onesignal/models/audit_log_event.rb +310 -0
  25. data/lib/onesignal/models/audit_log_target.rb +251 -0
  26. data/lib/onesignal/models/basic_notification.rb +1 -1
  27. data/lib/onesignal/models/basic_notification_all_of.rb +1 -1
  28. data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +1 -1
  29. data/lib/onesignal/models/button.rb +1 -1
  30. data/lib/onesignal/models/copy_template_request.rb +1 -1
  31. data/lib/onesignal/models/create_api_key_request.rb +1 -1
  32. data/lib/onesignal/models/create_api_key_response.rb +1 -1
  33. data/lib/onesignal/models/create_notification_success_response.rb +1 -1
  34. data/lib/onesignal/models/create_segment_conflict_response.rb +1 -1
  35. data/lib/onesignal/models/create_segment_success_response.rb +1 -1
  36. data/lib/onesignal/models/create_template_request.rb +1 -1
  37. data/lib/onesignal/models/create_user_conflict_response.rb +1 -1
  38. data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +1 -1
  39. data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +1 -1
  40. data/lib/onesignal/models/custom_event.rb +1 -1
  41. data/lib/onesignal/models/custom_events_request.rb +1 -1
  42. data/lib/onesignal/models/delivery_data.rb +1 -1
  43. data/lib/onesignal/models/export_events_success_response.rb +1 -1
  44. data/lib/onesignal/models/export_subscriptions_request_body.rb +1 -1
  45. data/lib/onesignal/models/export_subscriptions_success_response.rb +1 -1
  46. data/lib/onesignal/models/filter.rb +1 -1
  47. data/lib/onesignal/models/filter_expression.rb +1 -1
  48. data/lib/onesignal/models/generic_error.rb +1 -1
  49. data/lib/onesignal/models/generic_success_bool_response.rb +1 -1
  50. data/lib/onesignal/models/get_notification_history_request_body.rb +1 -1
  51. data/lib/onesignal/models/get_segment_success_response.rb +229 -0
  52. data/lib/onesignal/models/get_segments_success_response.rb +1 -1
  53. data/lib/onesignal/models/language_string_map.rb +1 -1
  54. data/lib/onesignal/models/list_audit_logs_success_response.rb +242 -0
  55. data/lib/onesignal/models/notification.rb +1 -1
  56. data/lib/onesignal/models/notification_all_of.rb +1 -1
  57. data/lib/onesignal/models/notification_history_success_response.rb +1 -1
  58. data/lib/onesignal/models/notification_slice.rb +1 -1
  59. data/lib/onesignal/models/notification_target.rb +1 -1
  60. data/lib/onesignal/models/notification_with_meta.rb +1 -1
  61. data/lib/onesignal/models/notification_with_meta_all_of.rb +1 -1
  62. data/lib/onesignal/models/operator.rb +1 -1
  63. data/lib/onesignal/models/outcome_data.rb +1 -1
  64. data/lib/onesignal/models/outcomes_data.rb +1 -1
  65. data/lib/onesignal/models/platform_delivery_data.rb +1 -1
  66. data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +1 -1
  67. data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +1 -1
  68. data/lib/onesignal/models/properties_body.rb +1 -1
  69. data/lib/onesignal/models/properties_deltas.rb +1 -1
  70. data/lib/onesignal/models/properties_object.rb +1 -1
  71. data/lib/onesignal/models/purchase.rb +1 -1
  72. data/lib/onesignal/models/rate_limit_error.rb +1 -1
  73. data/lib/onesignal/models/segment.rb +1 -1
  74. data/lib/onesignal/models/segment_data.rb +1 -1
  75. data/lib/onesignal/models/segment_details.rb +308 -0
  76. data/lib/onesignal/models/segment_notification_target.rb +1 -1
  77. data/lib/onesignal/models/start_live_activity_request.rb +1 -1
  78. data/lib/onesignal/models/start_live_activity_success_response.rb +1 -1
  79. data/lib/onesignal/models/subscription.rb +1 -1
  80. data/lib/onesignal/models/subscription_body.rb +1 -1
  81. data/lib/onesignal/models/subscription_notification_target.rb +1 -1
  82. data/lib/onesignal/models/template_resource.rb +1 -1
  83. data/lib/onesignal/models/templates_list_response.rb +1 -1
  84. data/lib/onesignal/models/transfer_subscription_request_body.rb +1 -1
  85. data/lib/onesignal/models/update_api_key_request.rb +1 -1
  86. data/lib/onesignal/models/update_live_activity_request.rb +1 -1
  87. data/lib/onesignal/models/update_live_activity_success_response.rb +1 -1
  88. data/lib/onesignal/models/update_segment_request.rb +281 -0
  89. data/lib/onesignal/models/update_segment_success_response.rb +230 -0
  90. data/lib/onesignal/models/update_template_request.rb +1 -1
  91. data/lib/onesignal/models/update_user_request.rb +1 -1
  92. data/lib/onesignal/models/user.rb +1 -1
  93. data/lib/onesignal/models/user_identity_body.rb +1 -1
  94. data/lib/onesignal/models/web_button.rb +1 -1
  95. data/lib/onesignal/version.rb +2 -2
  96. data/lib/onesignal.rb +10 -1
  97. data/onesignal.gemspec +1 -1
  98. data/spec/api/default_api_spec.rb +52 -1
  99. data/spec/api_client_spec.rb +1 -1
  100. data/spec/configuration_spec.rb +1 -1
  101. data/spec/models/api_key_token_spec.rb +1 -1
  102. data/spec/models/api_key_tokens_list_response_spec.rb +1 -1
  103. data/spec/models/app_spec.rb +1 -1
  104. data/spec/models/audit_log_actor_spec.rb +58 -0
  105. data/spec/models/audit_log_context_spec.rb +52 -0
  106. data/spec/models/audit_log_event_spec.rb +88 -0
  107. data/spec/models/audit_log_target_spec.rb +52 -0
  108. data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +1 -1
  109. data/spec/models/basic_notification_all_of_spec.rb +1 -1
  110. data/spec/models/basic_notification_spec.rb +1 -1
  111. data/spec/models/button_spec.rb +1 -1
  112. data/spec/models/copy_template_request_spec.rb +1 -1
  113. data/spec/models/create_api_key_request_spec.rb +1 -1
  114. data/spec/models/create_api_key_response_spec.rb +1 -1
  115. data/spec/models/create_notification_success_response_spec.rb +1 -1
  116. data/spec/models/create_segment_conflict_response_spec.rb +1 -1
  117. data/spec/models/create_segment_success_response_spec.rb +1 -1
  118. data/spec/models/create_template_request_spec.rb +1 -1
  119. data/spec/models/create_user_conflict_response_errors_inner_spec.rb +1 -1
  120. data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +1 -1
  121. data/spec/models/create_user_conflict_response_spec.rb +1 -1
  122. data/spec/models/custom_event_spec.rb +1 -1
  123. data/spec/models/custom_events_request_spec.rb +1 -1
  124. data/spec/models/delivery_data_spec.rb +1 -1
  125. data/spec/models/export_events_success_response_spec.rb +1 -1
  126. data/spec/models/export_subscriptions_request_body_spec.rb +1 -1
  127. data/spec/models/export_subscriptions_success_response_spec.rb +1 -1
  128. data/spec/models/filter_expression_spec.rb +1 -1
  129. data/spec/models/filter_spec.rb +1 -1
  130. data/spec/models/generic_error_spec.rb +1 -1
  131. data/spec/models/generic_success_bool_response_spec.rb +1 -1
  132. data/spec/models/get_notification_history_request_body_spec.rb +1 -1
  133. data/spec/models/get_segment_success_response_spec.rb +40 -0
  134. data/spec/models/get_segments_success_response_spec.rb +1 -1
  135. data/spec/models/language_string_map_spec.rb +1 -1
  136. data/spec/models/list_audit_logs_success_response_spec.rb +46 -0
  137. data/spec/models/notification_all_of_spec.rb +1 -1
  138. data/spec/models/notification_history_success_response_spec.rb +1 -1
  139. data/spec/models/notification_slice_spec.rb +1 -1
  140. data/spec/models/notification_spec.rb +1 -1
  141. data/spec/models/notification_target_spec.rb +1 -1
  142. data/spec/models/notification_with_meta_all_of_spec.rb +1 -1
  143. data/spec/models/notification_with_meta_spec.rb +1 -1
  144. data/spec/models/operator_spec.rb +1 -1
  145. data/spec/models/outcome_data_spec.rb +1 -1
  146. data/spec/models/outcomes_data_spec.rb +1 -1
  147. data/spec/models/platform_delivery_data_email_all_of_spec.rb +1 -1
  148. data/spec/models/platform_delivery_data_sms_all_of_spec.rb +1 -1
  149. data/spec/models/platform_delivery_data_spec.rb +1 -1
  150. data/spec/models/properties_body_spec.rb +1 -1
  151. data/spec/models/properties_deltas_spec.rb +1 -1
  152. data/spec/models/properties_object_spec.rb +1 -1
  153. data/spec/models/purchase_spec.rb +1 -1
  154. data/spec/models/rate_limit_error_spec.rb +1 -1
  155. data/spec/models/segment_data_spec.rb +1 -1
  156. data/spec/models/segment_details_spec.rb +68 -0
  157. data/spec/models/segment_notification_target_spec.rb +1 -1
  158. data/spec/models/segment_spec.rb +1 -1
  159. data/spec/models/start_live_activity_request_spec.rb +1 -1
  160. data/spec/models/start_live_activity_success_response_spec.rb +1 -1
  161. data/spec/models/subscription_body_spec.rb +1 -1
  162. data/spec/models/subscription_notification_target_spec.rb +1 -1
  163. data/spec/models/subscription_spec.rb +1 -1
  164. data/spec/models/template_resource_spec.rb +1 -1
  165. data/spec/models/templates_list_response_spec.rb +1 -1
  166. data/spec/models/transfer_subscription_request_body_spec.rb +1 -1
  167. data/spec/models/update_api_key_request_spec.rb +1 -1
  168. data/spec/models/update_live_activity_request_spec.rb +1 -1
  169. data/spec/models/update_live_activity_success_response_spec.rb +1 -1
  170. data/spec/models/update_segment_request_spec.rb +46 -0
  171. data/spec/models/update_segment_success_response_spec.rb +40 -0
  172. data/spec/models/update_template_request_spec.rb +1 -1
  173. data/spec/models/update_user_request_spec.rb +1 -1
  174. data/spec/models/user_identity_body_spec.rb +1 -1
  175. data/spec/models/user_spec.rb +1 -1
  176. data/spec/models/web_button_spec.rb +1 -1
  177. data/spec/spec_helper.rb +1 -1
  178. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-13.0.0/gem_make.out +5 -5
  179. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +5 -5
  180. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/gem_make.out +5 -5
  181. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/mkmf.log +3 -3
  182. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  183. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.4.0/gem_make.out +5 -5
  184. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +5 -5
  185. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +5 -5
  186. metadata +94 -58
@@ -0,0 +1,251 @@
1
+ =begin
2
+ #OneSignal
3
+
4
+ #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
+
6
+ The version of the OpenAPI document: 5.11.0
7
+ Contact: devrel@onesignal.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OneSignal
17
+ # Request context at the time of the event. Absent if context was not captured.
18
+ class AuditLogContext
19
+ # Country code derived from the request IP.
20
+ attr_accessor :country
21
+
22
+ # IP address the request originated from.
23
+ attr_accessor :ip
24
+
25
+ # Additional context-specific data.
26
+ attr_accessor :metadata
27
+
28
+ # User agent of the client that made the request.
29
+ attr_accessor :user_agent
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'country' => :'country',
35
+ :'ip' => :'ip',
36
+ :'metadata' => :'metadata',
37
+ :'user_agent' => :'user_agent'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'country' => :'String',
50
+ :'ip' => :'String',
51
+ :'metadata' => :'Object',
52
+ :'user_agent' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::AuditLogContext` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::AuditLogContext`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'country')
78
+ self.country = attributes[:'country']
79
+ end
80
+
81
+ if attributes.key?(:'ip')
82
+ self.ip = attributes[:'ip']
83
+ end
84
+
85
+ if attributes.key?(:'metadata')
86
+ self.metadata = attributes[:'metadata']
87
+ end
88
+
89
+ if attributes.key?(:'user_agent')
90
+ self.user_agent = attributes[:'user_agent']
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ true
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ country == o.country &&
113
+ ip == o.ip &&
114
+ metadata == o.metadata &&
115
+ user_agent == o.user_agent
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Integer] Hash code
126
+ def hash
127
+ [country, ip, metadata, user_agent].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def self.build_from_hash(attributes)
134
+ new.build_from_hash(attributes)
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ attributes = attributes.transform_keys(&:to_sym)
143
+ self.class.openapi_types.each_pair do |key, type|
144
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
145
+ self.send("#{key}=", nil)
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :Time
167
+ Time.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ # models (e.g. Pet) or oneOf
198
+ klass = OneSignal.const_get(type)
199
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # to_body is an alias to to_hash (backward compatibility)
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_body
212
+ to_hash
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ self.class.attribute_map.each_pair do |attr, param|
220
+ value = self.send(attr)
221
+ if value.nil?
222
+ is_nullable = self.class.openapi_nullable.include?(attr)
223
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
224
+ end
225
+
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+
249
+ end
250
+
251
+ end
@@ -0,0 +1,310 @@
1
+ =begin
2
+ #OneSignal
3
+
4
+ #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
+
6
+ The version of the OpenAPI document: 5.11.0
7
+ Contact: devrel@onesignal.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OneSignal
17
+ class AuditLogEvent
18
+ # The action that was performed (e.g. notification.sent, segment.created, member.invited).
19
+ attr_accessor :action
20
+
21
+ attr_accessor :actor
22
+
23
+ # UUID of the app the event is associated with. Absent for org-level events.
24
+ attr_accessor :app_id
25
+
26
+ attr_accessor :context
27
+
28
+ # UUID of the audit log event.
29
+ attr_accessor :id
30
+
31
+ # Additional event-specific data that does not fit into the standard fields.
32
+ attr_accessor :metadata
33
+
34
+ # RFC 3339 timestamp of when the event occurred (e.g. 2026-02-18T12:34:56Z).
35
+ attr_accessor :occurred_at
36
+
37
+ # UUID of the organization the event belongs to.
38
+ attr_accessor :organization_id
39
+
40
+ # The resources the action was performed on. May be empty for org-level events.
41
+ attr_accessor :targets
42
+
43
+ # Schema version of the event payload.
44
+ attr_accessor :version
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'action' => :'action',
50
+ :'actor' => :'actor',
51
+ :'app_id' => :'app_id',
52
+ :'context' => :'context',
53
+ :'id' => :'id',
54
+ :'metadata' => :'metadata',
55
+ :'occurred_at' => :'occurred_at',
56
+ :'organization_id' => :'organization_id',
57
+ :'targets' => :'targets',
58
+ :'version' => :'version'
59
+ }
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'action' => :'String',
71
+ :'actor' => :'AuditLogActor',
72
+ :'app_id' => :'String',
73
+ :'context' => :'AuditLogContext',
74
+ :'id' => :'String',
75
+ :'metadata' => :'Object',
76
+ :'occurred_at' => :'String',
77
+ :'organization_id' => :'String',
78
+ :'targets' => :'Array<AuditLogTarget>',
79
+ :'version' => :'Integer'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::AuditLogEvent` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::AuditLogEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'action')
105
+ self.action = attributes[:'action']
106
+ end
107
+
108
+ if attributes.key?(:'actor')
109
+ self.actor = attributes[:'actor']
110
+ end
111
+
112
+ if attributes.key?(:'app_id')
113
+ self.app_id = attributes[:'app_id']
114
+ end
115
+
116
+ if attributes.key?(:'context')
117
+ self.context = attributes[:'context']
118
+ end
119
+
120
+ if attributes.key?(:'id')
121
+ self.id = attributes[:'id']
122
+ end
123
+
124
+ if attributes.key?(:'metadata')
125
+ self.metadata = attributes[:'metadata']
126
+ end
127
+
128
+ if attributes.key?(:'occurred_at')
129
+ self.occurred_at = attributes[:'occurred_at']
130
+ end
131
+
132
+ if attributes.key?(:'organization_id')
133
+ self.organization_id = attributes[:'organization_id']
134
+ end
135
+
136
+ if attributes.key?(:'targets')
137
+ if (value = attributes[:'targets']).is_a?(Array)
138
+ self.targets = value
139
+ end
140
+ end
141
+
142
+ if attributes.key?(:'version')
143
+ self.version = attributes[:'version']
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ invalid_properties = Array.new
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ true
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ action == o.action &&
166
+ actor == o.actor &&
167
+ app_id == o.app_id &&
168
+ context == o.context &&
169
+ id == o.id &&
170
+ metadata == o.metadata &&
171
+ occurred_at == o.occurred_at &&
172
+ organization_id == o.organization_id &&
173
+ targets == o.targets &&
174
+ version == o.version
175
+ end
176
+
177
+ # @see the `==` method
178
+ # @param [Object] Object to be compared
179
+ def eql?(o)
180
+ self == o
181
+ end
182
+
183
+ # Calculates hash code according to all attributes.
184
+ # @return [Integer] Hash code
185
+ def hash
186
+ [action, actor, app_id, context, id, metadata, occurred_at, organization_id, targets, version].hash
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def self.build_from_hash(attributes)
193
+ new.build_from_hash(attributes)
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def build_from_hash(attributes)
200
+ return nil unless attributes.is_a?(Hash)
201
+ attributes = attributes.transform_keys(&:to_sym)
202
+ self.class.openapi_types.each_pair do |key, type|
203
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
204
+ self.send("#{key}=", nil)
205
+ elsif type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
209
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
210
+ end
211
+ elsif !attributes[self.class.attribute_map[key]].nil?
212
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
213
+ end
214
+ end
215
+
216
+ self
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def _deserialize(type, value)
224
+ case type.to_sym
225
+ when :Time
226
+ Time.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :Boolean
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ # models (e.g. Pet) or oneOf
257
+ klass = OneSignal.const_get(type)
258
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
259
+ end
260
+ end
261
+
262
+ # Returns the string representation of the object
263
+ # @return [String] String presentation of the object
264
+ def to_s
265
+ to_hash.to_s
266
+ end
267
+
268
+ # to_body is an alias to to_hash (backward compatibility)
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_body
271
+ to_hash
272
+ end
273
+
274
+ # Returns the object in the form of hash
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_hash
277
+ hash = {}
278
+ self.class.attribute_map.each_pair do |attr, param|
279
+ value = self.send(attr)
280
+ if value.nil?
281
+ is_nullable = self.class.openapi_nullable.include?(attr)
282
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
283
+ end
284
+
285
+ hash[param] = _to_hash(value)
286
+ end
287
+ hash
288
+ end
289
+
290
+ # Outputs non-array value in the form of hash
291
+ # For object, use to_hash. Otherwise, just return the value
292
+ # @param [Object] value Any valid value
293
+ # @return [Hash] Returns the value in the form of hash
294
+ def _to_hash(value)
295
+ if value.is_a?(Array)
296
+ value.compact.map { |v| _to_hash(v) }
297
+ elsif value.is_a?(Hash)
298
+ {}.tap do |hash|
299
+ value.each { |k, v| hash[k] = _to_hash(v) }
300
+ end
301
+ elsif value.respond_to? :to_hash
302
+ value.to_hash
303
+ else
304
+ value
305
+ end
306
+ end
307
+
308
+ end
309
+
310
+ end