notifo-io 1.0.0.pre → 1.0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +726 -19
  3. data/Rakefile +0 -2
  4. data/docs/AddAllowedTopicDto.md +7 -0
  5. data/docs/AddContributorDto.md +4 -16
  6. data/docs/AppContributorDto.md +5 -18
  7. data/docs/AppDetailsDto.md +10 -44
  8. data/docs/AppDto.md +8 -24
  9. data/docs/AppIdMediaBody.md +7 -0
  10. data/docs/AppsApi.md +301 -297
  11. data/docs/AuthorizationApi.md +121 -0
  12. data/docs/Body.md +7 -0
  13. data/docs/ConfigsApi.md +21 -61
  14. data/docs/ConfiguredIntegrationDto.md +12 -0
  15. data/docs/ConfiguredIntegrationsDto.md +8 -0
  16. data/docs/ConfirmMode.md +2 -11
  17. data/docs/CreateEmailTemplateDto.md +3 -14
  18. data/docs/CreateIntegrationDto.md +11 -0
  19. data/docs/EmailTemplateDto.md +5 -18
  20. data/docs/EmailTemplatesDto.md +6 -0
  21. data/docs/EmailVerificationStatus.md +2 -11
  22. data/docs/ErrorDto.md +7 -22
  23. data/docs/EventDto.md +15 -36
  24. data/docs/EventProperties.md +6 -0
  25. data/docs/EventsApi.md +72 -65
  26. data/docs/IntegrationCreatedDto.md +8 -0
  27. data/docs/IntegrationDefinitionDto.md +11 -0
  28. data/docs/IntegrationProperties.md +6 -0
  29. data/docs/IntegrationPropertyDto.md +17 -0
  30. data/docs/IntegrationPropertyType.md +6 -0
  31. data/docs/IntegrationStatus.md +6 -0
  32. data/docs/IsoDayOfWeek.md +2 -11
  33. data/docs/ListResponseDtoOfEventDto.md +4 -16
  34. data/docs/ListResponseDtoOfLogEntryDto.md +4 -16
  35. data/docs/ListResponseDtoOfMediaDto.md +4 -16
  36. data/docs/ListResponseDtoOfMobilePushTokenDto.md +8 -0
  37. data/docs/ListResponseDtoOfNotificationDto.md +8 -0
  38. data/docs/ListResponseDtoOfSubscriptionDto.md +4 -16
  39. data/docs/ListResponseDtoOfTemplateDto.md +4 -16
  40. data/docs/ListResponseDtoOfTopicDto.md +4 -16
  41. data/docs/ListResponseDtoOfUserDto.md +4 -16
  42. data/docs/LocalizedText.md +6 -0
  43. data/docs/LogEntryDto.md +6 -20
  44. data/docs/LogsApi.md +21 -40
  45. data/docs/MediaApi.md +134 -141
  46. data/docs/MediaDto.md +9 -24
  47. data/docs/MediaMetadata.md +6 -0
  48. data/docs/MediaType.md +2 -11
  49. data/docs/MobileDeviceType.md +6 -0
  50. data/docs/MobilePushApi.md +135 -0
  51. data/docs/MobilePushTokenDto.md +8 -0
  52. data/docs/NotificationDto.md +21 -0
  53. data/docs/NotificationFormattingDto.md +10 -28
  54. data/docs/NotificationSend.md +6 -0
  55. data/docs/NotificationSettingDto.md +4 -16
  56. data/docs/NotificationsApi.md +141 -0
  57. data/docs/ProfileDto.md +14 -0
  58. data/docs/PublishDto.md +18 -0
  59. data/docs/PublishManyDto.md +7 -0
  60. data/docs/RegisterMobileTokenDto.md +8 -0
  61. data/docs/ResizeMode.md +2 -11
  62. data/docs/SchedulingDto.md +6 -20
  63. data/docs/SchedulingType.md +2 -11
  64. data/docs/SubscriptionDto.md +4 -16
  65. data/docs/TemplateDto.md +5 -18
  66. data/docs/TemplatesApi.md +51 -106
  67. data/docs/TopicDto.md +5 -18
  68. data/docs/TopicsApi.md +19 -230
  69. data/docs/TrackNotificationDto.md +10 -0
  70. data/docs/UpdateIntegrationDto.md +10 -0
  71. data/docs/UpdateProfileDto.md +12 -0
  72. data/docs/UpsertAppDto.md +12 -32
  73. data/docs/UpsertTemplateDto.md +5 -18
  74. data/docs/UpsertTemplatesDto.md +3 -14
  75. data/docs/UpsertUserDto.md +11 -28
  76. data/docs/UpsertUsersDto.md +3 -14
  77. data/docs/UserApi.md +231 -0
  78. data/docs/UserDto.md +15 -32
  79. data/docs/UserInfoApi.md +83 -0
  80. data/docs/UsersApi.md +144 -308
  81. data/git_push.sh +7 -10
  82. data/lib/notifo.rb +37 -11
  83. data/lib/notifo/api/apps_api.rb +373 -201
  84. data/lib/notifo/api/authorization_api.rb +158 -0
  85. data/lib/notifo/api/configs_api.rb +14 -30
  86. data/lib/notifo/api/events_api.rb +85 -45
  87. data/lib/notifo/api/logs_api.rb +12 -21
  88. data/lib/notifo/api/media_api.rb +137 -77
  89. data/lib/notifo/api/mobile_push_api.rb +178 -0
  90. data/lib/notifo/api/notifications_api.rb +181 -0
  91. data/lib/notifo/api/templates_api.rb +39 -62
  92. data/lib/notifo/api/topics_api.rb +12 -210
  93. data/lib/notifo/api/user_api.rb +294 -0
  94. data/lib/notifo/api/user_info_api.rb +112 -0
  95. data/lib/notifo/api/users_api.rb +121 -186
  96. data/lib/notifo/api_client.rb +53 -55
  97. data/lib/notifo/api_error.rb +5 -5
  98. data/lib/notifo/configuration.rb +8 -78
  99. data/lib/notifo/models/{add_allowed_topic_request.rb → add_allowed_topic_dto.rb} +21 -28
  100. data/lib/notifo/models/add_contributor_dto.rb +24 -26
  101. data/lib/notifo/models/app_contributor_dto.rb +30 -27
  102. data/lib/notifo/models/app_details_dto.rb +59 -119
  103. data/lib/notifo/models/app_dto.rb +51 -31
  104. data/lib/notifo/models/{inline_object.rb → app_id_media_body.rb} +16 -28
  105. data/lib/notifo/models/body.rb +206 -0
  106. data/lib/notifo/models/configured_integration_dto.rb +271 -0
  107. data/lib/notifo/models/configured_integrations_dto.rb +231 -0
  108. data/lib/notifo/models/confirm_mode.rb +7 -16
  109. data/lib/notifo/models/create_email_template_dto.rb +18 -25
  110. data/lib/notifo/models/create_integration_dto.rb +257 -0
  111. data/lib/notifo/models/email_template_dto.rb +25 -27
  112. data/lib/notifo/models/email_templates_dto.rb +201 -0
  113. data/lib/notifo/models/email_verification_status.rb +8 -17
  114. data/lib/notifo/models/error_dto.rb +17 -29
  115. data/lib/notifo/models/event_dto.rb +92 -46
  116. data/lib/notifo/models/event_properties.rb +201 -0
  117. data/lib/notifo/models/{subscribe_dto.rb → integration_created_dto.rb} +39 -42
  118. data/lib/notifo/models/integration_definition_dto.rb +272 -0
  119. data/lib/notifo/models/integration_properties.rb +201 -0
  120. data/lib/notifo/models/integration_property_dto.rb +319 -0
  121. data/lib/notifo/models/integration_property_type.rb +31 -0
  122. data/lib/notifo/models/integration_status.rb +29 -0
  123. data/lib/notifo/models/iso_day_of_week.rb +12 -21
  124. data/lib/notifo/models/list_response_dto_of_event_dto.rb +24 -26
  125. data/lib/notifo/models/list_response_dto_of_log_entry_dto.rb +24 -26
  126. data/lib/notifo/models/list_response_dto_of_media_dto.rb +24 -26
  127. data/lib/notifo/models/list_response_dto_of_mobile_push_token_dto.rb +229 -0
  128. data/lib/notifo/models/list_response_dto_of_notification_dto.rb +229 -0
  129. data/lib/notifo/models/list_response_dto_of_subscription_dto.rb +24 -26
  130. data/lib/notifo/models/list_response_dto_of_template_dto.rb +24 -26
  131. data/lib/notifo/models/list_response_dto_of_topic_dto.rb +24 -26
  132. data/lib/notifo/models/list_response_dto_of_user_dto.rb +24 -26
  133. data/lib/notifo/models/localized_text.rb +201 -0
  134. data/lib/notifo/models/log_entry_dto.rb +36 -28
  135. data/lib/notifo/models/media_dto.rb +64 -33
  136. data/lib/notifo/models/media_metadata.rb +201 -0
  137. data/lib/notifo/models/media_type.rb +8 -17
  138. data/lib/notifo/models/mobile_device_type.rb +29 -0
  139. data/lib/notifo/models/mobile_push_token_dto.rb +221 -0
  140. data/lib/notifo/models/notification_dto.rb +386 -0
  141. data/lib/notifo/models/notification_formatting_dto.rb +30 -46
  142. data/lib/notifo/models/notification_send.rb +30 -0
  143. data/lib/notifo/models/notification_setting_dto.rb +25 -34
  144. data/lib/notifo/models/profile_dto.rb +311 -0
  145. data/lib/notifo/models/{publish_request_dto.rb → publish_dto.rb} +55 -44
  146. data/lib/notifo/models/{publish_many_request_dto.rb → publish_many_dto.rb} +21 -28
  147. data/lib/notifo/models/register_mobile_token_dto.rb +221 -0
  148. data/lib/notifo/models/resize_mode.rb +11 -20
  149. data/lib/notifo/models/scheduling_dto.rb +16 -31
  150. data/lib/notifo/models/scheduling_type.rb +6 -15
  151. data/lib/notifo/models/subscription_dto.rb +23 -27
  152. data/lib/notifo/models/template_dto.rb +33 -29
  153. data/lib/notifo/models/topic_dto.rb +33 -28
  154. data/lib/notifo/models/track_notification_dto.rb +243 -0
  155. data/lib/notifo/models/update_integration_dto.rb +242 -0
  156. data/lib/notifo/models/update_profile_dto.rb +265 -0
  157. data/lib/notifo/models/upsert_app_dto.rb +22 -34
  158. data/lib/notifo/models/upsert_template_dto.rb +28 -29
  159. data/lib/notifo/models/upsert_templates_dto.rb +18 -25
  160. data/lib/notifo/models/upsert_user_dto.rb +35 -34
  161. data/lib/notifo/models/upsert_users_dto.rb +18 -25
  162. data/lib/notifo/models/user_dto.rb +100 -37
  163. data/lib/notifo/version.rb +4 -5
  164. data/notifo-io-1.0.1.1.gem +0 -0
  165. data/notifo.gemspec +10 -10
  166. data/spec/api/apps_api_spec.rb +14 -15
  167. data/spec/api/authorization_api_spec.rb +61 -0
  168. data/spec/api/configs_api_spec.rb +7 -8
  169. data/spec/api/events_api_spec.rb +8 -9
  170. data/spec/api/logs_api_spec.rb +7 -8
  171. data/spec/api/media_api_spec.rb +33 -12
  172. data/spec/api/mobile_push_api_spec.rb +66 -0
  173. data/spec/api/notifications_api_spec.rb +68 -0
  174. data/spec/api/templates_api_spec.rb +8 -9
  175. data/spec/api/topics_api_spec.rb +7 -44
  176. data/spec/api/user_api_spec.rb +91 -0
  177. data/spec/api/user_info_api_spec.rb +52 -0
  178. data/spec/api/users_api_spec.rb +10 -11
  179. data/spec/api_client_spec.rb +5 -6
  180. data/spec/base_object_spec.rb +109 -0
  181. data/spec/configuration_spec.rb +4 -5
  182. data/spec/models/add_allowed_topic_dto_spec.rb +40 -0
  183. data/spec/models/add_contributor_dto_spec.rb +15 -9
  184. data/spec/models/app_contributor_dto_spec.rb +15 -9
  185. data/spec/models/app_details_dto_spec.rb +15 -9
  186. data/spec/models/app_dto_spec.rb +15 -9
  187. data/spec/models/app_id_media_body_spec.rb +40 -0
  188. data/spec/models/body_spec.rb +40 -0
  189. data/spec/models/configured_integration_dto_spec.rb +70 -0
  190. data/spec/models/configured_integrations_dto_spec.rb +46 -0
  191. data/spec/models/confirm_mode_spec.rb +15 -9
  192. data/spec/models/create_email_template_dto_spec.rb +15 -9
  193. data/spec/models/create_integration_dto_spec.rb +64 -0
  194. data/spec/models/email_template_dto_spec.rb +15 -9
  195. data/spec/models/email_templates_dto_spec.rb +34 -0
  196. data/spec/models/email_verification_status_spec.rb +15 -9
  197. data/spec/models/error_dto_spec.rb +15 -9
  198. data/spec/models/event_dto_spec.rb +15 -9
  199. data/spec/models/event_properties_spec.rb +34 -0
  200. data/spec/models/integration_created_dto_spec.rb +46 -0
  201. data/spec/models/integration_definition_dto_spec.rb +64 -0
  202. data/spec/models/integration_properties_spec.rb +34 -0
  203. data/spec/models/integration_property_dto_spec.rb +100 -0
  204. data/spec/models/integration_property_type_spec.rb +34 -0
  205. data/spec/models/integration_status_spec.rb +34 -0
  206. data/spec/models/iso_day_of_week_spec.rb +15 -9
  207. data/spec/models/list_response_dto_of_event_dto_spec.rb +15 -9
  208. data/spec/models/list_response_dto_of_log_entry_dto_spec.rb +15 -9
  209. data/spec/models/list_response_dto_of_media_dto_spec.rb +15 -9
  210. data/spec/models/list_response_dto_of_mobile_push_token_dto_spec.rb +46 -0
  211. data/spec/models/list_response_dto_of_notification_dto_spec.rb +46 -0
  212. data/spec/models/list_response_dto_of_subscription_dto_spec.rb +15 -9
  213. data/spec/models/list_response_dto_of_template_dto_spec.rb +15 -9
  214. data/spec/models/list_response_dto_of_topic_dto_spec.rb +15 -9
  215. data/spec/models/list_response_dto_of_user_dto_spec.rb +15 -9
  216. data/spec/models/localized_text_spec.rb +34 -0
  217. data/spec/models/log_entry_dto_spec.rb +15 -9
  218. data/spec/models/media_dto_spec.rb +21 -9
  219. data/spec/models/media_metadata_spec.rb +34 -0
  220. data/spec/models/media_type_spec.rb +15 -9
  221. data/spec/models/mobile_device_type_spec.rb +34 -0
  222. data/spec/models/mobile_push_token_dto_spec.rb +46 -0
  223. data/spec/models/notification_dto_spec.rb +124 -0
  224. data/spec/models/notification_formatting_dto_spec.rb +15 -9
  225. data/spec/models/notification_send_spec.rb +34 -0
  226. data/spec/models/notification_setting_dto_spec.rb +16 -10
  227. data/spec/models/profile_dto_spec.rb +82 -0
  228. data/spec/models/{publish_request_dto_spec.rb → publish_dto_spec.rb} +18 -12
  229. data/spec/models/publish_many_dto_spec.rb +40 -0
  230. data/spec/models/register_mobile_token_dto_spec.rb +46 -0
  231. data/spec/models/resize_mode_spec.rb +15 -9
  232. data/spec/models/scheduling_dto_spec.rb +15 -9
  233. data/spec/models/scheduling_type_spec.rb +15 -9
  234. data/spec/models/subscription_dto_spec.rb +15 -9
  235. data/spec/models/template_dto_spec.rb +15 -9
  236. data/spec/models/topic_dto_spec.rb +15 -9
  237. data/spec/models/track_notification_dto_spec.rb +58 -0
  238. data/spec/models/update_integration_dto_spec.rb +58 -0
  239. data/spec/models/update_profile_dto_spec.rb +70 -0
  240. data/spec/models/upsert_app_dto_spec.rb +15 -9
  241. data/spec/models/upsert_template_dto_spec.rb +15 -9
  242. data/spec/models/upsert_templates_dto_spec.rb +15 -9
  243. data/spec/models/upsert_user_dto_spec.rb +15 -9
  244. data/spec/models/upsert_users_dto_spec.rb +15 -9
  245. data/spec/models/user_dto_spec.rb +15 -9
  246. data/spec/spec_helper.rb +4 -5
  247. metadata +167 -30
  248. data/docs/AddAllowedTopicRequest.md +0 -18
  249. data/docs/InlineObject.md +0 -18
  250. data/docs/PublishManyRequestDto.md +0 -18
  251. data/docs/PublishRequestDto.md +0 -36
  252. data/docs/SubscribeDto.md +0 -20
  253. data/notifo-io-1.0.0.gem +0 -0
  254. data/notifo-io-1.0.0.pre.beta.gem +0 -0
  255. data/spec/models/add_allowed_topic_request_spec.rb +0 -34
  256. data/spec/models/inline_object_spec.rb +0 -34
  257. data/spec/models/publish_many_request_dto_spec.rb +0 -34
  258. data/spec/models/subscribe_dto_spec.rb +0 -40
