notifo-io-easierlife 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +167 -0
  4. data/Rakefile +10 -0
  5. data/docs/AddAllowedTopicDto.md +18 -0
  6. data/docs/AddContributorDto.md +20 -0
  7. data/docs/AppContributorDto.md +22 -0
  8. data/docs/AppDetailsDto.md +48 -0
  9. data/docs/AppDto.md +28 -0
  10. data/docs/AppsApi.md +646 -0
  11. data/docs/ConfigsApi.md +127 -0
  12. data/docs/ConfirmMode.md +15 -0
  13. data/docs/CreateEmailTemplateDto.md +18 -0
  14. data/docs/EmailTemplateDto.md +22 -0
  15. data/docs/EmailVerificationStatus.md +15 -0
  16. data/docs/ErrorDto.md +26 -0
  17. data/docs/EventDto.md +40 -0
  18. data/docs/EventsApi.md +142 -0
  19. data/docs/IsoDayOfWeek.md +15 -0
  20. data/docs/ListResponseDtoOfEventDto.md +20 -0
  21. data/docs/ListResponseDtoOfLogEntryDto.md +20 -0
  22. data/docs/ListResponseDtoOfMediaDto.md +20 -0
  23. data/docs/ListResponseDtoOfSubscriptionDto.md +20 -0
  24. data/docs/ListResponseDtoOfTemplateDto.md +20 -0
  25. data/docs/ListResponseDtoOfTopicDto.md +20 -0
  26. data/docs/ListResponseDtoOfUserDto.md +20 -0
  27. data/docs/LogEntryDto.md +24 -0
  28. data/docs/LogsApi.md +78 -0
  29. data/docs/MediaApi.md +382 -0
  30. data/docs/MediaDto.md +30 -0
  31. data/docs/MediaType.md +15 -0
  32. data/docs/NotificationFormattingDto.md +32 -0
  33. data/docs/NotificationSend.md +15 -0
  34. data/docs/NotificationSettingDto.md +20 -0
  35. data/docs/ProfileDto.md +32 -0
  36. data/docs/PublishDto.md +36 -0
  37. data/docs/PublishManyDto.md +18 -0
  38. data/docs/ResizeMode.md +15 -0
  39. data/docs/SchedulingDto.md +24 -0
  40. data/docs/SchedulingType.md +15 -0
  41. data/docs/SubscriptionDto.md +20 -0
  42. data/docs/TemplateDto.md +22 -0
  43. data/docs/TemplatesApi.md +208 -0
  44. data/docs/TopicDto.md +22 -0
  45. data/docs/TopicsApi.md +78 -0
  46. data/docs/UpdateProfileDto.md +28 -0
  47. data/docs/UpsertAppDto.md +36 -0
  48. data/docs/UpsertTemplateDto.md +22 -0
  49. data/docs/UpsertTemplatesDto.md +18 -0
  50. data/docs/UpsertUserDto.md +32 -0
  51. data/docs/UpsertUsersDto.md +18 -0
  52. data/docs/UserApi.md +323 -0
  53. data/docs/UserDto.md +36 -0
  54. data/docs/UsersApi.md +610 -0
  55. data/git_push.sh +58 -0
  56. data/lib/notifo.rb +89 -0
  57. data/lib/notifo/api/apps_api.rb +678 -0
  58. data/lib/notifo/api/configs_api.rb +132 -0
  59. data/lib/notifo/api/events_api.rb +161 -0
  60. data/lib/notifo/api/logs_api.rb +92 -0
  61. data/lib/notifo/api/media_api.rb +419 -0
  62. data/lib/notifo/api/templates_api.rb +228 -0
  63. data/lib/notifo/api/topics_api.rb +92 -0
  64. data/lib/notifo/api/user_api.rb +331 -0
  65. data/lib/notifo/api/users_api.rb +667 -0
  66. data/lib/notifo/api_client.rb +389 -0
  67. data/lib/notifo/api_error.rb +57 -0
  68. data/lib/notifo/configuration.rb +270 -0
  69. data/lib/notifo/models/add_allowed_topic_dto.rb +243 -0
  70. data/lib/notifo/models/add_contributor_dto.rb +277 -0
  71. data/lib/notifo/models/app_contributor_dto.rb +311 -0
  72. data/lib/notifo/models/app_details_dto.rb +489 -0
  73. data/lib/notifo/models/app_dto.rb +362 -0
  74. data/lib/notifo/models/confirm_mode.rb +38 -0
  75. data/lib/notifo/models/create_email_template_dto.rb +243 -0
  76. data/lib/notifo/models/email_template_dto.rb +288 -0
  77. data/lib/notifo/models/email_verification_status.rb +39 -0
  78. data/lib/notifo/models/error_dto.rb +265 -0
  79. data/lib/notifo/models/event_dto.rb +456 -0
  80. data/lib/notifo/models/iso_day_of_week.rb +43 -0
  81. data/lib/notifo/models/list_response_dto_of_event_dto.rb +241 -0
  82. data/lib/notifo/models/list_response_dto_of_log_entry_dto.rb +241 -0
  83. data/lib/notifo/models/list_response_dto_of_media_dto.rb +241 -0
  84. data/lib/notifo/models/list_response_dto_of_subscription_dto.rb +241 -0
  85. data/lib/notifo/models/list_response_dto_of_template_dto.rb +241 -0
  86. data/lib/notifo/models/list_response_dto_of_topic_dto.rb +241 -0
  87. data/lib/notifo/models/list_response_dto_of_user_dto.rb +241 -0
  88. data/lib/notifo/models/log_entry_dto.rb +326 -0
  89. data/lib/notifo/models/media_dto.rb +390 -0
  90. data/lib/notifo/models/media_type.rb +39 -0
  91. data/lib/notifo/models/notification_formatting_dto.rb +305 -0
  92. data/lib/notifo/models/notification_send.rb +39 -0
  93. data/lib/notifo/models/notification_setting_dto.rb +234 -0
  94. data/lib/notifo/models/profile_dto.rb +361 -0
  95. data/lib/notifo/models/publish_dto.rb +338 -0
  96. data/lib/notifo/models/publish_many_dto.rb +226 -0
  97. data/lib/notifo/models/resize_mode.rb +42 -0
  98. data/lib/notifo/models/scheduling_dto.rb +248 -0
  99. data/lib/notifo/models/scheduling_type.rb +37 -0
  100. data/lib/notifo/models/subscription_dto.rb +256 -0
  101. data/lib/notifo/models/template_dto.rb +274 -0
  102. data/lib/notifo/models/topic_dto.rb +294 -0
  103. data/lib/notifo/models/update_profile_dto.rb +277 -0
  104. data/lib/notifo/models/upsert_app_dto.rb +321 -0
  105. data/lib/notifo/models/upsert_template_dto.rb +270 -0
  106. data/lib/notifo/models/upsert_templates_dto.rb +226 -0
  107. data/lib/notifo/models/upsert_user_dto.rb +299 -0
  108. data/lib/notifo/models/upsert_users_dto.rb +226 -0
  109. data/lib/notifo/models/user_dto.rb +381 -0
  110. data/lib/notifo/version.rb +15 -0
  111. data/notifo-io-1.0.0.gem +0 -0
  112. data/notifo.gemspec +38 -0
  113. data/spec/api/apps_api_spec.rb +151 -0
  114. data/spec/api/configs_api_spec.rb +55 -0
  115. data/spec/api/events_api_spec.rb +61 -0
  116. data/spec/api/logs_api_spec.rb +49 -0
  117. data/spec/api/media_api_spec.rb +117 -0
  118. data/spec/api/templates_api_spec.rb +73 -0
  119. data/spec/api/topics_api_spec.rb +49 -0
  120. data/spec/api/user_api_spec.rb +92 -0
  121. data/spec/api/users_api_spec.rb +152 -0
  122. data/spec/api_client_spec.rb +226 -0
  123. data/spec/configuration_spec.rb +42 -0
  124. data/spec/models/add_allowed_topic_dto_spec.rb +34 -0
  125. data/spec/models/add_contributor_dto_spec.rb +40 -0
  126. data/spec/models/app_contributor_dto_spec.rb +46 -0
  127. data/spec/models/app_details_dto_spec.rb +124 -0
  128. data/spec/models/app_dto_spec.rb +64 -0
  129. data/spec/models/confirm_mode_spec.rb +28 -0
  130. data/spec/models/create_email_template_dto_spec.rb +34 -0
  131. data/spec/models/email_template_dto_spec.rb +46 -0
  132. data/spec/models/email_verification_status_spec.rb +28 -0
  133. data/spec/models/error_dto_spec.rb +58 -0
  134. data/spec/models/event_dto_spec.rb +100 -0
  135. data/spec/models/iso_day_of_week_spec.rb +28 -0
  136. data/spec/models/list_response_dto_of_event_dto_spec.rb +40 -0
  137. data/spec/models/list_response_dto_of_log_entry_dto_spec.rb +40 -0
  138. data/spec/models/list_response_dto_of_media_dto_spec.rb +40 -0
  139. data/spec/models/list_response_dto_of_subscription_dto_spec.rb +40 -0
  140. data/spec/models/list_response_dto_of_template_dto_spec.rb +40 -0
  141. data/spec/models/list_response_dto_of_topic_dto_spec.rb +40 -0
  142. data/spec/models/list_response_dto_of_user_dto_spec.rb +40 -0
  143. data/spec/models/log_entry_dto_spec.rb +52 -0
  144. data/spec/models/media_dto_spec.rb +70 -0
  145. data/spec/models/media_type_spec.rb +28 -0
  146. data/spec/models/notification_formatting_dto_spec.rb +76 -0
  147. data/spec/models/notification_send_spec.rb +28 -0
  148. data/spec/models/notification_setting_dto_spec.rb +40 -0
  149. data/spec/models/profile_dto_spec.rb +76 -0
  150. data/spec/models/publish_dto_spec.rb +88 -0
  151. data/spec/models/publish_many_dto_spec.rb +34 -0
  152. data/spec/models/resize_mode_spec.rb +28 -0
  153. data/spec/models/scheduling_dto_spec.rb +52 -0
  154. data/spec/models/scheduling_type_spec.rb +28 -0
  155. data/spec/models/subscription_dto_spec.rb +40 -0
  156. data/spec/models/template_dto_spec.rb +46 -0
  157. data/spec/models/topic_dto_spec.rb +46 -0
  158. data/spec/models/update_profile_dto_spec.rb +64 -0
  159. data/spec/models/upsert_app_dto_spec.rb +88 -0
  160. data/spec/models/upsert_template_dto_spec.rb +46 -0
  161. data/spec/models/upsert_templates_dto_spec.rb +34 -0
  162. data/spec/models/upsert_user_dto_spec.rb +76 -0
  163. data/spec/models/upsert_users_dto_spec.rb +34 -0
  164. data/spec/models/user_dto_spec.rb +88 -0
  165. data/spec/spec_helper.rb +111 -0
  166. metadata +301 -0
