togai_client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +61 -0
  4. data/Rakefile +10 -0
  5. data/docs/Account.md +24 -0
  6. data/docs/AccountAliases.md +20 -0
  7. data/docs/AccountPaginatedResponse.md +22 -0
  8. data/docs/AccountsApi.md +595 -0
  9. data/docs/AddAccountAliasesRequest.md +18 -0
  10. data/docs/AssociatePricePlanRequest.md +24 -0
  11. data/docs/AssociatePricePlanResponse.md +22 -0
  12. data/docs/BaseSuccessResponse.md +18 -0
  13. data/docs/BundleStrategy.md +24 -0
  14. data/docs/BundleStrategyUsageMetersValue.md +18 -0
  15. data/docs/Computation.md +31 -0
  16. data/docs/CreateAccountRequest.md +22 -0
  17. data/docs/CreateCustomerRequest.md +26 -0
  18. data/docs/CreateCustomerResponse.md +26 -0
  19. data/docs/CreateEventSchemaRequest.md +24 -0
  20. data/docs/CreatePricePlanRequest.md +24 -0
  21. data/docs/CreateUsageMeterRequest.md +26 -0
  22. data/docs/Customer.md +30 -0
  23. data/docs/CustomerPaginatedResponse.md +22 -0
  24. data/docs/CustomersApi.md +363 -0
  25. data/docs/DimensionsSchema.md +18 -0
  26. data/docs/ErrorResponse.md +18 -0
  27. data/docs/Event.md +28 -0
  28. data/docs/EventAttribute.md +22 -0
  29. data/docs/EventAttributeSchema.md +20 -0
  30. data/docs/EventIngestionApi.md +146 -0
  31. data/docs/EventManagementApi.md +159 -0
  32. data/docs/EventPipelineInfo.md +26 -0
  33. data/docs/EventPipelineInfoAccount.md +20 -0
  34. data/docs/EventPipelineInfoCustomer.md +20 -0
  35. data/docs/EventPipelineInfoEventSchema.md +20 -0
  36. data/docs/EventPipelineInfoPricePlansInner.md +26 -0
  37. data/docs/EventPipelineInfoUsageMetersInner.md +24 -0
  38. data/docs/EventSchema.md +32 -0
  39. data/docs/EventSchemaListData.md +34 -0
  40. data/docs/EventSchemaListDataAllOf.md +18 -0
  41. data/docs/EventSchemaListPaginatedResponse.md +22 -0
  42. data/docs/EventSchemaVersionsResponse.md +18 -0
  43. data/docs/EventSchemasApi.md +581 -0
  44. data/docs/EventWithStatus.md +20 -0
  45. data/docs/EventWithStatusAndEventPipelineInfo.md +22 -0
  46. data/docs/EventWithStatusAndEventPipelineInfoAllOf.md +18 -0
  47. data/docs/GetEventResponse.md +18 -0
  48. data/docs/GetEventsResponse.md +20 -0
  49. data/docs/GetMetricsRequest.md +22 -0
  50. data/docs/GetMetricsResponse.md +18 -0
  51. data/docs/IngestBatchEventRequest.md +18 -0
  52. data/docs/IngestBatchEventResponse.md +18 -0
  53. data/docs/IngestError.md +20 -0
  54. data/docs/IngestEventRequest.md +18 -0
  55. data/docs/IngestEventResponse.md +18 -0
  56. data/docs/IngestionStatus.md +20 -0
  57. data/docs/MetricDataPoints.md +22 -0
  58. data/docs/MetricDataPointsGroupedBy.md +20 -0
  59. data/docs/MetricName.md +15 -0
  60. data/docs/MetricQuery.md +26 -0
  61. data/docs/MetricQueryFilterEntry.md +20 -0
  62. data/docs/MetricQueryResponse.md +22 -0
  63. data/docs/MetricsApi.md +79 -0
  64. data/docs/PaginationOptions.md +20 -0
  65. data/docs/PlanOverride.md +24 -0
  66. data/docs/PricePlan.md +26 -0
  67. data/docs/PricePlanListData.md +32 -0
  68. data/docs/PricePlanPaginatedResponse.md +22 -0
  69. data/docs/PricePlansApi.md +363 -0
  70. data/docs/PricingCycle.md +24 -0
  71. data/docs/PricingCycleStartOffset.md +20 -0
  72. data/docs/PricingSchedule.md +22 -0
  73. data/docs/RateCard.md +22 -0
  74. data/docs/RateCardBundle.md +22 -0
  75. data/docs/RateCardUsageValue.md +24 -0
  76. data/docs/RemoveAccountAliasesRequest.md +18 -0
  77. data/docs/SignupRequest.md +22 -0
  78. data/docs/SignupResponse.md +20 -0
  79. data/docs/StatusResponse.md +24 -0
  80. data/docs/StatusResponseHeaders.md +18 -0
  81. data/docs/UpdateAccountRequest.md +18 -0
  82. data/docs/UpdateCustomerRequest.md +22 -0
  83. data/docs/UpdateEventSchemaRequest.md +22 -0
  84. data/docs/UpdatePricePlanRequest.md +22 -0
  85. data/docs/UpdateUsageMeterRequest.md +24 -0
  86. data/docs/UsageMeter.md +34 -0
  87. data/docs/UsageMeterPaginatedResponse.md +22 -0
  88. data/docs/UsageMetersApi.md +521 -0
  89. data/docs/UsageStrategy.md +22 -0
  90. data/docs/UserDetails.md +26 -0
  91. data/git_push.sh +57 -0
  92. data/lib/togai_client/api/accounts_api.rb +679 -0
  93. data/lib/togai_client/api/customers_api.rb +365 -0
  94. data/lib/togai_client/api/event_ingestion_api.rb +158 -0
  95. data/lib/togai_client/api/event_management_api.rb +164 -0
  96. data/lib/togai_client/api/event_schemas_api.rb +579 -0
  97. data/lib/togai_client/api/metrics_api.rb +86 -0
  98. data/lib/togai_client/api/price_plans_api.rb +365 -0
  99. data/lib/togai_client/api/usage_meters_api.rb +572 -0
  100. data/lib/togai_client/api_client.rb +392 -0
  101. data/lib/togai_client/api_error.rb +57 -0
  102. data/lib/togai_client/configuration.rb +287 -0
  103. data/lib/togai_client/models/account.rb +373 -0
  104. data/lib/togai_client/models/account_aliases.rb +277 -0
  105. data/lib/togai_client/models/account_paginated_response.rb +239 -0
  106. data/lib/togai_client/models/add_account_aliases_request.rb +247 -0
  107. data/lib/togai_client/models/associate_price_plan_request.rb +274 -0
  108. data/lib/togai_client/models/associate_price_plan_response.rb +275 -0
  109. data/lib/togai_client/models/base_success_response.rb +224 -0
  110. data/lib/togai_client/models/bundle_strategy.rb +325 -0
  111. data/lib/togai_client/models/bundle_strategy_usage_meters_value.rb +224 -0
  112. data/lib/togai_client/models/computation.rb +294 -0
  113. data/lib/togai_client/models/create_account_request.rb +324 -0
  114. data/lib/togai_client/models/create_customer_request.rb +374 -0
  115. data/lib/togai_client/models/create_customer_response.rb +373 -0
  116. data/lib/togai_client/models/create_event_schema_request.rb +351 -0
  117. data/lib/togai_client/models/create_price_plan_request.rb +298 -0
  118. data/lib/togai_client/models/create_usage_meter_request.rb +368 -0
  119. data/lib/togai_client/models/customer.rb +442 -0
  120. data/lib/togai_client/models/customer_paginated_response.rb +239 -0
  121. data/lib/togai_client/models/dimensions_schema.rb +256 -0
  122. data/lib/togai_client/models/error_response.rb +244 -0
  123. data/lib/togai_client/models/event.rb +379 -0
  124. data/lib/togai_client/models/event_attribute.rb +304 -0
  125. data/lib/togai_client/models/event_attribute_schema.rb +281 -0
  126. data/lib/togai_client/models/event_pipeline_info.rb +260 -0
  127. data/lib/togai_client/models/event_pipeline_info_account.rb +238 -0
  128. data/lib/togai_client/models/event_pipeline_info_customer.rb +238 -0
  129. data/lib/togai_client/models/event_pipeline_info_event_schema.rb +238 -0
  130. data/lib/togai_client/models/event_pipeline_info_price_plans_inner.rb +283 -0
  131. data/lib/togai_client/models/event_pipeline_info_usage_meters_inner.rb +295 -0
  132. data/lib/togai_client/models/event_schema.rb +438 -0
  133. data/lib/togai_client/models/event_schema_list_data.rb +456 -0
  134. data/lib/togai_client/models/event_schema_list_data_all_of.rb +221 -0
  135. data/lib/togai_client/models/event_schema_list_paginated_response.rb +239 -0
  136. data/lib/togai_client/models/event_schema_versions_response.rb +227 -0
  137. data/lib/togai_client/models/event_with_status.rb +239 -0
  138. data/lib/togai_client/models/event_with_status_and_event_pipeline_info.rb +255 -0
  139. data/lib/togai_client/models/event_with_status_and_event_pipeline_info_all_of.rb +219 -0
  140. data/lib/togai_client/models/get_event_response.rb +222 -0
  141. data/lib/togai_client/models/get_events_response.rb +279 -0
  142. data/lib/togai_client/models/get_metrics_request.rb +265 -0
  143. data/lib/togai_client/models/get_metrics_response.rb +227 -0
  144. data/lib/togai_client/models/ingest_batch_event_request.rb +255 -0
  145. data/lib/togai_client/models/ingest_batch_event_response.rb +245 -0
  146. data/lib/togai_client/models/ingest_error.rb +229 -0
  147. data/lib/togai_client/models/ingest_event_request.rb +220 -0
  148. data/lib/togai_client/models/ingest_event_response.rb +244 -0
  149. data/lib/togai_client/models/ingestion_status.rb +284 -0
  150. data/lib/togai_client/models/metric_data_points.rb +289 -0
  151. data/lib/togai_client/models/metric_data_points_grouped_by.rb +238 -0
  152. data/lib/togai_client/models/metric_name.rb +38 -0
  153. data/lib/togai_client/models/metric_query.rb +331 -0
  154. data/lib/togai_client/models/metric_query_filter_entry.rb +241 -0
  155. data/lib/togai_client/models/metric_query_response.rb +255 -0
  156. data/lib/togai_client/models/pagination_options.rb +262 -0
  157. data/lib/togai_client/models/plan_override.rb +262 -0
  158. data/lib/togai_client/models/price_plan.rb +349 -0
  159. data/lib/togai_client/models/price_plan_list_data.rb +393 -0
  160. data/lib/togai_client/models/price_plan_paginated_response.rb +239 -0
  161. data/lib/togai_client/models/pricing_cycle.rb +313 -0
  162. data/lib/togai_client/models/pricing_cycle_start_offset.rb +241 -0
  163. data/lib/togai_client/models/pricing_schedule.rb +248 -0
  164. data/lib/togai_client/models/rate_card.rb +279 -0
  165. data/lib/togai_client/models/rate_card_bundle.rb +328 -0
  166. data/lib/togai_client/models/rate_card_usage_value.rb +343 -0
  167. data/lib/togai_client/models/remove_account_aliases_request.rb +247 -0
  168. data/lib/togai_client/models/signup_request.rb +293 -0
  169. data/lib/togai_client/models/signup_response.rb +260 -0
  170. data/lib/togai_client/models/status_response.rb +246 -0
  171. data/lib/togai_client/models/status_response_headers.rb +219 -0
  172. data/lib/togai_client/models/update_account_request.rb +245 -0
  173. data/lib/togai_client/models/update_customer_request.rb +304 -0
  174. data/lib/togai_client/models/update_event_schema_request.rb +306 -0
  175. data/lib/togai_client/models/update_price_plan_request.rb +254 -0
  176. data/lib/togai_client/models/update_usage_meter_request.rb +323 -0
  177. data/lib/togai_client/models/usage_meter.rb +440 -0
  178. data/lib/togai_client/models/usage_meter_paginated_response.rb +239 -0
  179. data/lib/togai_client/models/usage_strategy.rb +281 -0
  180. data/lib/togai_client/models/user_details.rb +380 -0
  181. data/lib/togai_client/version.rb +15 -0
  182. data/lib/togai_client.rb +125 -0
  183. data/spec/api_client_spec.rb +226 -0
  184. data/spec/configuration_spec.rb +42 -0
  185. data/spec/spec_helper.rb +111 -0
  186. data/togai_client.gemspec +38 -0
  187. metadata +271 -0