@@ -0,0 +1,30 @@
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 NotificationSend
16
+ INHERIT = 'Inherit'.freeze
17
+ SEND = 'Send'.freeze
18
+ NOT_SENDING = 'NotSending'.freeze
19
+ NOT_ALLOWED = 'NotAllowed'.freeze
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def build_from_hash(value)
25
+ constantValues = NotificationSend.constants.select { |c| NotificationSend::const_get(c) == value }
26
+ raise "Invalid ENUM value #{value} for class #NotificationSend" if constantValues.empty?
27
+ value
28
+ end
29
+ end
30
+ end
@@ -1,22 +1,19 @@
1
1
  =begin
2
2
  #Notifo API
3
3
 
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
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
6
+ OpenAPI spec version: 1.0.0
10
7
 
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.26
11
10
  =end
12
11
 
13
12
  require 'date'
14
- require 'time'
15
13
 
16
14
  module Notifo
17
15
  class NotificationSettingDto
18
- # True or false to send the notification for the channel.
19
- attr_accessor :_send
16
+ attr_accessor :send
20
17
 
21
18
  # The delay in seconds.
22
19
  attr_accessor :delay_in_seconds
@@ -24,32 +21,26 @@ module Notifo
24
21
  # Attribute mapping from ruby-style variable name to JSON key.
