SematextCloud 0.1.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +70 -0
  4. data/README.md +44 -55
  5. data/SematextCloud.gemspec +4 -11
  6. data/docs/AlertNotification.md +13 -0
  7. data/docs/AlertNotificationRequest.md +1 -0
  8. data/docs/AlertNotificationsApi.md +24 -26
  9. data/docs/AlertRule.md +1 -0
  10. data/docs/AlertRuleResponse.md +10 -0
  11. data/docs/AlertRuleResponseEntry.md +7 -0
  12. data/docs/AlertRuleScheduleTimeRangeDto.md +1 -0
  13. data/docs/AlertRuleScheduleWeekdayDto.md +1 -0
  14. data/docs/AlertRulesResponse.md +10 -0
  15. data/docs/AlertRulesResponseEntry.md +7 -0
  16. data/docs/AlertsApi.md +47 -51
  17. data/docs/App.md +2 -0
  18. data/docs/AppDescription.md +1 -0
  19. data/docs/AppMetadata.md +1 -0
  20. data/docs/AppResponse.md +10 -0
  21. data/docs/AppResponseEntry.md +7 -0
  22. data/docs/AppTypesResponse.md +10 -0
  23. data/docs/AppTypesResponseEntry.md +7 -0
  24. data/docs/AppsApi.md +120 -70
  25. data/docs/AppsResponse.md +10 -0
  26. data/docs/AppsResponseEntry.md +7 -0
  27. data/docs/AwsSettingsControllerApi.md +14 -15
  28. data/docs/BasicAuthMethodDto.md +1 -0
  29. data/docs/BasicOrganizationDto.md +1 -0
  30. data/docs/BillingApi.md +30 -35
  31. data/docs/BillingInfo.md +1 -0
  32. data/docs/ChargesDetailsResponseDto.md +13 -0
  33. data/docs/CloudWatchSettings.md +1 -0
  34. data/docs/CloudWatchSettingsResponse.md +10 -0
  35. data/docs/CloudWatchSettingsResponseEntry.md +7 -0
  36. data/docs/CreateAppInfo.md +8 -7
  37. data/docs/CreateTokenDto.md +3 -1
  38. data/docs/DailyDto.md +12 -0
  39. data/docs/DayUsageData.md +26 -0
  40. data/docs/Dimension.md +8 -0
  41. data/docs/Error.md +1 -0
  42. data/docs/EventDto.md +9 -0
  43. data/docs/FilterValue.md +1 -0
  44. data/docs/GenericApiResponse.md +7 -6
  45. data/docs/GenericMapBasedApiResponse.md +10 -0
  46. data/docs/Invitation.md +2 -1
  47. data/docs/Invoice.md +12 -0
  48. data/docs/InvoiceResponse.md +10 -0
  49. data/docs/InvoiceResponseEntry.md +7 -0
  50. data/docs/LimitChangeEventDTO.md +9 -0
  51. data/docs/LogsAppApi.md +12 -12
  52. data/docs/LogsUsageApiControllerApi.md +62 -0
  53. data/docs/MailReportResponse.md +10 -0
  54. data/docs/MailReportResponseResponseEntry.md +7 -0
  55. data/docs/MinPeriodFeePeriod.md +19 -0
  56. data/docs/MonitoringAppApi.md +16 -16
  57. data/docs/NotificationIntegration.md +1 -0
  58. data/docs/NotificationsResponse.md +10 -0
  59. data/docs/NotificationsResponseEntry.md +9 -0
  60. data/docs/Plan.md +16 -15
  61. data/docs/PlansResponse.md +10 -0
  62. data/docs/PlansResponseEntry.md +7 -0
  63. data/docs/ReportInfo.md +12 -10
  64. data/docs/ResetPasswordApi.md +12 -12
  65. data/docs/ServiceIntegration.md +1 -0
  66. data/docs/Subscription.md +22 -0
  67. data/docs/SubscriptionDashboardDto.md +2 -1
  68. data/docs/SubscriptionDto.md +17 -15
  69. data/docs/SubscriptionResponse.md +10 -0
  70. data/docs/SubscriptionResponseEntry.md +7 -0
  71. data/docs/SubscriptionsApi.md +160 -174
  72. data/docs/SubscriptionsResponse.md +10 -0
  73. data/docs/SubscriptionsResponseEntry.md +7 -0
  74. data/docs/TagApiControllerApi.md +28 -35
  75. data/docs/TagNamesResponse.md +7 -0
  76. data/docs/TokenDto.md +13 -0
  77. data/docs/TokenResponse.md +10 -0
  78. data/docs/TokenResponseEntry.md +7 -0
  79. data/docs/TokensApiControllerApi.md +72 -81
  80. data/docs/TokensResponse.md +10 -0
  81. data/docs/TokensResponseEntry.md +7 -0
  82. data/docs/UpdateAppInfo.md +2 -1
  83. data/docs/UpdatePlanResponse.md +10 -0
  84. data/docs/UpdatePlanResponseDto.md +8 -0
  85. data/docs/UpdatePlanResponseEntry.md +7 -0
  86. data/docs/UpdateSubscriptionDto.md +2 -1
  87. data/docs/UpdateTokenDto.md +3 -1
  88. data/docs/UsageDto.md +19 -0
  89. data/docs/UsageMultiResponse.md +10 -0
  90. data/docs/UsageMultiResponseEntry.md +7 -0
  91. data/docs/UsageResponse.md +10 -0
  92. data/docs/UsageResponseEntry.md +7 -0
  93. data/docs/UserInfo.md +1 -0
  94. data/docs/UserPermissions.md +1 -0
  95. data/docs/UserRole.md +1 -0
  96. data/lib/SematextCloud/api/alert_notifications_api.rb +42 -37
  97. data/lib/SematextCloud/api/alerts_api.rb +81 -72
  98. data/lib/SematextCloud/api/apps_api.rb +125 -106
  99. data/lib/SematextCloud/api/aws_settings_controller_api.rb +26 -25
  100. data/lib/SematextCloud/api/billing_api.rb +51 -46
  101. data/lib/SematextCloud/api/logs_app_api.rb +21 -20
  102. data/lib/SematextCloud/api/logs_usage_api_controller_api.rb +86 -0
  103. data/lib/SematextCloud/api/monitoring_app_api.rb +23 -22
  104. data/lib/SematextCloud/api/reset_password_api.rb +21 -20
  105. data/lib/SematextCloud/api/subscriptions_api.rb +203 -172
  106. data/lib/SematextCloud/api/tag_api_controller_api.rb +53 -50
  107. data/lib/SematextCloud/api/tokens_api_controller_api.rb +98 -87
  108. data/lib/SematextCloud/api_client.rb +41 -42
  109. data/lib/SematextCloud/api_error.rb +21 -2
  110. data/lib/SematextCloud/configuration.rb +5 -9
  111. data/lib/SematextCloud/models/alert_notification.rb +260 -0
  112. data/lib/SematextCloud/models/alert_notification_request.rb +49 -26
  113. data/lib/SematextCloud/models/alert_rule.rb +175 -152
  114. data/lib/SematextCloud/models/alert_rule_response.rb +235 -0
  115. data/lib/SematextCloud/models/alert_rule_response_entry.rb +206 -0
  116. data/lib/SematextCloud/models/alert_rule_schedule_time_range_dto.rb +44 -21
  117. data/lib/SematextCloud/models/alert_rule_schedule_weekday_dto.rb +49 -26
  118. data/lib/SematextCloud/models/alert_rules_response.rb +235 -0
  119. data/lib/SematextCloud/models/alert_rules_response_entry.rb +208 -0
  120. data/lib/SematextCloud/models/app.rb +163 -93
  121. data/lib/SematextCloud/models/app_description.rb +41 -18
  122. data/lib/SematextCloud/models/app_metadata.rb +60 -37
  123. data/lib/SematextCloud/models/app_response.rb +235 -0
  124. data/lib/SematextCloud/models/app_response_entry.rb +206 -0
  125. data/lib/SematextCloud/models/app_types_response.rb +235 -0
  126. data/lib/SematextCloud/models/app_types_response_entry.rb +208 -0
  127. data/lib/SematextCloud/models/apps_response.rb +235 -0
  128. data/lib/SematextCloud/models/apps_response_entry.rb +208 -0
  129. data/lib/SematextCloud/models/basic_auth_method_dto.rb +47 -24
  130. data/lib/SematextCloud/models/basic_organization_dto.rb +51 -28
  131. data/lib/SematextCloud/models/billing_info.rb +48 -25
  132. data/lib/SematextCloud/models/charges_details_response_dto.rb +298 -0
  133. data/lib/SematextCloud/models/cloud_watch_settings.rb +56 -33
  134. data/lib/SematextCloud/models/cloud_watch_settings_response.rb +235 -0
  135. data/lib/SematextCloud/models/cloud_watch_settings_response_entry.rb +206 -0
  136. data/lib/SematextCloud/models/create_app_info.rb +53 -31
  137. data/lib/SematextCloud/models/create_token_dto.rb +54 -22
  138. data/lib/SematextCloud/models/daily_dto.rb +251 -0
  139. data/lib/SematextCloud/models/day_usage_data.rb +411 -0
  140. data/lib/SematextCloud/models/{data_series_filter.rb → dimension.rb} +59 -69
  141. data/lib/SematextCloud/models/error.rb +43 -20
  142. data/lib/SematextCloud/models/{data_series_request.rb → event_dto.rb} +65 -90
  143. data/lib/SematextCloud/models/filter_value.rb +53 -30
  144. data/lib/SematextCloud/models/generic_api_response.rb +46 -24
  145. data/lib/SematextCloud/models/generic_map_based_api_response.rb +236 -0
  146. data/lib/SematextCloud/models/invitation.rb +74 -52
  147. data/lib/SematextCloud/models/invoice.rb +253 -0
  148. data/lib/SematextCloud/models/invoice_response.rb +235 -0
  149. data/lib/SematextCloud/models/invoice_response_entry.rb +206 -0
  150. data/lib/SematextCloud/models/limit_change_event_dto.rb +224 -0
  151. data/lib/SematextCloud/models/mail_report_response.rb +235 -0
  152. data/lib/SematextCloud/models/mail_report_response_response_entry.rb +206 -0
  153. data/lib/SematextCloud/models/min_period_fee_period.rb +314 -0
  154. data/lib/SematextCloud/models/notification_integration.rb +73 -50
  155. data/lib/SematextCloud/models/notifications_response.rb +235 -0
  156. data/lib/SematextCloud/models/notifications_response_entry.rb +226 -0
  157. data/lib/SematextCloud/models/plan.rb +80 -57
  158. data/lib/SematextCloud/models/plans_response.rb +235 -0
  159. data/lib/SematextCloud/models/plans_response_entry.rb +208 -0
  160. data/lib/SematextCloud/models/report_info.rb +69 -37
  161. data/lib/SematextCloud/models/service_integration.rb +71 -48
  162. data/lib/SematextCloud/models/subscription.rb +387 -0
  163. data/lib/SematextCloud/models/subscription_dashboard_dto.rb +72 -49
  164. data/lib/SematextCloud/models/subscription_dto.rb +85 -53
  165. data/lib/SematextCloud/models/subscription_response.rb +235 -0
  166. data/lib/SematextCloud/models/subscription_response_entry.rb +206 -0
  167. data/lib/SematextCloud/models/subscriptions_response.rb +235 -0
  168. data/lib/SematextCloud/models/subscriptions_response_entry.rb +208 -0
  169. data/lib/SematextCloud/models/tag_names_response.rb +213 -0
  170. data/lib/SematextCloud/models/{saved_query.rb → token_dto.rb} +78 -109
  171. data/lib/SematextCloud/models/token_response.rb +235 -0
  172. data/lib/SematextCloud/models/token_response_entry.rb +206 -0
  173. data/lib/SematextCloud/models/tokens_response.rb +235 -0
  174. data/lib/SematextCloud/models/tokens_response_entry.rb +208 -0
  175. data/lib/SematextCloud/models/update_app_info.rb +64 -41
  176. data/lib/SematextCloud/models/update_plan_response.rb +235 -0
  177. data/lib/SematextCloud/models/update_plan_response_dto.rb +217 -0
  178. data/lib/SematextCloud/models/update_plan_response_entry.rb +206 -0
  179. data/lib/SematextCloud/models/update_subscription_dto.rb +42 -19
  180. data/lib/SematextCloud/models/update_token_dto.rb +54 -22
  181. data/lib/SematextCloud/models/usage_dto.rb +320 -0
  182. data/lib/SematextCloud/models/usage_multi_response.rb +235 -0
  183. data/lib/SematextCloud/models/usage_multi_response_entry.rb +206 -0
  184. data/lib/SematextCloud/models/usage_response.rb +235 -0
  185. data/lib/SematextCloud/models/usage_response_entry.rb +206 -0
  186. data/lib/SematextCloud/models/user_info.rb +42 -19
  187. data/lib/SematextCloud/models/user_permissions.rb +48 -25
  188. data/lib/SematextCloud/models/user_role.rb +53 -30
  189. data/lib/SematextCloud/version.rb +2 -3
  190. data/lib/SematextCloud.rb +57 -7
  191. data/spec/api/alert_notifications_api_spec.rb +5 -6
  192. data/spec/api/alerts_api_spec.rb +11 -12
  193. data/spec/api/apps_api_spec.rb +26 -16
  194. data/spec/api/aws_settings_controller_api_spec.rb +6 -7
  195. data/spec/api/billing_api_spec.rb +7 -8
  196. data/spec/api/logs_app_api_spec.rb +3 -4
  197. data/spec/api/logs_usage_api_controller_api_spec.rb +47 -0
  198. data/spec/api/monitoring_app_api_spec.rb +5 -6
  199. data/spec/api/reset_password_api_spec.rb +3 -4
  200. data/spec/api/subscriptions_api_spec.rb +103 -11
  201. data/spec/api/tag_api_controller_api_spec.rb +8 -9
  202. data/spec/api/tokens_api_controller_api_spec.rb +18 -19
  203. data/spec/api_client_spec.rb +1 -2
  204. data/spec/base_object_spec.rb +109 -0
  205. data/spec/configuration_spec.rb +4 -5
  206. data/spec/models/alert_notification_request_spec.rb +4 -5
  207. data/spec/models/alert_notification_spec.rb +76 -0
  208. data/spec/models/alert_rule_response_entry_spec.rb +40 -0
  209. data/spec/models/alert_rule_response_spec.rb +58 -0
  210. data/spec/models/alert_rule_schedule_time_range_dto_spec.rb +4 -5
  211. data/spec/models/alert_rule_schedule_weekday_dto_spec.rb +4 -5
  212. data/spec/models/alert_rule_spec.rb +4 -5
  213. data/spec/models/alert_rules_response_entry_spec.rb +40 -0
  214. data/spec/models/alert_rules_response_spec.rb +58 -0
  215. data/spec/models/app_description_spec.rb +4 -5
  216. data/spec/models/app_metadata_spec.rb +4 -5
  217. data/spec/models/app_response_entry_spec.rb +40 -0
  218. data/spec/models/app_response_spec.rb +58 -0
  219. data/spec/models/app_spec.rb +34 -5
  220. data/spec/models/app_types_response_entry_spec.rb +40 -0
  221. data/spec/models/app_types_response_spec.rb +58 -0
  222. data/spec/models/apps_response_entry_spec.rb +40 -0
  223. data/spec/models/apps_response_spec.rb +58 -0
  224. data/spec/models/basic_auth_method_dto_spec.rb +4 -5
  225. data/spec/models/basic_organization_dto_spec.rb +4 -5
  226. data/spec/models/billing_info_spec.rb +4 -5
  227. data/spec/models/{data_series_request_spec.rb → charges_details_response_dto_spec.rb} +18 -19
  228. data/spec/models/cloud_watch_settings_response_entry_spec.rb +40 -0
  229. data/spec/models/cloud_watch_settings_response_spec.rb +58 -0
  230. data/spec/models/cloud_watch_settings_spec.rb +4 -5
  231. data/spec/models/create_app_info_spec.rb +4 -5
  232. data/spec/models/create_token_dto_spec.rb +10 -5
  233. data/spec/models/daily_dto_spec.rb +70 -0
  234. data/spec/models/day_usage_data_spec.rb +158 -0
  235. data/spec/models/dimension_spec.rb +46 -0
  236. data/spec/models/error_spec.rb +4 -5
  237. data/spec/models/{data_series_filter_spec.rb → event_dto_spec.rb} +14 -15
  238. data/spec/models/filter_value_spec.rb +4 -5
  239. data/spec/models/generic_api_response_spec.rb +4 -5
  240. data/spec/models/generic_map_based_api_response_spec.rb +58 -0
  241. data/spec/models/invitation_spec.rb +4 -5
  242. data/spec/models/invoice_response_entry_spec.rb +40 -0
  243. data/spec/models/invoice_response_spec.rb +58 -0
  244. data/spec/models/invoice_spec.rb +70 -0
  245. data/spec/models/limit_change_event_dto_spec.rb +52 -0
  246. data/spec/models/mail_report_response_response_entry_spec.rb +40 -0
  247. data/spec/models/mail_report_response_spec.rb +58 -0
  248. data/spec/models/min_period_fee_period_spec.rb +112 -0
  249. data/spec/models/notification_integration_spec.rb +4 -5
  250. data/spec/models/notifications_response_entry_spec.rb +52 -0
  251. data/spec/models/notifications_response_spec.rb +58 -0
  252. data/spec/models/plan_spec.rb +5 -6
  253. data/spec/models/plans_response_entry_spec.rb +40 -0
  254. data/spec/models/plans_response_spec.rb +58 -0
  255. data/spec/models/report_info_spec.rb +10 -5
  256. data/spec/models/service_integration_spec.rb +4 -5
  257. data/spec/models/subscription_dashboard_dto_spec.rb +4 -5
  258. data/spec/models/subscription_dto_spec.rb +10 -5
  259. data/spec/models/subscription_response_entry_spec.rb +40 -0
  260. data/spec/models/subscription_response_spec.rb +58 -0
  261. data/spec/models/subscription_spec.rb +138 -0
  262. data/spec/models/subscriptions_response_entry_spec.rb +40 -0
  263. data/spec/models/subscriptions_response_spec.rb +58 -0
  264. data/spec/models/tag_names_response_spec.rb +40 -0
  265. data/spec/models/token_dto_spec.rb +76 -0
  266. data/spec/models/token_response_entry_spec.rb +40 -0
  267. data/spec/models/token_response_spec.rb +58 -0
  268. data/spec/models/tokens_response_entry_spec.rb +40 -0
  269. data/spec/models/tokens_response_spec.rb +58 -0
  270. data/spec/models/update_app_info_spec.rb +4 -5
  271. data/spec/models/update_plan_response_dto_spec.rb +46 -0
  272. data/spec/models/update_plan_response_entry_spec.rb +40 -0
  273. data/spec/models/update_plan_response_spec.rb +58 -0
  274. data/spec/models/update_subscription_dto_spec.rb +4 -5
  275. data/spec/models/update_token_dto_spec.rb +10 -5
  276. data/spec/models/{saved_query_spec.rb → usage_dto_spec.rb} +20 -21
  277. data/spec/models/usage_multi_response_entry_spec.rb +40 -0
  278. data/spec/models/usage_multi_response_spec.rb +58 -0
  279. data/spec/models/usage_response_entry_spec.rb +40 -0
  280. data/spec/models/usage_response_spec.rb +58 -0
  281. data/spec/models/user_info_spec.rb +4 -5
  282. data/spec/models/user_permissions_spec.rb +4 -5
  283. data/spec/models/user_role_spec.rb +4 -5
  284. data/spec/spec_helper.rb +1 -2
  285. metadata +235 -173
  286. data/docs/DataSeriesFilter.md +0 -8
  287. data/docs/DataSeriesRequest.md +0 -12
  288. data/docs/MetricsApi.md +0 -227
  289. data/docs/SavedQueriesApi.md +0 -220
  290. data/docs/SavedQuery.md +0 -18
  291. data/lib/SematextCloud/api/metrics_api.rb +0 -247
  292. data/lib/SematextCloud/api/saved_queries_api.rb +0 -237
  293. data/spec/api/metrics_api_spec.rb +0 -83
  294. data/spec/api/saved_queries_api_spec.rb +0 -80
