notifo-io 1.0.1.1 → 1.0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +205 -4
  3. data/docs/AppDetailsDto.md +0 -8
  4. data/docs/AppIdMediaBody.md +7 -0
  5. data/docs/AppsApi.md +188 -2
  6. data/docs/AuthorizationApi.md +121 -0
  7. data/docs/ConfigsApi.md +1 -1
  8. data/docs/ConfiguredIntegrationDto.md +12 -0
  9. data/docs/ConfiguredIntegrationsDto.md +8 -0
  10. data/docs/CreateIntegrationDto.md +11 -0
  11. data/docs/EventDto.md +1 -0
  12. data/docs/EventsApi.md +45 -1
  13. data/docs/IntegrationCreatedDto.md +8 -0
  14. data/docs/IntegrationDefinitionDto.md +11 -0
  15. data/docs/IntegrationProperties.md +6 -0
  16. data/docs/IntegrationPropertyDto.md +17 -0
  17. data/docs/IntegrationPropertyType.md +6 -0
  18. data/docs/IntegrationStatus.md +6 -0
  19. data/docs/ListResponseDtoOfMobilePushTokenDto.md +8 -0
  20. data/docs/ListResponseDtoOfNotificationDto.md +8 -0
  21. data/docs/LogsApi.md +1 -1
  22. data/docs/MediaApi.md +1 -1
  23. data/docs/MobileDeviceType.md +6 -0
  24. data/docs/MobilePushApi.md +135 -0
  25. data/docs/MobilePushTokenDto.md +8 -0
  26. data/docs/NotificationDto.md +21 -0
  27. data/docs/NotificationsApi.md +141 -0
  28. data/docs/PublishDto.md +2 -0
  29. data/docs/RegisterMobileTokenDto.md +8 -0
  30. data/docs/TemplatesApi.md +1 -1
  31. data/docs/TopicsApi.md +1 -1
  32. data/docs/TrackNotificationDto.md +10 -0
  33. data/docs/UpdateIntegrationDto.md +10 -0
  34. data/docs/UpsertUserDto.md +1 -0
  35. data/docs/UserApi.md +1 -1
  36. data/docs/UserDto.md +3 -0
  37. data/docs/UserInfoApi.md +83 -0
  38. data/docs/UsersApi.md +1 -1
  39. data/lib/notifo.rb +23 -3
  40. data/lib/notifo/api/apps_api.rb +246 -2
  41. data/lib/notifo/api/authorization_api.rb +158 -0
  42. data/lib/notifo/api/configs_api.rb +1 -1
  43. data/lib/notifo/api/events_api.rb +57 -1
  44. data/lib/notifo/api/logs_api.rb +1 -1
  45. data/lib/notifo/api/media_api.rb +1 -1
  46. data/lib/notifo/api/mobile_push_api.rb +178 -0
  47. data/lib/notifo/api/notifications_api.rb +181 -0
  48. data/lib/notifo/api/templates_api.rb +1 -1
  49. data/lib/notifo/api/topics_api.rb +1 -1
  50. data/lib/notifo/api/user_api.rb +1 -1
  51. data/lib/notifo/api/user_info_api.rb +112 -0
  52. data/lib/notifo/api/users_api.rb +1 -1
  53. data/lib/notifo/api_client.rb +1 -1
  54. data/lib/notifo/api_error.rb +1 -1
  55. data/lib/notifo/configuration.rb +3 -3
  56. data/lib/notifo/models/add_allowed_topic_dto.rb +1 -1
  57. data/lib/notifo/models/add_contributor_dto.rb +1 -1
  58. data/lib/notifo/models/app_contributor_dto.rb +1 -1
  59. data/lib/notifo/models/app_details_dto.rb +3 -96
  60. data/lib/notifo/models/app_dto.rb +1 -1
  61. data/lib/notifo/models/app_id_media_body.rb +207 -0
  62. data/lib/notifo/models/configured_integration_dto.rb +271 -0
  63. data/lib/notifo/models/configured_integrations_dto.rb +231 -0
  64. data/lib/notifo/models/confirm_mode.rb +1 -1
  65. data/lib/notifo/models/create_email_template_dto.rb +1 -1
  66. data/lib/notifo/models/create_integration_dto.rb +257 -0
  67. data/lib/notifo/models/email_template_dto.rb +2 -1
  68. data/lib/notifo/models/email_templates_dto.rb +1 -1
  69. data/lib/notifo/models/error_dto.rb +5 -1
  70. data/lib/notifo/models/event_dto.rb +18 -5
  71. data/lib/notifo/models/event_properties.rb +1 -1
  72. data/lib/notifo/models/integration_created_dto.rb +226 -0
  73. data/lib/notifo/models/integration_definition_dto.rb +272 -0
  74. data/lib/notifo/models/integration_properties.rb +201 -0
  75. data/lib/notifo/models/integration_property_dto.rb +319 -0
  76. data/lib/notifo/models/integration_property_type.rb +31 -0
  77. data/lib/notifo/models/integration_status.rb +29 -0
  78. data/lib/notifo/models/iso_day_of_week.rb +1 -1
  79. data/lib/notifo/models/list_response_dto_of_event_dto.rb +1 -1
  80. data/lib/notifo/models/list_response_dto_of_log_entry_dto.rb +1 -1
  81. data/lib/notifo/models/list_response_dto_of_media_dto.rb +1 -1
  82. data/lib/notifo/models/list_response_dto_of_mobile_push_token_dto.rb +229 -0
  83. data/lib/notifo/models/list_response_dto_of_notification_dto.rb +229 -0
  84. data/lib/notifo/models/list_response_dto_of_subscription_dto.rb +1 -1
  85. data/lib/notifo/models/list_response_dto_of_template_dto.rb +1 -1
  86. data/lib/notifo/models/list_response_dto_of_topic_dto.rb +1 -1
  87. data/lib/notifo/models/list_response_dto_of_user_dto.rb +1 -1
  88. data/lib/notifo/models/localized_text.rb +1 -1
  89. data/lib/notifo/models/log_entry_dto.rb +1 -1
  90. data/lib/notifo/models/media_dto.rb +1 -1
  91. data/lib/notifo/models/media_metadata.rb +1 -1
  92. data/lib/notifo/models/media_type.rb +1 -1
  93. data/lib/notifo/models/mobile_device_type.rb +29 -0
  94. data/lib/notifo/models/mobile_push_token_dto.rb +221 -0
  95. data/lib/notifo/models/notification_dto.rb +386 -0
  96. data/lib/notifo/models/notification_formatting_dto.rb +1 -1
  97. data/lib/notifo/models/notification_send.rb +1 -1
  98. data/lib/notifo/models/notification_setting_dto.rb +2 -1
  99. data/lib/notifo/models/profile_dto.rb +4 -1
  100. data/lib/notifo/models/publish_dto.rb +30 -5
  101. data/lib/notifo/models/publish_many_dto.rb +1 -1
  102. data/lib/notifo/models/register_mobile_token_dto.rb +221 -0
  103. data/lib/notifo/models/resize_mode.rb +1 -1
  104. data/lib/notifo/models/scheduling_dto.rb +2 -1
  105. data/lib/notifo/models/scheduling_type.rb +1 -1
  106. data/lib/notifo/models/subscription_dto.rb +2 -1
  107. data/lib/notifo/models/template_dto.rb +1 -1
  108. data/lib/notifo/models/topic_dto.rb +1 -1
  109. data/lib/notifo/models/track_notification_dto.rb +243 -0
  110. data/lib/notifo/models/update_integration_dto.rb +242 -0
  111. data/lib/notifo/models/update_profile_dto.rb +7 -1
  112. data/lib/notifo/models/upsert_app_dto.rb +11 -1
  113. data/lib/notifo/models/upsert_template_dto.rb +2 -1
  114. data/lib/notifo/models/upsert_templates_dto.rb +1 -1
  115. data/lib/notifo/models/upsert_user_dto.rb +21 -2
  116. data/lib/notifo/models/upsert_users_dto.rb +1 -1
  117. data/lib/notifo/models/user_dto.rb +48 -2
  118. data/lib/notifo/version.rb +1 -1
  119. data/notifo-io-1.0.1.1.gem +0 -0
  120. data/notifo.gemspec +2 -2
  121. data/spec/api/authorization_api_spec.rb +61 -0
  122. data/spec/api/mobile_push_api_spec.rb +66 -0
  123. data/spec/api/notifications_api_spec.rb +68 -0
  124. data/spec/api/user_info_api_spec.rb +52 -0
  125. data/spec/models/app_id_media_body_spec.rb +40 -0
  126. data/spec/models/configured_integration_dto_spec.rb +70 -0
  127. data/spec/models/configured_integrations_dto_spec.rb +46 -0
  128. data/spec/models/create_integration_dto_spec.rb +64 -0
  129. data/spec/models/integration_created_dto_spec.rb +46 -0
  130. data/spec/models/integration_definition_dto_spec.rb +64 -0
  131. data/spec/models/integration_properties_spec.rb +34 -0
  132. data/spec/models/integration_property_dto_spec.rb +100 -0
  133. data/spec/models/integration_property_type_spec.rb +34 -0
  134. data/spec/models/integration_status_spec.rb +34 -0
  135. data/spec/models/list_response_dto_of_mobile_push_token_dto_spec.rb +46 -0
  136. data/spec/models/list_response_dto_of_notification_dto_spec.rb +46 -0
  137. data/spec/models/mobile_device_type_spec.rb +34 -0
  138. data/spec/models/mobile_push_token_dto_spec.rb +46 -0
  139. data/spec/models/notification_dto_spec.rb +124 -0
  140. data/spec/models/register_mobile_token_dto_spec.rb +46 -0
  141. data/spec/models/track_notification_dto_spec.rb +58 -0
  142. data/spec/models/update_integration_dto_spec.rb +58 -0
  143. metadata +91 -2