25
22
  def self.attribute_map
26
23
  {
27
- :'_send' => :'send',
24
+ :'send' => :'send',
28
25
  :'delay_in_seconds' => :'delayInSeconds'
29
26
  }
30
27
  end
31
28
 
32
- # Returns all the JSON keys this model knows about
33
- def self.acceptable_attributes
34
- attribute_map.values
35
- end
36
-
37
29
  # Attribute type mapping.
38
30
  def self.openapi_types
39
31
  {
40
- :'_send' => :'Boolean',
41
- :'delay_in_seconds' => :'Integer'
32
+ :'send' => :'Object',
33
+ :'delay_in_seconds' => :'Object'
42
34
  }
43
35
  end
44
36
 
45
37
  # List of attributes with nullable: true
46
38
  def self.openapi_nullable
47
39
  Set.new([
48
- :'_send',
49
40
  :'delay_in_seconds'
50
41
  ])
51
42
  end
52
-
43
+
53
44
  # Initializes the object
54
45
  # @param [Hash] attributes Model attributes in the form of hash
55
46
  def initialize(attributes = {})
@@ -65,8 +56,8 @@ module Notifo
65
56
  h[k.to_sym] = v
66
57
  }
67
58
 
68
- if attributes.key?(:'_send')
69
- self._send = attributes[:'_send']
59
+ if attributes.key?(:'send')
60
+ self.send = attributes[:'send']
70
61
  end