@@ -6,8 +6,7 @@
6
6
  OpenAPI spec version: v3
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.12
10
-
9
+ Swagger Codegen version: 3.0.30
11
10
  =end
12
11
 
13
12
  require 'date'
@@ -15,7 +14,6 @@ require 'date'
15
14
  module SematextCloud
16
15
  # Generic wrapper class for all API responses
17
16
  class GenericApiResponse
18
- # Contains actual data when response is successful. Key and Value is specific to each endpoint
19
17
  attr_accessor :data
20
18
 
21
19
  attr_accessor :errors
@@ -35,38 +33,51 @@ module SematextCloud
35
33
  end
36
34
 
37
35
  # Attribute type mapping.
38
- def self.swagger_types
36
+ def self.openapi_types
39
37
  {
40
38
  :'data' => :'Object',
41
- :'errors' => :'Array<Error>',
42
- :'message' => :'String',
43
- :'success' => :'BOOLEAN'
39
+ :'errors' => :'Object',
40
+ :'message' => :'Object',
41
+ :'success' => :'Object'
44
42
  }
45
43
  end
46
44
 
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
47
51
  # Initializes the object
48
52
  # @param [Hash] attributes Model attributes in the form of hash
49
53
  def initialize(attributes = {})
50
- return unless attributes.is_a?(Hash)
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SematextCloud::GenericApiResponse` initialize method"
56
+ end
51
57
 
52
- # convert string to symbol for hash key
53
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SematextCloud::GenericApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
54
65
 
55
- if attributes.has_key?(:'data')
66
+ if attributes.key?(:'data')
56
67
  self.data = attributes[:'data']
57
68
  end
58
69
 
59
- if attributes.has_key?(:'errors')
70
+ if attributes.key?(:'errors')
60
71
  if (value = attributes[:'errors']).is_a?(Array)
61
72
  self.errors = value
62
73
  end
63
74
  end
64
75
 
65
- if attributes.has_key?(:'message')
76
+ if attributes.key?(:'message')
66
77
  self.message = attributes[:'message']
67
78
  end
68
79
 
69
- if attributes.has_key?(:'success')
80
+ if attributes.key?(:'success')
70
81
  self.success = attributes[:'success']
71
82
  end
72
83
  end
@@ -102,26 +113,35 @@ module SematextCloud
102
113
  end
103
114
 
104
115
  # Calculates hash code according to all attributes.
105
- # @return [Fixnum] Hash code
116
+ # @return [Integer] Hash code
106
117
  def hash
107
118
  [data, errors, message, success].hash
108
119
  end
109
120
 
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def self.build_from_hash(attributes)
125
+ new.build_from_hash(attributes)
126
+ end
127
+
110
128
  # Builds the object from hash
111
129
  # @param [Hash] attributes Model attributes in the form of hash
112
130
  # @return [Object] Returns the model itself
113
131
  def build_from_hash(attributes)
114
132
  return nil unless attributes.is_a?(Hash)
115
- self.class.swagger_types.each_pair do |key, type|
133
+ self.class.openapi_types.each_pair do |key, type|
116
134
  if type =~ /\AArray<(.*)>/i
117
- # check to ensure the input is an array given that the the attribute
135
+ # check to ensure the input is an array given that the attribute
118
136
  # is documented as an array but the input is not
119
137
  if attributes[self.class.attribute_map[key]].is_a?(Array)
120
138
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
139
  end
122
140
  elsif !attributes[self.class.attribute_map[key]].nil?
123
141
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
- end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
143
+ self.send("#{key}=", nil)
144
+ end
125
145
  end
126
146
 
127
147
  self
@@ -143,7 +163,7 @@ module SematextCloud
143
163
  value.to_i
144
164
  when :Float
145
165
  value.to_f
146
- when :BOOLEAN
166
+ when :Boolean
147
167
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
168
  true
149
169
  else
@@ -164,8 +184,7 @@ module SematextCloud
164
184
  end
165
185
  end
166
186
  else # model
167
- temp_model = SematextCloud.const_get(type).new
168
- temp_model.build_from_hash(value)
187
+ SematextCloud.const_get(type).build_from_hash(value)
169
188
  end
170
189
  end
171
190
 
@@ -187,7 +206,11 @@ module SematextCloud
187
206
  hash = {}
188
207
  self.class.attribute_map.each_pair do |attr, param|
189
208
  value = self.send(attr)
190
- next if value.nil?
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
191
214
  hash[param] = _to_hash(value)
192
215
  end
193
216
  hash
@@ -209,6 +232,5 @@ module SematextCloud
209
232
  else
210
233
  value
211
234
  end
212
- end
213
- end
235
+ end end
214
236
  end
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #Sematext Cloud API
3
+
4
+ #API Explorer provides access and documentation for Sematext REST API. The REST API requires the API Key to be sent as part of `Authorization` header. E.g.: `Authorization : apiKey e5f18450-205a-48eb-8589-7d49edaea813`.
5
+
6
+ OpenAPI spec version: v3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.30
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module SematextCloud
15
+ # Generic map based wrapper class for all API responses
16
+ class GenericMapBasedApiResponse
17
+ attr_accessor :data
18
+
19
+ attr_accessor :errors
20
+
21
+ attr_accessor :message
22
+
23
+ attr_accessor :success
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'data' => :'data',
29
+ :'errors' => :'errors',
30
+ :'message' => :'message',
31
+ :'success' => :'success'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'data' => :'Object',
39
+ :'errors' => :'Object',
40
+ :'message' => :'Object',
41
+ :'success' => :'Object'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SematextCloud::GenericMapBasedApiResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SematextCloud::GenericMapBasedApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'data')
67
+ self.data = attributes[:'data']
68
+ end
69
+
70
+ if attributes.key?(:'errors')
71
+ if (value = attributes[:'errors']).is_a?(Array)
72
+ self.errors = value
73
+ end
74
+ end
75
+
76
+ if attributes.key?(:'message')
77
+ self.message = attributes[:'message']
78
+ end
79
+
80
+ if attributes.key?(:'success')
81
+ self.success = attributes[:'success']
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
+ data == o.data &&
104
+ errors == o.errors &&
105
+ message == o.message &&
106
+ success == o.success
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Integer] Hash code
117
+ def hash
118
+ [data, errors, message, success].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def self.build_from_hash(attributes)
125
+ new.build_from_hash(attributes)
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ self.class.openapi_types.each_pair do |key, type|
134
+ if type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
143
+ self.send("#{key}=", nil)
144
+ end
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ SematextCloud.const_get(type).build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end end
236
+ end
@@ -6,15 +6,13 @@
6
6
  OpenAPI spec version: v3
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.12
10
-
9
+ Swagger Codegen version: 3.0.30
11
10
  =end
12
11
 
13
12
  require 'date'
14
13
 
15
14
  module SematextCloud
16
15
  class Invitation
17
- # For invite request, only app.id needs to be set.
18
16
  attr_accessor :app
19
17
 
20
18
  # For invite request, only apps.id needs to be set.
@@ -75,68 +73,81 @@ module SematextCloud
75
73
  end
76
74
 
77
75
  # Attribute type mapping.
78
- def self.swagger_types
76
+ def self.openapi_types
79
77
  {
80
- :'app' => :'App',
81
- :'apps' => :'Array<App>',
82
- :'id' => :'Integer',
83
- :'invite_date' => :'DateTime',
84
- :'invite_status' => :'String',
85
- :'invitee_email' => :'String',
86
- :'invitee_role' => :'String',
87
- :'invitee_status' => :'String',
88
- :'inviter_email' => :'String',
89
- :'uuid' => :'String'
78
+ :'app' => :'Object',
79
+ :'apps' => :'Object',
80
+ :'id' => :'Object',
81
+ :'invite_date' => :'Object',
82
+ :'invite_status' => :'Object',
83
+ :'invitee_email' => :'Object',
84
+ :'invitee_role' => :'Object',
85
+ :'invitee_status' => :'Object',
86
+ :'inviter_email' => :'Object',
87
+ :'uuid' => :'Object'
90
88
  }
91
89
  end
92
90
 
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ ])
95
+ end
96
+
93
97
  # Initializes the object
94
98
  # @param [Hash] attributes Model attributes in the form of hash
95
99
  def initialize(attributes = {})
96
- return unless attributes.is_a?(Hash)
100
+ if (!attributes.is_a?(Hash))
101
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SematextCloud::Invitation` initialize method"
102
+ end
97
103
 
