zyphr 0.1.41 → 0.1.43

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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -1
  3. data/docs/AuthUserDirectoryApi.md +57 -50
  4. data/docs/CloseWaaSEndpointCircuit200Response.md +20 -0
  5. data/docs/CloseWaaSEndpointCircuit200ResponseData.md +18 -0
  6. data/docs/DomainsApi.md +8 -7
  7. data/docs/GetEndUserById200Response.md +20 -0
  8. data/docs/GetEndUserClaims200Response.md +20 -0
  9. data/docs/GetEndUserClaims200ResponseData.md +18 -0
  10. data/docs/GetSubscriberInboxPreferences200Response.md +18 -0
  11. data/docs/GetSubscriberInboxPreferences200ResponseData.md +20 -0
  12. data/docs/GetSubscriberInboxPreferences200ResponseDataCategoriesInner.md +20 -0
  13. data/docs/GetSubscriberInboxPreferences200ResponseDataCategoriesInnerCategory.md +26 -0
  14. data/docs/GetSubscriberInboxPreferences200ResponseDataGlobal.md +18 -0
  15. data/docs/GetSubscriberInboxPreferences200ResponseDataGlobalChannelsInner.md +22 -0
  16. data/docs/GetSubscriberNotification200Response.md +18 -0
  17. data/docs/GetSubscriberUnreadCount200Response.md +18 -0
  18. data/docs/GetWaaSDelivery200Response.md +20 -0
  19. data/docs/GetWaaSEndpointCircuit200Response.md +20 -0
  20. data/docs/GetWaaSEndpointCircuit200ResponseData.md +28 -0
  21. data/docs/GetWaaSEndpointMetrics200Response.md +20 -0
  22. data/docs/GetWaaSEndpointMetrics200ResponseData.md +22 -0
  23. data/docs/GetWaaSEndpointMetrics200ResponseDataHealth.md +20 -0
  24. data/docs/GetWaaSEndpointMetrics200ResponseDataWindowsValue.md +30 -0
  25. data/docs/InboxApi.md +73 -64
  26. data/docs/InviteEndUser200Response.md +20 -0
  27. data/docs/InviteEndUser200ResponseData.md +22 -0
  28. data/docs/ListEndUsers200Response.md +20 -0
  29. data/docs/{ListWorkflowExecutions200ResponseMeta.md → ListEndUsers200ResponseMeta.md} +2 -2
  30. data/docs/ListWorkflowExecutions200Response.md +1 -1
  31. data/docs/MarkAllSubscriberNotificationsRead200Response.md +18 -0
  32. data/docs/RotateWaaSEndpointSecret200Response.md +20 -0
  33. data/docs/RotateWaaSEndpointSecret200ResponseData.md +18 -0
  34. data/docs/SendTemplateTestEmail202Response.md +20 -0
  35. data/docs/SendTemplateTestEmail202ResponseData.md +30 -0
  36. data/docs/SendTemplateTestEmail202ResponseMeta.md +18 -0
  37. data/docs/SetEndUserClaims200Response.md +18 -0
  38. data/docs/SetEndUserClaims200ResponseData.md +20 -0
  39. data/docs/SmsListResponse.md +1 -1
  40. data/docs/TemplatesApi.md +7 -6
  41. data/docs/UpdateSubscriberPreferences200Response.md +18 -0
  42. data/docs/UpdateSubscriberPreferences200ResponseData.md +20 -0
  43. data/docs/UpdateSubscriberPreferences200ResponseDataPreferencesInner.md +24 -0
  44. data/docs/UpdateWaaSEndpoint200Response.md +20 -0
  45. data/docs/UpdateWaaSEventType200Response.md +20 -0
  46. data/docs/WaaSDeliveriesApi.md +16 -14
  47. data/docs/WaaSEndpointsApi.md +40 -35
  48. data/docs/WaaSEventTypesApi.md +16 -14
  49. data/lib/zyphr/api/auth_user_directory_api.rb +51 -37
  50. data/lib/zyphr/api/domains_api.rb +7 -5
  51. data/lib/zyphr/api/inbox_api.rb +65 -47
  52. data/lib/zyphr/api/templates_api.rb +5 -5
  53. data/lib/zyphr/api/waa_s_deliveries_api.rb +14 -10
  54. data/lib/zyphr/api/waa_s_endpoints_api.rb +35 -25
  55. data/lib/zyphr/api/waa_s_event_types_api.rb +14 -10
  56. data/lib/zyphr/models/close_waa_s_endpoint_circuit200_response.rb +229 -0
  57. data/lib/zyphr/models/close_waa_s_endpoint_circuit200_response_data.rb +261 -0
  58. data/lib/zyphr/models/get_end_user_by_id200_response.rb +229 -0
  59. data/lib/zyphr/models/get_end_user_claims200_response.rb +229 -0
  60. data/lib/zyphr/models/get_end_user_claims200_response_data.rb +223 -0
  61. data/lib/zyphr/models/get_subscriber_inbox_preferences200_response.rb +220 -0
  62. data/lib/zyphr/models/get_subscriber_inbox_preferences200_response_data.rb +231 -0
  63. data/lib/zyphr/models/get_subscriber_inbox_preferences200_response_data_categories_inner.rb +231 -0
  64. data/lib/zyphr/models/get_subscriber_inbox_preferences200_response_data_categories_inner_category.rb +257 -0
  65. data/lib/zyphr/models/get_subscriber_inbox_preferences200_response_data_global.rb +222 -0
  66. data/lib/zyphr/models/get_subscriber_inbox_preferences200_response_data_global_channels_inner.rb +272 -0
  67. data/lib/zyphr/models/get_subscriber_notification200_response.rb +220 -0
  68. data/lib/zyphr/models/get_subscriber_unread_count200_response.rb +220 -0
  69. data/lib/zyphr/models/get_waa_s_delivery200_response.rb +229 -0
  70. data/lib/zyphr/models/get_waa_s_endpoint_circuit200_response.rb +229 -0
  71. data/lib/zyphr/models/get_waa_s_endpoint_circuit200_response_data.rb +349 -0
  72. data/lib/zyphr/models/get_waa_s_endpoint_metrics200_response.rb +229 -0
  73. data/lib/zyphr/models/get_waa_s_endpoint_metrics200_response_data.rb +292 -0
  74. data/lib/zyphr/models/get_waa_s_endpoint_metrics200_response_data_health.rb +287 -0
  75. data/lib/zyphr/models/get_waa_s_endpoint_metrics200_response_data_windows_value.rb +308 -0
  76. data/lib/zyphr/models/invite_end_user200_response.rb +229 -0
  77. data/lib/zyphr/models/invite_end_user200_response_data.rb +240 -0
  78. data/lib/zyphr/models/list_end_users200_response.rb +231 -0
  79. data/lib/zyphr/models/{list_workflow_executions200_response_meta.rb → list_end_users200_response_meta.rb} +3 -3
  80. data/lib/zyphr/models/list_workflow_executions200_response.rb +1 -1
  81. data/lib/zyphr/models/mark_all_subscriber_notifications_read200_response.rb +220 -0
  82. data/lib/zyphr/models/rotate_waa_s_endpoint_secret200_response.rb +229 -0
  83. data/lib/zyphr/models/rotate_waa_s_endpoint_secret200_response_data.rb +238 -0
  84. data/lib/zyphr/models/send_template_test_email202_response.rb +263 -0
  85. data/lib/zyphr/models/send_template_test_email202_response_data.rb +393 -0
  86. data/lib/zyphr/models/send_template_test_email202_response_meta.rb +237 -0
  87. data/lib/zyphr/models/set_end_user_claims200_response.rb +220 -0
  88. data/lib/zyphr/models/set_end_user_claims200_response_data.rb +230 -0
  89. data/lib/zyphr/models/sms_list_response.rb +1 -1
  90. data/lib/zyphr/models/update_subscriber_preferences200_response.rb +220 -0
  91. data/lib/zyphr/models/update_subscriber_preferences200_response_data.rb +231 -0
  92. data/lib/zyphr/models/update_subscriber_preferences200_response_data_preferences_inner.rb +282 -0
  93. data/lib/zyphr/models/update_waa_s_endpoint200_response.rb +229 -0
  94. data/lib/zyphr/models/update_waa_s_event_type200_response.rb +229 -0
  95. data/lib/zyphr.rb +37 -1
  96. data/spec/api/auth_user_directory_api_spec.rb +8 -8
  97. data/spec/api/domains_api_spec.rb +1 -1
  98. data/spec/api/inbox_api_spec.rb +10 -10
  99. data/spec/api/templates_api_spec.rb +1 -1
  100. data/spec/api/waa_s_deliveries_api_spec.rb +2 -2
  101. data/spec/api/waa_s_endpoints_api_spec.rb +5 -5
  102. data/spec/api/waa_s_event_types_api_spec.rb +2 -2
  103. data/spec/models/close_waa_s_endpoint_circuit200_response_data_spec.rb +40 -0
  104. data/spec/models/close_waa_s_endpoint_circuit200_response_spec.rb +42 -0
  105. data/spec/models/get_end_user_by_id200_response_spec.rb +42 -0
  106. data/spec/models/get_end_user_claims200_response_data_spec.rb +36 -0
  107. data/spec/models/get_end_user_claims200_response_spec.rb +42 -0
  108. data/spec/models/get_subscriber_inbox_preferences200_response_data_categories_inner_category_spec.rb +60 -0
  109. data/spec/models/get_subscriber_inbox_preferences200_response_data_categories_inner_spec.rb +42 -0
  110. data/spec/models/get_subscriber_inbox_preferences200_response_data_global_channels_inner_spec.rb +52 -0
  111. data/spec/models/get_subscriber_inbox_preferences200_response_data_global_spec.rb +36 -0
  112. data/spec/models/get_subscriber_inbox_preferences200_response_data_spec.rb +42 -0
  113. data/spec/models/get_subscriber_inbox_preferences200_response_spec.rb +36 -0
  114. data/spec/models/get_subscriber_notification200_response_spec.rb +36 -0
  115. data/spec/models/get_subscriber_unread_count200_response_spec.rb +36 -0
  116. data/spec/models/get_waa_s_delivery200_response_spec.rb +42 -0
  117. data/spec/models/get_waa_s_endpoint_circuit200_response_data_spec.rb +70 -0
  118. data/spec/models/get_waa_s_endpoint_circuit200_response_spec.rb +42 -0
  119. data/spec/models/get_waa_s_endpoint_metrics200_response_data_health_spec.rb +46 -0
  120. data/spec/models/get_waa_s_endpoint_metrics200_response_data_spec.rb +48 -0
  121. data/spec/models/get_waa_s_endpoint_metrics200_response_data_windows_value_spec.rb +76 -0
  122. data/spec/models/get_waa_s_endpoint_metrics200_response_spec.rb +42 -0
  123. data/spec/models/invite_end_user200_response_data_spec.rb +48 -0
  124. data/spec/models/invite_end_user200_response_spec.rb +42 -0
  125. data/spec/models/{list_workflow_executions200_response_meta_spec.rb → list_end_users200_response_meta_spec.rb} +6 -6
  126. data/spec/models/list_end_users200_response_spec.rb +42 -0
  127. data/spec/models/mark_all_subscriber_notifications_read200_response_spec.rb +36 -0
  128. data/spec/models/rotate_waa_s_endpoint_secret200_response_data_spec.rb +36 -0
  129. data/spec/models/rotate_waa_s_endpoint_secret200_response_spec.rb +42 -0
  130. data/spec/models/send_template_test_email202_response_data_spec.rb +72 -0
  131. data/spec/models/send_template_test_email202_response_meta_spec.rb +36 -0
  132. data/spec/models/send_template_test_email202_response_spec.rb +42 -0
  133. data/spec/models/set_end_user_claims200_response_data_spec.rb +42 -0
  134. data/spec/models/set_end_user_claims200_response_spec.rb +36 -0
  135. data/spec/models/update_subscriber_preferences200_response_data_preferences_inner_spec.rb +58 -0
  136. data/spec/models/update_subscriber_preferences200_response_data_spec.rb +42 -0
  137. data/spec/models/update_subscriber_preferences200_response_spec.rb +36 -0
  138. data/spec/models/update_waa_s_endpoint200_response_spec.rb +42 -0
  139. data/spec/models/update_waa_s_event_type200_response_spec.rb +42 -0
  140. data/zyphr.gemspec +1 -1
  141. metadata +150 -6