71
62
 
72
63
  if attributes.key?(:'delay_in_seconds')
@@ -78,12 +69,17 @@ module Notifo
78
69
  # @return Array for valid properties with the reasons
79
70
  def list_invalid_properties
80
71
  invalid_properties = Array.new
72
+ if @send.nil?
73
+ invalid_properties.push('invalid value for "send", send cannot be nil.')
74
+ end
75
+
81
76
  invalid_properties
82
77
  end
83
78
 
84
79
  # Check to see if the all the properties in the model are valid
85
80
  # @return true if the model is valid
86
81
  def valid?
82
+ return false if @send.nil?
87
83
  true
88
84
  end
89
85
 
@@ -92,7 +88,7 @@ module Notifo
92
88
  def ==(o)
93
89
  return true if self.equal?(o)
94
90
  self.class == o.class &&
95
- _send == o._send &&
91
+ send == o.send &&
96
92
  delay_in_seconds == o.delay_in_seconds
97
93
  end
98
94
 
@@ -105,7 +101,7 @@ module Notifo
105
101
  # Calculates hash code according to all attributes.
106
102
  # @return [Integer] Hash code
107
103
  def hash
108
- [_send, delay_in_seconds].hash
104
+ [send, delay_in_seconds].hash
109
105
  end
110
106
 