98
- # convert string to symbol for hash key
99
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h|
106
+ if (!self.class.attribute_map.key?(k.to_sym))
107
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SematextCloud::Invitation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
108
+ end
109
+ h[k.to_sym] = v
110
+ }
100
111
 
101
- if attributes.has_key?(:'app')
112
+ if attributes.key?(:'app')
102
113
  self.app = attributes[:'app']
103
114
  end
104
115
 
105
- if attributes.has_key?(:'apps')
116
+ if attributes.key?(:'apps')
106
117
  if (value = attributes[:'apps']).is_a?(Array)
107
118
  self.apps = value
108
119
  end
109
120
  end
110
121
 
111
- if attributes.has_key?(:'id')
122
+ if attributes.key?(:'id')
112
123
  self.id = attributes[:'id']
113
124
  end
114
125
 
115
- if attributes.has_key?(:'inviteDate')
116
- self.invite_date = attributes[:'inviteDate']
126
+ if attributes.key?(:'invite_date')
127
+ self.invite_date = attributes[:'invite_date']
117
128
  end
118
129
 
119
- if attributes.has_key?(:'inviteStatus')
120
- self.invite_status = attributes[:'inviteStatus']
130
+ if attributes.key?(:'invite_status')
131
+ self.invite_status = attributes[:'invite_status']
121
132
  end