@@ -0,0 +1,255 @@
1
+ =begin
2
+ #Togai Apis
3
+
4
+ #APIs for Togai App
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: engg@togai.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TogaiClient
17
+ # Response to GetMetrics Request
18
+ class MetricQueryResponse
19
+ attr_accessor :id
20
+
21
+ attr_accessor :name
22
+
23
+ attr_accessor :data
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'id' => :'id',
29
+ :'name' => :'name',
30
+ :'data' => :'data'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'id' => :'String',
43
+ :'name' => :'MetricName',
44
+ :'data' => :'Array<MetricDataPoints>'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TogaiClient::MetricQueryResponse` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TogaiClient::MetricQueryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'id')
70
+ self.id = attributes[:'id']
71
+ end
72
+
73
+ if attributes.key?(:'name')
74
+ self.name = attributes[:'name']
75
+ end
76
+
77
+ if attributes.key?(:'data')
78
+ if (value = attributes[:'data']).is_a?(Array)
79
+ self.data = value
80
+ end
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @id.nil?
89
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
90
+ end
91
+
92
+ if @name.nil?
93
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
94
+ end
95
+
96
+ if @data.nil?
97
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ return false if @id.nil?
107
+ return false if @name.nil?
108
+ return false if @data.nil?
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ id == o.id &&
118
+ name == o.name &&
119
+ data == o.data
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [id, name, data].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ attributes = attributes.transform_keys(&:to_sym)
147
+ self.class.openapi_types.each_pair do |key, type|
148
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
149
+ self.send("#{key}=", nil)
150
+ elsif type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
154
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
155
+ end
156
+ elsif !attributes[self.class.attribute_map[key]].nil?
157
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
+ end
159
+ end
160
+
161
+ self
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def _deserialize(type, value)
169
+ case type.to_sym
170
+ when :Time
171
+ Time.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :Boolean
181
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ # models (e.g. Pet) or oneOf
202
+ klass = TogaiClient.const_get(type)
203
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ if value.nil?
226
+ is_nullable = self.class.openapi_nullable.include?(attr)
227
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
+ end
229
+
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ # Outputs non-array value in the form of hash
236
+ # For object, use to_hash. Otherwise, just return the value
237
+ # @param [Object] value Any valid value
238
+ # @return [Hash] Returns the value in the form of hash
239
+ def _to_hash(value)
240
+ if value.is_a?(Array)
241
+ value.compact.map { |v| _to_hash(v) }
242
+ elsif value.is_a?(Hash)
243
+ {}.tap do |hash|
244
+ value.each { |k, v| hash[k] = _to_hash(v) }
245
+ end
246
+ elsif value.respond_to? :to_hash
247
+ value.to_hash
248
+ else
249
+ value
250
+ end
251
+ end
252
+
253
+ end
254
+
255
+ end
@@ -0,0 +1,262 @@
1
+ =begin
2
+ #Togai Apis
3
+
4
+ #APIs for Togai App
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: engg@togai.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TogaiClient
17
+ class PaginationOptions
18
+ attr_accessor :page_size
19
+
20
+ attr_accessor :sort_order
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'page_size' => :'pageSize',
48
+ :'sort_order' => :'sortOrder'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'page_size' => :'Integer',
61
+ :'sort_order' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TogaiClient::PaginationOptions` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TogaiClient::PaginationOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'page_size')
87
+ self.page_size = attributes[:'page_size']
88
+ end
89
+
90
+ if attributes.key?(:'sort_order')
91
+ self.sort_order = attributes[:'sort_order']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ sort_order_validator = EnumAttributeValidator.new('String', ["ASC", "DESC"])
106
+ return false unless sort_order_validator.valid?(@sort_order)
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method checking allowed values (enum).
111
+ # @param [Object] sort_order Object to be assigned
112
+ def sort_order=(sort_order)
113
+ validator = EnumAttributeValidator.new('String', ["ASC", "DESC"])
114
+ unless validator.valid?(sort_order)
115
+ fail ArgumentError, "invalid value for \"sort_order\", must be one of #{validator.allowable_values}."
116
+ end
117
+ @sort_order = sort_order
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ page_size == o.page_size &&
126
+ sort_order == o.sort_order
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [page_size, sort_order].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ new.build_from_hash(attributes)
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ attributes = attributes.transform_keys(&:to_sym)
154
+ self.class.openapi_types.each_pair do |key, type|
155
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
156
+ self.send("#{key}=", nil)
157
+ elsif type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :Time
178
+ Time.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ # models (e.g. Pet) or oneOf
209
+ klass = TogaiClient.const_get(type)
210
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ if value.nil?
233
+ is_nullable = self.class.openapi_nullable.include?(attr)
234
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
+ end
236
+
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value)
247
+ if value.is_a?(Array)
248
+ value.compact.map { |v| _to_hash(v) }
249
+ elsif value.is_a?(Hash)
250
+ {}.tap do |hash|
251
+ value.each { |k, v| hash[k] = _to_hash(v) }
252
+ end
253
+ elsif value.respond_to? :to_hash
254
+ value.to_hash
255
+ else
256
+ value
257
+ end
258
+ end
259
+
260
+ end
261
+
262
+ end