notifo-io 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +163 -0
  4. data/Rakefile +10 -0
  5. data/docs/AddAllowedTopicRequest.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/InlineObject.md +18 -0
  20. data/docs/IsoDayOfWeek.md +15 -0
  21. data/docs/ListResponseDtoOfEventDto.md +20 -0
  22. data/docs/ListResponseDtoOfLogEntryDto.md +20 -0
  23. data/docs/ListResponseDtoOfMediaDto.md +20 -0
  24. data/docs/ListResponseDtoOfSubscriptionDto.md +20 -0
  25. data/docs/ListResponseDtoOfTemplateDto.md +20 -0
  26. data/docs/ListResponseDtoOfTopicDto.md +20 -0
  27. data/docs/ListResponseDtoOfUserDto.md +20 -0
  28. data/docs/LogEntryDto.md +24 -0
  29. data/docs/LogsApi.md +78 -0
  30. data/docs/MediaApi.md +295 -0
  31. data/docs/MediaDto.md +28 -0
  32. data/docs/MediaType.md +15 -0
  33. data/docs/NotificationFormattingDto.md +32 -0
  34. data/docs/NotificationSettingDto.md +20 -0
  35. data/docs/PublishManyRequestDto.md +18 -0
  36. data/docs/PublishRequestDto.md +36 -0
  37. data/docs/ResizeMode.md +15 -0
  38. data/docs/SchedulingDto.md +24 -0
  39. data/docs/SchedulingType.md +15 -0
  40. data/docs/SubscribeDto.md +20 -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 +270 -0
  46. data/docs/UpsertAppDto.md +36 -0
  47. data/docs/UpsertTemplateDto.md +22 -0
  48. data/docs/UpsertTemplatesDto.md +18 -0
  49. data/docs/UpsertUserDto.md +32 -0
  50. data/docs/UpsertUsersDto.md +18 -0
  51. data/docs/UserDto.md +36 -0
  52. data/docs/UsersApi.md +610 -0
  53. data/git_push.sh +58 -0
  54. data/lib/notifo.rb +87 -0
  55. data/lib/notifo/api/apps_api.rb +678 -0
  56. data/lib/notifo/api/configs_api.rb +132 -0
  57. data/lib/notifo/api/events_api.rb +161 -0
  58. data/lib/notifo/api/logs_api.rb +92 -0
  59. data/lib/notifo/api/media_api.rb +322 -0
  60. data/lib/notifo/api/templates_api.rb +228 -0
  61. data/lib/notifo/api/topics_api.rb +281 -0
  62. data/lib/notifo/api/users_api.rb +667 -0
  63. data/lib/notifo/api_client.rb +389 -0
  64. data/lib/notifo/api_error.rb +57 -0
  65. data/lib/notifo/configuration.rb +268 -0
  66. data/lib/notifo/models/add_allowed_topic_request.rb +219 -0
  67. data/lib/notifo/models/add_contributor_dto.rb +229 -0
  68. data/lib/notifo/models/app_contributor_dto.rb +239 -0
  69. data/lib/notifo/models/app_details_dto.rb +381 -0
  70. data/lib/notifo/models/app_dto.rb +273 -0
  71. data/lib/notifo/models/confirm_mode.rb +38 -0
  72. data/lib/notifo/models/create_email_template_dto.rb +219 -0
  73. data/lib/notifo/models/email_template_dto.rb +240 -0
  74. data/lib/notifo/models/email_verification_status.rb +39 -0
  75. data/lib/notifo/models/error_dto.rb +265 -0
  76. data/lib/notifo/models/event_dto.rb +333 -0
  77. data/lib/notifo/models/inline_object.rb +219 -0
  78. data/lib/notifo/models/iso_day_of_week.rb +43 -0
  79. data/lib/notifo/models/list_response_dto_of_event_dto.rb +231 -0
  80. data/lib/notifo/models/list_response_dto_of_log_entry_dto.rb +231 -0
  81. data/lib/notifo/models/list_response_dto_of_media_dto.rb +231 -0
  82. data/lib/notifo/models/list_response_dto_of_subscription_dto.rb +231 -0
  83. data/lib/notifo/models/list_response_dto_of_template_dto.rb +231 -0
  84. data/lib/notifo/models/list_response_dto_of_topic_dto.rb +231 -0
  85. data/lib/notifo/models/list_response_dto_of_user_dto.rb +231 -0
  86. data/lib/notifo/models/log_entry_dto.rb +249 -0
  87. data/lib/notifo/models/media_dto.rb +269 -0
  88. data/lib/notifo/models/media_type.rb +39 -0
  89. data/lib/notifo/models/notification_formatting_dto.rb +295 -0
  90. data/lib/notifo/models/notification_setting_dto.rb +231 -0
  91. data/lib/notifo/models/publish_many_request_dto.rb +221 -0
  92. data/lib/notifo/models/publish_request_dto.rb +315 -0
  93. data/lib/notifo/models/resize_mode.rb +42 -0
  94. data/lib/notifo/models/scheduling_dto.rb +251 -0
  95. data/lib/notifo/models/scheduling_type.rb +37 -0
  96. data/lib/notifo/models/subscribe_dto.rb +229 -0
  97. data/lib/notifo/models/subscription_dto.rb +229 -0
  98. data/lib/notifo/models/template_dto.rb +239 -0
  99. data/lib/notifo/models/topic_dto.rb +239 -0
  100. data/lib/notifo/models/upsert_app_dto.rb +321 -0
  101. data/lib/notifo/models/upsert_template_dto.rb +240 -0
  102. data/lib/notifo/models/upsert_templates_dto.rb +221 -0
  103. data/lib/notifo/models/upsert_user_dto.rb +297 -0
  104. data/lib/notifo/models/upsert_users_dto.rb +221 -0
  105. data/lib/notifo/models/user_dto.rb +309 -0
  106. data/lib/notifo/version.rb +15 -0
  107. data/notifo-io-1.0.0.gem +0 -0
  108. data/notifo-io-1.0.0.pre.beta.gem +0 -0
  109. data/notifo.gemspec +38 -0
  110. data/spec/api/apps_api_spec.rb +151 -0
  111. data/spec/api/configs_api_spec.rb +55 -0
  112. data/spec/api/events_api_spec.rb +61 -0
  113. data/spec/api/logs_api_spec.rb +49 -0
  114. data/spec/api/media_api_spec.rb +95 -0
  115. data/spec/api/templates_api_spec.rb +73 -0
  116. data/spec/api/topics_api_spec.rb +85 -0
  117. data/spec/api/users_api_spec.rb +152 -0
  118. data/spec/api_client_spec.rb +226 -0
  119. data/spec/configuration_spec.rb +42 -0
  120. data/spec/models/add_allowed_topic_request_spec.rb +34 -0
  121. data/spec/models/add_contributor_dto_spec.rb +40 -0
  122. data/spec/models/app_contributor_dto_spec.rb +46 -0
  123. data/spec/models/app_details_dto_spec.rb +124 -0
  124. data/spec/models/app_dto_spec.rb +64 -0
  125. data/spec/models/confirm_mode_spec.rb +28 -0
  126. data/spec/models/create_email_template_dto_spec.rb +34 -0
  127. data/spec/models/email_template_dto_spec.rb +46 -0
  128. data/spec/models/email_verification_status_spec.rb +28 -0
  129. data/spec/models/error_dto_spec.rb +58 -0
  130. data/spec/models/event_dto_spec.rb +100 -0
  131. data/spec/models/inline_object_spec.rb +34 -0
  132. data/spec/models/iso_day_of_week_spec.rb +28 -0
  133. data/spec/models/list_response_dto_of_event_dto_spec.rb +40 -0
  134. data/spec/models/list_response_dto_of_log_entry_dto_spec.rb +40 -0
  135. data/spec/models/list_response_dto_of_media_dto_spec.rb +40 -0
  136. data/spec/models/list_response_dto_of_subscription_dto_spec.rb +40 -0
  137. data/spec/models/list_response_dto_of_template_dto_spec.rb +40 -0
  138. data/spec/models/list_response_dto_of_topic_dto_spec.rb +40 -0
  139. data/spec/models/list_response_dto_of_user_dto_spec.rb +40 -0
  140. data/spec/models/log_entry_dto_spec.rb +52 -0
  141. data/spec/models/media_dto_spec.rb +64 -0
  142. data/spec/models/media_type_spec.rb +28 -0
  143. data/spec/models/notification_formatting_dto_spec.rb +76 -0
  144. data/spec/models/notification_setting_dto_spec.rb +40 -0
  145. data/spec/models/publish_many_request_dto_spec.rb +34 -0
  146. data/spec/models/publish_request_dto_spec.rb +88 -0
  147. data/spec/models/resize_mode_spec.rb +28 -0
  148. data/spec/models/scheduling_dto_spec.rb +52 -0
  149. data/spec/models/scheduling_type_spec.rb +28 -0
  150. data/spec/models/subscribe_dto_spec.rb +40 -0
  151. data/spec/models/subscription_dto_spec.rb +40 -0
  152. data/spec/models/template_dto_spec.rb +46 -0
  153. data/spec/models/topic_dto_spec.rb +46 -0
  154. data/spec/models/upsert_app_dto_spec.rb +88 -0
  155. data/spec/models/upsert_template_dto_spec.rb +46 -0
  156. data/spec/models/upsert_templates_dto_spec.rb +34 -0
  157. data/spec/models/upsert_user_dto_spec.rb +76 -0
  158. data/spec/models/upsert_users_dto_spec.rb +34 -0
  159. data/spec/models/user_dto_spec.rb +88 -0
  160. data/spec/spec_helper.rb +111 -0
  161. metadata +294 -0
@@ -0,0 +1,240 @@
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.0.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
+ # The formatting.
22
+ attr_accessor :formatting
23
+
24
+ # Notification settings per channel.
25
+ attr_accessor :settings
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'code' => :'code',
31
+ :'formatting' => :'formatting',
32
+ :'settings' => :'settings'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'code' => :'String',
45
+ :'formatting' => :'OneOfNotificationFormattingDto',
46
+ :'settings' => :'OneOfmap'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ :'settings'
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Notifo::UpsertTemplateDto` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ 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
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'code')
73
+ self.code = attributes[:'code']
74
+ end
75
+
76
+ if attributes.key?(:'formatting')
77
+ self.formatting = attributes[:'formatting']
78
+ end
79
+
80
+ if attributes.key?(:'settings')
81
+ self.settings = attributes[:'settings']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ code == o.code &&
104
+ formatting == o.formatting &&
105
+ settings == o.settings
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [code, formatting, settings].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
+ self.send("#{key}=", nil)
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = Notifo.const_get(type)
188
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end
@@ -0,0 +1,221 @@
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.0.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
+ invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ requests == o.requests
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [requests].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ new.build_from_hash(attributes)
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
+ self.send("#{key}=", nil)
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = Notifo.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end