122
133
 
123
- if attributes.has_key?(:'inviteeEmail')
124
- self.invitee_email = attributes[:'inviteeEmail']
134
+ if attributes.key?(:'invitee_email')
135
+ self.invitee_email = attributes[:'invitee_email']
125
136
  end
126
137
 
127
- if attributes.has_key?(:'inviteeRole')
128
- self.invitee_role = attributes[:'inviteeRole']
138
+ if attributes.key?(:'invitee_role')
139
+ self.invitee_role = attributes[:'invitee_role']
129
140
  end
130
141
 
131
- if attributes.has_key?(:'inviteeStatus')
132
- self.invitee_status = attributes[:'inviteeStatus']
142
+ if attributes.key?(:'invitee_status')
143
+ self.invitee_status = attributes[:'invitee_status']
133
144
  end
134
145
 
135
- if attributes.has_key?(:'inviterEmail')
136
- self.inviter_email = attributes[:'inviterEmail']
146
+ if attributes.key?(:'inviter_email')
147
+ self.inviter_email = attributes[:'inviter_email']
137
148
  end
138
149
 
139
- if attributes.has_key?(:'uuid')
150
+ if attributes.key?(:'uuid')
140
151
  self.uuid = attributes[:'uuid']
141
152
  end
142
153
  end
