zyphr 0.1.0 → 0.1.2

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 (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +59 -0
  3. data/docs/BatchPublishWaaSEvents201Response.md +18 -0
  4. data/docs/CreateWaaSApplication201Response.md +18 -0
  5. data/docs/CreateWaaSApplicationRequest.md +22 -0
  6. data/docs/CreateWaaSEndpoint201Response.md +18 -0
  7. data/docs/CreateWaaSEndpointRequest.md +22 -0
  8. data/docs/CreateWaaSEndpointResponse.md +30 -0
  9. data/docs/CreateWaaSEventType201Response.md +18 -0
  10. data/docs/CreateWaaSEventTypeRequest.md +26 -0
  11. data/docs/GenerateWaaSPortalToken201Response.md +18 -0
  12. data/docs/GetWaaSEndpoint200Response.md +18 -0
  13. data/docs/GetWaaSUsage200Response.md +18 -0
  14. data/docs/ListWaaSApplications200Response.md +18 -0
  15. data/docs/ListWaaSEndpointDeliveries200Response.md +18 -0
  16. data/docs/ListWaaSEndpoints200Response.md +18 -0
  17. data/docs/ListWaaSEventTypes200Response.md +18 -0
  18. data/docs/PublishWaaSEvent201Response.md +18 -0
  19. data/docs/UpdateWaaSApplicationRequest.md +22 -0
  20. data/docs/UpdateWaaSEndpointRequest.md +22 -0
  21. data/docs/UpdateWaaSEventTypeRequest.md +24 -0
  22. data/docs/WaaSApplication.md +32 -0
  23. data/docs/WaaSApplicationsApi.md +446 -0
  24. data/docs/WaaSBatchPublishRequest.md +18 -0
  25. data/docs/WaaSBatchPublishResponse.md +22 -0
  26. data/docs/WaaSDeliveriesApi.md +319 -0
  27. data/docs/WaaSDelivery.md +38 -0
  28. data/docs/WaaSEndpoint.md +32 -0
  29. data/docs/WaaSEndpointsApi.md +673 -0
  30. data/docs/WaaSEventType.md +36 -0
  31. data/docs/WaaSEventTypesApi.md +454 -0
  32. data/docs/WaaSEventsApi.md +155 -0
  33. data/docs/WaaSPortalApi.md +81 -0
  34. data/docs/WaaSPortalTokenRequest.md +24 -0
  35. data/docs/WaaSPortalTokenRequestTheme.md +20 -0
  36. data/docs/WaaSPortalTokenResponse.md +20 -0
  37. data/docs/WaaSPublishEventRequest.md +24 -0
  38. data/docs/WaaSPublishEventResponse.md +26 -0
  39. data/docs/WaaSUsageResponse.md +28 -0
  40. data/lib/zyphr/api/waa_s_applications_api.rb +425 -0
  41. data/lib/zyphr/api/waa_s_deliveries_api.rb +316 -0
  42. data/lib/zyphr/api/waa_s_endpoints_api.rb +653 -0
  43. data/lib/zyphr/api/waa_s_event_types_api.rb +452 -0
  44. data/lib/zyphr/api/waa_s_events_api.rb +170 -0
  45. data/lib/zyphr/api/waa_s_portal_api.rb +96 -0
  46. data/lib/zyphr/models/batch_publish_waa_s_events201_response.rb +220 -0
  47. data/lib/zyphr/models/create_waa_s_application201_response.rb +220 -0
  48. data/lib/zyphr/models/create_waa_s_application_request.rb +275 -0
  49. data/lib/zyphr/models/create_waa_s_endpoint201_response.rb +220 -0
  50. data/lib/zyphr/models/create_waa_s_endpoint_request.rb +294 -0
  51. data/lib/zyphr/models/create_waa_s_endpoint_response.rb +277 -0
  52. data/lib/zyphr/models/create_waa_s_event_type201_response.rb +220 -0
  53. data/lib/zyphr/models/create_waa_s_event_type_request.rb +292 -0
  54. data/lib/zyphr/models/generate_waa_s_portal_token201_response.rb +220 -0
  55. data/lib/zyphr/models/get_waa_s_endpoint200_response.rb +220 -0
  56. data/lib/zyphr/models/get_waa_s_usage200_response.rb +220 -0
  57. data/lib/zyphr/models/list_waa_s_applications200_response.rb +222 -0
  58. data/lib/zyphr/models/list_waa_s_endpoint_deliveries200_response.rb +222 -0
  59. data/lib/zyphr/models/list_waa_s_endpoints200_response.rb +222 -0
  60. data/lib/zyphr/models/list_waa_s_event_types200_response.rb +222 -0
  61. data/lib/zyphr/models/publish_waa_s_event201_response.rb +220 -0
  62. data/lib/zyphr/models/update_waa_s_application_request.rb +272 -0
  63. data/lib/zyphr/models/update_waa_s_endpoint_request.rb +274 -0
  64. data/lib/zyphr/models/update_waa_s_event_type_request.rb +247 -0
  65. data/lib/zyphr/models/waa_s_application.rb +317 -0
  66. data/lib/zyphr/models/waa_s_batch_publish_request.rb +248 -0
  67. data/lib/zyphr/models/waa_s_batch_publish_response.rb +240 -0
  68. data/lib/zyphr/models/waa_s_delivery.rb +344 -0
  69. data/lib/zyphr/models/waa_s_endpoint.rb +319 -0
  70. data/lib/zyphr/models/waa_s_event_type.rb +335 -0
  71. data/lib/zyphr/models/waa_s_portal_token_request.rb +267 -0
  72. data/lib/zyphr/models/waa_s_portal_token_request_theme.rb +263 -0
  73. data/lib/zyphr/models/waa_s_portal_token_response.rb +229 -0
  74. data/lib/zyphr/models/waa_s_publish_event_request.rb +302 -0
  75. data/lib/zyphr/models/waa_s_publish_event_response.rb +256 -0
  76. data/lib/zyphr/models/waa_s_usage_response.rb +265 -0
  77. data/lib/zyphr.rb +37 -0
  78. data/spec/api/waa_s_applications_api_spec.rb +110 -0
  79. data/spec/api/waa_s_deliveries_api_spec.rb +94 -0
  80. data/spec/api/waa_s_endpoints_api_spec.rb +154 -0
  81. data/spec/api/waa_s_event_types_api_spec.rb +115 -0
  82. data/spec/api/waa_s_events_api_spec.rb +61 -0
  83. data/spec/api/waa_s_portal_api_spec.rb +48 -0
  84. data/spec/models/batch_publish_waa_s_events201_response_spec.rb +36 -0
  85. data/spec/models/create_waa_s_application201_response_spec.rb +36 -0
  86. data/spec/models/create_waa_s_application_request_spec.rb +48 -0
  87. data/spec/models/create_waa_s_endpoint201_response_spec.rb +36 -0
  88. data/spec/models/create_waa_s_endpoint_request_spec.rb +48 -0
  89. data/spec/models/create_waa_s_endpoint_response_spec.rb +72 -0
  90. data/spec/models/create_waa_s_event_type201_response_spec.rb +36 -0
  91. data/spec/models/create_waa_s_event_type_request_spec.rb +60 -0
  92. data/spec/models/generate_waa_s_portal_token201_response_spec.rb +36 -0
  93. data/spec/models/get_waa_s_endpoint200_response_spec.rb +36 -0
  94. data/spec/models/get_waa_s_usage200_response_spec.rb +36 -0
  95. data/spec/models/list_waa_s_applications200_response_spec.rb +36 -0
  96. data/spec/models/list_waa_s_endpoint_deliveries200_response_spec.rb +36 -0
  97. data/spec/models/list_waa_s_endpoints200_response_spec.rb +36 -0
  98. data/spec/models/list_waa_s_event_types200_response_spec.rb +36 -0
  99. data/spec/models/publish_waa_s_event201_response_spec.rb +36 -0
  100. data/spec/models/update_waa_s_application_request_spec.rb +52 -0
  101. data/spec/models/update_waa_s_endpoint_request_spec.rb +52 -0
  102. data/spec/models/update_waa_s_event_type_request_spec.rb +54 -0
  103. data/spec/models/waa_s_application_spec.rb +82 -0
  104. data/spec/models/waa_s_batch_publish_request_spec.rb +36 -0
  105. data/spec/models/waa_s_batch_publish_response_spec.rb +48 -0
  106. data/spec/models/waa_s_delivery_spec.rb +100 -0
  107. data/spec/models/waa_s_endpoint_spec.rb +82 -0
  108. data/spec/models/waa_s_event_type_spec.rb +94 -0
  109. data/spec/models/waa_s_portal_token_request_spec.rb +54 -0
  110. data/spec/models/waa_s_portal_token_request_theme_spec.rb +46 -0
  111. data/spec/models/waa_s_portal_token_response_spec.rb +42 -0
  112. data/spec/models/waa_s_publish_event_request_spec.rb +54 -0
  113. data/spec/models/waa_s_publish_event_response_spec.rb +60 -0
  114. data/spec/models/waa_s_usage_response_spec.rb +66 -0
  115. data/zyphr.gemspec +1 -1
  116. metadata +150 -2
@@ -0,0 +1,302 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class WaaSPublishEventRequest
18
+ # Event type to publish
19
+ attr_accessor :event_type
20
+
21
+ # Target tenant
22
+ attr_accessor :tenant_id
23
+
24
+ # Event payload
25
+ attr_accessor :data
26
+
27
+ # Deduplication key
28
+ attr_accessor :idempotency_key
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'event_type' => :'event_type',
34
+ :'tenant_id' => :'tenant_id',
35
+ :'data' => :'data',
36
+ :'idempotency_key' => :'idempotency_key'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'event_type' => :'String',
54
+ :'tenant_id' => :'String',
55
+ :'data' => :'Object',
56
+ :'idempotency_key' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::WaaSPublishEventRequest` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::WaaSPublishEventRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'event_type')
83
+ self.event_type = attributes[:'event_type']
84
+ else
85
+ self.event_type = nil
86
+ end
87
+
88
+ if attributes.key?(:'tenant_id')
89
+ self.tenant_id = attributes[:'tenant_id']
90
+ else
91
+ self.tenant_id = nil
92
+ end
93
+
94
+ if attributes.key?(:'data')
95
+ self.data = attributes[:'data']
96
+ else
97
+ self.data = nil
98
+ end
99
+
100
+ if attributes.key?(:'idempotency_key')
101
+ self.idempotency_key = attributes[:'idempotency_key']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @event_type.nil?
111
+ invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
112
+ end
113
+
114
+ if @tenant_id.nil?
115
+ invalid_properties.push('invalid value for "tenant_id", tenant_id cannot be nil.')
116
+ end
117
+
118
+ if @data.nil?
119
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
120
+ end
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ warn '[DEPRECATED] the `valid?` method is obsolete'
129
+ return false if @event_type.nil?
130
+ return false if @tenant_id.nil?
131
+ return false if @data.nil?
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] event_type Value to be assigned
137
+ def event_type=(event_type)
138
+ if event_type.nil?
139
+ fail ArgumentError, 'event_type cannot be nil'
140
+ end
141
+
142
+ @event_type = event_type
143
+ end
144
+
145
+ # Custom attribute writer method with validation
146
+ # @param [Object] tenant_id Value to be assigned
147
+ def tenant_id=(tenant_id)
148
+ if tenant_id.nil?
149
+ fail ArgumentError, 'tenant_id cannot be nil'
150
+ end
151
+
152
+ @tenant_id = tenant_id
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] data Value to be assigned
157
+ def data=(data)
158
+ if data.nil?
159
+ fail ArgumentError, 'data cannot be nil'
160
+ end
161
+
162
+ @data = data
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ event_type == o.event_type &&
171
+ tenant_id == o.tenant_id &&
172
+ data == o.data &&
173
+ idempotency_key == o.idempotency_key
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Integer] Hash code
184
+ def hash
185
+ [event_type, tenant_id, data, idempotency_key].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def self.build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+ attributes = attributes.transform_keys(&:to_sym)
194
+ transformed_hash = {}
195
+ openapi_types.each_pair do |key, type|
196
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
197
+ transformed_hash["#{key}"] = nil
198
+ elsif type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[attribute_map[key]].is_a?(Array)
202
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
203
+ end
204
+ elsif !attributes[attribute_map[key]].nil?
205
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
206
+ end
207
+ end
208
+ new(transformed_hash)
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def self._deserialize(type, value)
216
+ case type.to_sym
217
+ when :Time
218
+ Time.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ # models (e.g. Pet) or oneOf
249
+ klass = Zyphr.const_get(type)
250
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class WaaSPublishEventResponse
18
+ attr_accessor :event_id
19
+
20
+ attr_accessor :event_type
21
+
22
+ attr_accessor :tenant_id
23
+
24
+ attr_accessor :endpoints_matched
25
+
26
+ attr_accessor :deliveries_created
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'event_id' => :'event_id',
32
+ :'event_type' => :'event_type',
33
+ :'tenant_id' => :'tenant_id',
34
+ :'endpoints_matched' => :'endpoints_matched',
35
+ :'deliveries_created' => :'deliveries_created'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'event_id' => :'String',
53
+ :'event_type' => :'String',
54
+ :'tenant_id' => :'String',
55
+ :'endpoints_matched' => :'Integer',
56
+ :'deliveries_created' => :'Integer'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::WaaSPublishEventResponse` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::WaaSPublishEventResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'event_id')
83
+ self.event_id = attributes[:'event_id']
84
+ end
85
+
86
+ if attributes.key?(:'event_type')
87
+ self.event_type = attributes[:'event_type']
88
+ end
89
+
90
+ if attributes.key?(:'tenant_id')
91
+ self.tenant_id = attributes[:'tenant_id']
92
+ end
93
+
94
+ if attributes.key?(:'endpoints_matched')
95
+ self.endpoints_matched = attributes[:'endpoints_matched']
96
+ end
97
+
98
+ if attributes.key?(:'deliveries_created')
99
+ self.deliveries_created = attributes[:'deliveries_created']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
+ invalid_properties = Array.new
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ true
116
+ end
117
+
118
+ # Checks equality by comparing each attribute.
119
+ # @param [Object] Object to be compared
120
+ def ==(o)
121
+ return true if self.equal?(o)
122
+ self.class == o.class &&
123
+ event_id == o.event_id &&
124
+ event_type == o.event_type &&
125
+ tenant_id == o.tenant_id &&
126
+ endpoints_matched == o.endpoints_matched &&
127
+ deliveries_created == o.deliveries_created
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [event_id, event_type, tenant_id, endpoints_matched, deliveries_created].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ transformed_hash = {}
149
+ openapi_types.each_pair do |key, type|
150
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = nil
152
+ elsif type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[attribute_map[key]].is_a?(Array)
156
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
+ end
158
+ elsif !attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
+ end
161
+ end
162
+ new(transformed_hash)
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def self._deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = Zyphr.const_get(type)
204
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end