@@ -0,0 +1,261 @@
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 ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 CloseWaaSEndpointCircuit200ResponseData
18
+ attr_accessor :state
19
+
20
+ class EnumAttributeValidator
21
+ attr_reader :datatype
22
+ attr_reader :allowable_values
23
+
24
+ def initialize(datatype, allowable_values)
25
+ @allowable_values = allowable_values.map do |value|
26
+ case datatype.to_s
27
+ when /Integer/i
28
+ value.to_i
29
+ when /Float/i
30
+ value.to_f
31
+ else
32
+ value
33
+ end
34
+ end
35
+ end
36
+
37
+ def valid?(value)
38
+ !value || allowable_values.include?(value)
39
+ end
40
+ end
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'state' => :'state'
46
+ }
47
+ end
48
+
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ acceptable_attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'state' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::CloseWaaSEndpointCircuit200ResponseData` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ acceptable_attribute_map = self.class.acceptable_attribute_map
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!acceptable_attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::CloseWaaSEndpointCircuit200ResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'state')
89
+ self.state = attributes[:'state']
90
+ else
91
+ self.state = nil
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
+ invalid_properties = Array.new
100
+ if @state.nil?
101
+ invalid_properties.push('invalid value for "state", state 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 @state.nil?
112
+ state_validator = EnumAttributeValidator.new('String', ["closed"])
113
+ return false unless state_validator.valid?(@state)
114
+ true
115
+ end
116
+
117
+ # Custom attribute writer method checking allowed values (enum).
118
+ # @param [Object] state Object to be assigned
119
+ def state=(state)
120
+ validator = EnumAttributeValidator.new('String', ["closed"])
121
+ unless validator.valid?(state)
122
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
123
+ end
124
+ @state = state
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ state == o.state
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [state].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ attributes = attributes.transform_keys(&:to_sym)
153
+ transformed_hash = {}
154
+ openapi_types.each_pair do |key, type|
155
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = nil
157
+ elsif type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[attribute_map[key]].is_a?(Array)
161
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
162
+ end
163
+ elsif !attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
165
+ end
166
+ end
167
+ new(transformed_hash)
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def self._deserialize(type, value)
175
+ case type.to_sym
176
+ when :Time
177
+ Time.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ # models (e.g. Pet) or oneOf
208
+ klass = Zyphr.const_get(type)
209
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+
259
+ end
260
+
261
+ end
@@ -0,0 +1,229 @@
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 ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 GetEndUserById200Response
18
+ attr_accessor :data
19
+
20
+ attr_accessor :meta
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'data' => :'data',
26
+ :'meta' => :'meta'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'data' => :'AuthUser',
44
+ :'meta' => :'GetDomain200ResponseMeta'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::GetEndUserById200Response` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::GetEndUserById200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'data')
71
+ self.data = attributes[:'data']
72
+ end
73
+
74
+ if attributes.key?(:'meta')
75
+ self.meta = attributes[:'meta']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ data == o.data &&
100
+ meta == o.meta
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [data, meta].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ attributes = attributes.transform_keys(&:to_sym)
121
+ transformed_hash = {}
122
+ openapi_types.each_pair do |key, type|
123
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = nil
125
+ elsif type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[attribute_map[key]].is_a?(Array)
129
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
130
+ end
131
+ elsif !attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
133
+ end
134
+ end
135
+ new(transformed_hash)
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def self._deserialize(type, value)
143
+ case type.to_sym
144
+ when :Time
145
+ Time.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ # models (e.g. Pet) or oneOf
176
+ klass = Zyphr.const_get(type)
177
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+
229
+ end