@@ -151,11 +162,11 @@ module SematextCloud
151
162
  # Check to see if the all the properties in the model are valid
152
163
  # @return true if the model is valid
153
164
  def valid?
154
- invite_status_validator = EnumAttributeValidator.new('String', ['PENDING', 'ACCEPTED', 'CANCELLED', 'DECLINED'])
165
+ invite_status_validator = EnumAttributeValidator.new('Object', ['PENDING', 'ACCEPTED', 'CANCELLED', 'DECLINED'])
155
166
  return false unless invite_status_validator.valid?(@invite_status)
156
- invitee_role_validator = EnumAttributeValidator.new('String', ['SUPER_USER', 'OWNER', 'ADMIN', 'USER', 'DEMO', 'ANONYMOUS'])
167
+ invitee_role_validator = EnumAttributeValidator.new('Object', ['SUPER_USER', 'OWNER', 'ADMIN', 'USER', 'DEMO', 'ANONYMOUS'])
157
168
  return false unless invitee_role_validator.valid?(@invitee_role)
158
- invitee_status_validator = EnumAttributeValidator.new('String', ['INACTIVE', 'ACTIVE'])
169
+ invitee_status_validator = EnumAttributeValidator.new('Object', ['INACTIVE', 'ACTIVE'])
159
170
  return false unless invitee_status_validator.valid?(@invitee_status)