@@ -0,0 +1,270 @@
1
+ =begin
2
+ #Notifo API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Notifo
17
+ class UpsertTemplateDto
18
+ # The code of the template.
19
+ attr_accessor :code
20
+
21
+ attr_accessor :formatting
22
+
23
+ # Notification settings per channel.
24
+ attr_accessor :settings
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'code' => :'code',
30
+ :'formatting' => :'formatting',
31
+ :'settings' => :'settings'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'code' => :'String',
44
+ :'formatting' => :'NotificationFormattingDto',
45
+ :'settings' => :'Hash<String, NotificationSettingDto>'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ :'settings'
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Notifo::UpsertTemplateDto` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Notifo::UpsertTemplateDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'code')
72
+ self.code = attributes[:'code']
73
+ end
74
+
75
+ if attributes.key?(:'formatting')
76
+ self.formatting = attributes[:'formatting']
77
+ end
78
+
79
+ if attributes.key?(:'settings')
80
+ if (value = attributes[:'settings']).is_a?(Hash)
81
+ self.settings = value
82
+ end
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ if @code.nil?
91
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
92
+ end
93
+
94
+ if @code.to_s.length < 1
95
+ invalid_properties.push('invalid value for "code", the character length must be great than or equal to 1.')
96
+ end
97
+
98
+ if @formatting.nil?
99
+ invalid_properties.push('invalid value for "formatting", formatting cannot be nil.')
100
+ end
101
+
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ return false if @code.nil?
109
+ return false if @code.to_s.length < 1
110
+ return false if @formatting.nil?
111
+ true
112
+ end
113
+
114
+ # Custom attribute writer method with validation
115
+ # @param [Object] code Value to be assigned
116
+ def code=(code)
117
+ if code.nil?
118
+ fail ArgumentError, 'code cannot be nil'
119
+ end
120
+
121
+ if code.to_s.length < 1
122
+ fail ArgumentError, 'invalid value for "code", the character length must be great than or equal to 1.'
123
+ end
124
+
125
+ @code = code
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ code == o.code &&
134
+ formatting == o.formatting &&
135
+ settings == o.settings
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Integer] Hash code
146
+ def hash
147
+ [code, formatting, settings].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def self.build_from_hash(attributes)
154
+ new.build_from_hash(attributes)
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
164
+ self.send("#{key}=", nil)
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :Time
186
+ Time.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ # models (e.g. Pet) or oneOf
217
+ klass = Notifo.const_get(type)
218
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ end
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #Notifo API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Notifo
17
+ class UpsertTemplatesDto
18
+ # The templates to update.
19
+ attr_accessor :requests
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'requests' => :'requests'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'requests' => :'Array<UpsertTemplateDto>'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Notifo::UpsertTemplatesDto` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Notifo::UpsertTemplatesDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'requests')
62
+ if (value = attributes[:'requests']).is_a?(Array)
63
+ self.requests = value
64
+ end
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if @requests.nil?
73
+ invalid_properties.push('invalid value for "requests", requests cannot be nil.')
74
+ end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ return false if @requests.nil?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ requests == o.requests
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [requests].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
120
+ self.send("#{key}=", nil)
121
+ elsif type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ end
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def _deserialize(type, value)
140
+ case type.to_sym
141
+ when :Time
142
+ Time.parse(value)
143
+ when :Date
144
+ Date.parse(value)
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :Boolean
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+ when :Object
158
+ # generic object (usually a Hash), return directly
159
+ value
160
+ when /\AArray<(?<inner_type>.+)>\z/
161
+ inner_type = Regexp.last_match[:inner_type]
162
+ value.map { |v| _deserialize(inner_type, v) }
163
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
+ k_type = Regexp.last_match[:k_type]
165
+ v_type = Regexp.last_match[:v_type]
166
+ {}.tap do |hash|
167
+ value.each do |k, v|
168
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
+ end
170
+ end
171
+ else # model
172
+ # models (e.g. Pet) or oneOf
173
+ klass = Notifo.const_get(type)
174
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ if value.nil?
197
+ is_nullable = self.class.openapi_nullable.include?(attr)
198
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
199
+ end
200
+
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map { |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+
224
+ end
225
+
226
+ end