111
107
  # Builds the object from hash
@@ -121,9 +117,7 @@ module Notifo
121
117
  def build_from_hash(attributes)
122
118
  return nil unless attributes.is_a?(Hash)
123
119
  self.class.openapi_types.each_pair do |key, type|
124
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
125
- self.send("#{key}=", nil)
126
- elsif type =~ /\AArray<(.*)>/i
120
+ if type =~ /\AArray<(.*)>/i
127
121
  # check to ensure the input is an array given that the attribute
128
122
  # is documented as an array but the input is not
129
123
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -131,6 +125,8 @@ module Notifo
131
125
  end
132
126
  elsif !attributes[self.class.attribute_map[key]].nil?
133
127
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
129
+ self.send("#{key}=", nil)
134
130
  end
135
131
  end
136
132
 
@@ -143,8 +139,8 @@ module Notifo
143
139
  # @return [Object] Deserialized data
144
140
  def _deserialize(type, value)
145
141
  case type.to_sym
146
- when :Time
147
- Time.parse(value)
142
+ when :DateTime
143
+ DateTime.parse(value)
148
144
  when :Date
149
145
  Date.parse(value)
150
146
  when :String
@@ -174,9 +170,7 @@ module Notifo
174
170
  end
175
171
  end
176
172
  else # model