160
171
  true
161
172
  end
@@ -163,9 +174,9 @@ module SematextCloud
163
174
  # Custom attribute writer method checking allowed values (enum).
164
175
  # @param [Object] invite_status Object to be assigned
165
176
  def invite_status=(invite_status)
166
- validator = EnumAttributeValidator.new('String', ['PENDING', 'ACCEPTED', 'CANCELLED', 'DECLINED'])
177
+ validator = EnumAttributeValidator.new('Object', ['PENDING', 'ACCEPTED', 'CANCELLED', 'DECLINED'])
167
178
  unless validator.valid?(invite_status)
168
- fail ArgumentError, 'invalid value for "invite_status", must be one of #{validator.allowable_values}.'
179
+ fail ArgumentError, "invalid value for \"invite_status\", must be one of #{validator.allowable_values}."
169
180
  end
170
181
  @invite_status = invite_status
171
182
  end
@@ -173,9 +184,9 @@ module SematextCloud
173
184
  # Custom attribute writer method checking allowed values (enum).
174
185
  # @param [Object] invitee_role Object to be assigned
175
186
  def invitee_role=(invitee_role)
176
- validator = EnumAttributeValidator.new('String', ['SUPER_USER', 'OWNER', 'ADMIN', 'USER', 'DEMO', 'ANONYMOUS'])
187
+ validator = EnumAttributeValidator.new('Object', ['SUPER_USER', 'OWNER', 'ADMIN', 'USER', 'DEMO', 'ANONYMOUS'])
177
188
  unless validator.valid?(invitee_role)