@@ -0,0 +1,271 @@
1
+ =begin
2
+ #Notifo API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.26
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module Notifo
15
+ class ConfiguredIntegrationDto
16
+ # The integration type.
17
+ attr_accessor :type
18
+
19
+ attr_accessor :properties
20
+
21
+ # True when enabled.
22
+ attr_accessor :enabled
23
+
24
+ # True or false when only used for test or production mode.
25
+ attr_accessor :test
26
+
27
+ # The priority in which order the integrations must run.
28
+ attr_accessor :priority
29
+
30
+ attr_accessor :status
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'type' => :'type',
36
+ :'properties' => :'properties',
37
+ :'enabled' => :'enabled',
38
+ :'test' => :'test',
39
+ :'priority' => :'priority',
40
+ :'status' => :'status'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'type' => :'Object',
48
+ :'properties' => :'Object',
49
+ :'enabled' => :'Object',
50
+ :'test' => :'Object',
51
+ :'priority' => :'Object',
52
+ :'status' => :'Object'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ :'test',
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Notifo::ConfiguredIntegrationDto` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Notifo::ConfiguredIntegrationDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'type')
79
+ self.type = attributes[:'type']
80
+ end
81
+
82
+ if attributes.key?(:'properties')
83
+ self.properties = attributes[:'properties']
84
+ end
85
+
86
+ if attributes.key?(:'enabled')
87
+ self.enabled = attributes[:'enabled']
88
+ end
89
+
90
+ if attributes.key?(:'test')
91
+ self.test = attributes[:'test']
92
+ end
93
+
94
+ if attributes.key?(:'priority')
95
+ self.priority = attributes[:'priority']
96
+ end
97
+
98
+ if attributes.key?(:'status')
99
+ self.status = attributes[:'status']
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
+ invalid_properties = Array.new
107
+ if @type.nil?
108
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
109
+ end
110
+
111
+ if @properties.nil?
112
+ invalid_properties.push('invalid value for "properties", properties cannot be nil.')
113
+ end
114
+
115
+ if @status.nil?
116
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
117
+ end
118
+
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ return false if @type.nil?
126
+ return false if @properties.nil?
127
+ return false if @status.nil?
128
+ true
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ type == o.type &&
137
+ properties == o.properties &&
138
+ enabled == o.enabled &&
139
+ test == o.test &&
140
+ priority == o.priority &&
141
+ status == o.status
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [type, properties, enabled, test, priority, status].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ self.class.openapi_types.each_pair do |key, type|
169
+ if type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
178
+ self.send("#{key}=", nil)
179
+ end
180
+ end
181
+
182
+ self
183
+ end
184
+
185
+ # Deserializes the data based on type
186
+ # @param string type Data type
187
+ # @param string value Value to be deserialized
188
+ # @return [Object] Deserialized data
189
+ def _deserialize(type, value)
190
+ case type.to_sym
191
+ when :DateTime
192
+ DateTime.parse(value)
193
+ when :Date
194
+ Date.parse(value)
195
+ when :String
196
+ value.to_s
197
+ when :Integer
198
+ value.to_i
199
+ when :Float
200
+ value.to_f
201
+ when :Boolean
202
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
+ true
204
+ else
205
+ false
206
+ end
207
+ when :Object
208
+ # generic object (usually a Hash), return directly
209
+ value
210
+ when /\AArray<(?<inner_type>.+)>\z/
211
+ inner_type = Regexp.last_match[:inner_type]
212
+ value.map { |v| _deserialize(inner_type, v) }
213
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
+ k_type = Regexp.last_match[:k_type]
215
+ v_type = Regexp.last_match[:v_type]
216
+ {}.tap do |hash|
217
+ value.each do |k, v|
218
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
+ end
220
+ end
221
+ else # model
222
+ Notifo.const_get(type).build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end end
271
+ end
@@ -0,0 +1,231 @@
1
+ =begin
2
+ #Notifo API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.26
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module Notifo
15
+ class ConfiguredIntegrationsDto
16
+ # The configured integrations.
17
+ attr_accessor :configured
18
+
19
+ # The supported integrations.
20
+ attr_accessor :supported
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'configured' => :'configured',
26
+ :'supported' => :'supported'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'configured' => :'Object',
34
+ :'supported' => :'Object'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Notifo::ConfiguredIntegrationsDto` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Notifo::ConfiguredIntegrationsDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'configured')
60
+ if (value = attributes[:'configured']).is_a?(Hash)
61
+ self.configured = value
62
+ end
63
+ end
64
+
65
+ if attributes.key?(:'supported')
66
+ if (value = attributes[:'supported']).is_a?(Hash)
67
+ self.supported = value
68
+ end
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ if @configured.nil?
77
+ invalid_properties.push('invalid value for "configured", configured cannot be nil.')
78
+ end
79
+
80
+ if @supported.nil?
81
+ invalid_properties.push('invalid value for "supported", supported cannot be nil.')
82
+ end
83
+
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
+ return false if @configured.nil?
91
+ return false if @supported.nil?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ configured == o.configured &&
101
+ supported == o.supported
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [configured, supported].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.openapi_types.each_pair do |key, type|
129
+ if type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
138
+ self.send("#{key}=", nil)
139
+ end
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :DateTime
152
+ DateTime.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ Notifo.const_get(type).build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end end
231
+ end