177
- # models (e.g. Pet) or oneOf
178
- klass = Notifo.const_get(type)
179
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
+ Notifo.const_get(type).build_from_hash(value)
180
174
  end
181
175
  end
182
176
 
@@ -224,8 +218,5 @@ module Notifo
224
218
  else
225
219
  value
226
220
  end
227
- end
228
-
229
- end
230
-
221
+ end end
231
222
  end
@@ -0,0 +1,311 @@
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 ProfileDto
16
+ # The full name of the user.
17
+ attr_accessor :full_name
18
+
19
+ # The email of the user.
20
+ attr_accessor :email_address
21
+
22
+ # The phone number.
23
+ attr_accessor :phone_number
24
+
25
+ # The preferred language of the user.
26
+ attr_accessor :preferred_language
27
+
28
+ # The timezone of the user.
29
+ attr_accessor :preferred_timezone
30
+
31
+ # The supported languages.
32
+ attr_accessor :supported_languages
33
+
34
+ # The supported timezones.
35
+ attr_accessor :supported_timezones
36
+
37
+ # Notification settings per channel.
38
+ attr_accessor :settings
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'full_name' => :'fullName',
44
+ :'email_address' => :'emailAddress',
45
+ :'phone_number' => :'phoneNumber',
46
+ :'preferred_language' => :'preferredLanguage',
47
+ :'preferred_timezone' => :'preferredTimezone',
48
+ :'supported_languages' => :'supportedLanguages',
49
+ :'supported_timezones' => :'supportedTimezones',
50
+ :'settings' => :'settings'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'full_name' => :'Object',
58
+ :'email_address' => :'Object',
59
+ :'phone_number' => :'Object',
60
+ :'preferred_language' => :'Object',
61
+ :'preferred_timezone' => :'Object',
62
+ :'supported_languages' => :'Object',
63
+ :'supported_timezones' => :'Object',
64
+ :'settings' => :'Object'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ :'phone_number',
72
+ :'preferred_language',
73
+ :'preferred_timezone',
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Notifo::ProfileDto` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Notifo::ProfileDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'full_name')
93
+ self.full_name = attributes[:'full_name']
94
+ end
95
+
96
+ if attributes.key?(:'email_address')
97
+ self.email_address = attributes[:'email_address']
98
+ end
99
+
100
+ if attributes.key?(:'phone_number')
101
+ self.phone_number = attributes[:'phone_number']
102
+ end
103
+
104
+ if attributes.key?(:'preferred_language')
105
+ self.preferred_language = attributes[:'preferred_language']
106
+ end
107
+
108
+ if attributes.key?(:'preferred_timezone')
109
+ self.preferred_timezone = attributes[:'preferred_timezone']
110
+ end
111
+
112
+ if attributes.key?(:'supported_languages')
113
+ if (value = attributes[:'supported_languages']).is_a?(Array)
114
+ self.supported_languages = value
115
+ end
116
+ end
117
+
118
+ if attributes.key?(:'supported_timezones')
119
+ if (value = attributes[:'supported_timezones']).is_a?(Array)
120
+ self.supported_timezones = value
121
+ end
122
+ end
123
+
124
+ if attributes.key?(:'settings')
125
+ if (value = attributes[:'settings']).is_a?(Hash)
126
+ self.settings = value
127
+ end
128
+ end
129
+ end
130
+
131
+ # Show invalid properties with the reasons. Usually used together with valid?
132
+ # @return Array for valid properties with the reasons
133
+ def list_invalid_properties
134
+ invalid_properties = Array.new
135
+ if @full_name.nil?
136
+ invalid_properties.push('invalid value for "full_name", full_name cannot be nil.')
137
+ end
138
+
139
+ if @email_address.nil?
140
+ invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
141
+ end
142
+
143
+ if @supported_languages.nil?
144
+ invalid_properties.push('invalid value for "supported_languages", supported_languages cannot be nil.')
145
+ end
146
+
147
+ if @supported_timezones.nil?
148
+ invalid_properties.push('invalid value for "supported_timezones", supported_timezones cannot be nil.')
149
+ end
150
+
151
+ if @settings.nil?
152
+ invalid_properties.push('invalid value for "settings", settings cannot be nil.')
153
+ end
154
+
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ return false if @full_name.nil?
162
+ return false if @email_address.nil?
163
+ return false if @supported_languages.nil?
164
+ return false if @supported_timezones.nil?
165
+ return false if @settings.nil?
166
+ true
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ full_name == o.full_name &&
175
+ email_address == o.email_address &&
176
+ phone_number == o.phone_number &&
177
+ preferred_language == o.preferred_language &&
178
+ preferred_timezone == o.preferred_timezone &&
179
+ supported_languages == o.supported_languages &&
180
+ supported_timezones == o.supported_timezones &&
181
+ settings == o.settings
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [full_name, email_address, phone_number, preferred_language, preferred_timezone, supported_languages, supported_timezones, settings].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ new.build_from_hash(attributes)
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
+ end
215
+ elsif !attributes[self.class.attribute_map[key]].nil?
216
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
218
+ self.send("#{key}=", nil)
219
+ end
220
+ end
221
+
222
+ self
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def _deserialize(type, value)
230
+ case type.to_sym
231
+ when :DateTime
232
+ DateTime.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :Boolean
242
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ Notifo.const_get(type).build_from_hash(value)
263
+ end
264
+ end
265
+
266
+ # Returns the string representation of the object
267
+ # @return [String] String presentation of the object
268
+ def to_s
269
+ to_hash.to_s
270
+ end
271
+
272
+ # to_body is an alias to to_hash (backward compatibility)
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_body
275
+ to_hash
276
+ end
277
+
278
+ # Returns the object in the form of hash
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_hash
281
+ hash = {}
282
+ self.class.attribute_map.each_pair do |attr, param|
283
+ value = self.send(attr)
284
+ if value.nil?
285
+ is_nullable = self.class.openapi_nullable.include?(attr)
286
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
+ end
288
+
289
+ hash[param] = _to_hash(value)
290
+ end
291
+ hash
292
+ end
293
+
294
+ # Outputs non-array value in the form of hash
295
+ # For object, use to_hash. Otherwise, just return the value
296
+ # @param [Object] value Any valid value
297
+ # @return [Hash] Returns the value in the form of hash
298
+ def _to_hash(value)
299
+ if value.is_a?(Array)
300
+ value.compact.map { |v| _to_hash(v) }
301
+ elsif value.is_a?(Hash)
302
+ {}.tap do |hash|
303
+ value.each { |k, v| hash[k] = _to_hash(v) }
304
+ end
305
+ elsif value.respond_to? :to_hash
306
+ value.to_hash
307
+ else
308
+ value
309
+ end
310
+ end end
311
+ end