178
- fail ArgumentError, 'invalid value for "invitee_role", must be one of #{validator.allowable_values}.'
189
+ fail ArgumentError, "invalid value for \"invitee_role\", must be one of #{validator.allowable_values}."
179
190
  end
180
191
  @invitee_role = invitee_role
181
192
  end
@@ -183,9 +194,9 @@ module SematextCloud
183
194
  # Custom attribute writer method checking allowed values (enum).
184
195
  # @param [Object] invitee_status Object to be assigned
185
196
  def invitee_status=(invitee_status)
186
- validator = EnumAttributeValidator.new('String', ['INACTIVE', 'ACTIVE'])
197
+ validator = EnumAttributeValidator.new('Object', ['INACTIVE', 'ACTIVE'])
187
198
  unless validator.valid?(invitee_status)
188
- fail ArgumentError, 'invalid value for "invitee_status", must be one of #{validator.allowable_values}.'
199
+ fail ArgumentError, "invalid value for \"invitee_status\", must be one of #{validator.allowable_values}."
189
200
  end
190
201
  @invitee_status = invitee_status
191
202
  end
@@ -214,26 +225,35 @@ module SematextCloud
214
225
  end
215
226
 
216
227
  # Calculates hash code according to all attributes.
217
- # @return [Fixnum] Hash code
228
+ # @return [Integer] Hash code
218
229
  def hash
219
230
  [app, apps, id, invite_date, invite_status, invitee_email, invitee_role, invitee_status, inviter_email, uuid].hash
220
231
  end
221
232
 
233
+ # Builds the object from hash
234
+ # @param [Hash] attributes Model attributes in the form of hash
235
+ # @return [Object] Returns the model itself
236
+ def self.build_from_hash(attributes)
237
+ new.build_from_hash(attributes)
238
+ end
239
+
222
240
  # Builds the object from hash
223
241
  # @param [Hash] attributes Model attributes in the form of hash
224
242
  # @return [Object] Returns the model itself
225
243
  def build_from_hash(attributes)
226
244
  return nil unless attributes.is_a?(Hash)
227
- self.class.swagger_types.each_pair do |key, type|
245
+ self.class.openapi_types.each_pair do |key, type|
228
246
  if type =~ /\AArray<(.*)>/i
229
- # check to ensure the input is an array given that the the attribute
247
+ # check to ensure the input is an array given that the attribute
230
248
  # is documented as an array but the input is not
231
249
  if attributes[self.class.attribute_map[key]].is_a?(Array)
232
250
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
233
251
  end
234
252
  elsif !attributes[self.class.attribute_map[key]].nil?
235
253
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
236
- end # or else data not found in attributes(hash), not an issue as the data can be optional
254
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
255
+ self.send("#{key}=", nil)
256
+ end
237
257
  end
238
258
 
239
259
  self
@@ -255,7 +275,7 @@ module SematextCloud
255
275
  value.to_i
256
276
  when :Float
257
277
  value.to_f
258
- when :BOOLEAN
278
+ when :Boolean
259
279
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
260
280
  true
261
281
  else
@@ -276,8 +296,7 @@ module SematextCloud
276
296
  end
277
297
  end
278
298
  else # model
279
- temp_model = SematextCloud.const_get(type).new
280
- temp_model.build_from_hash(value)
299
+ SematextCloud.const_get(type).build_from_hash(value)
281
300
  end
282
301
  end
283
302
 
@@ -299,7 +318,11 @@ module SematextCloud
299
318
  hash = {}
300
319
  self.class.attribute_map.each_pair do |attr, param|
301
320
  value = self.send(attr)
302
- next if value.nil?
321
+ if value.nil?
322
+ is_nullable = self.class.openapi_nullable.include?(attr)
323
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
324
+ end
325
+
303
326
  hash[param] = _to_hash(value)
304
327
  end
305
328
  hash
@@ -321,6 +344,5 @@ module SematextCloud
321
344
  else
322
345
  value
323
346
  end
324
- end
325
- end
347
+ end end
326
348
  end