seatschart 0.3.0 → 0.5.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +79 -11
  3. data/lib/seatschart/api/audit_api.rb +2 -2
  4. data/lib/seatschart/api/auth_api.rb +85 -8
  5. data/lib/seatschart/api/billing_api.rb +93 -8
  6. data/lib/seatschart/api/charts_api.rb +63 -63
  7. data/lib/seatschart/api/events_api.rb +130 -124
  8. data/lib/seatschart/api/public_api.rb +6 -6
  9. data/lib/seatschart/api/seasons_api.rb +88 -88
  10. data/lib/seatschart/api/seats_api.rb +6 -6
  11. data/lib/seatschart/api/usage_api.rb +4 -4
  12. data/lib/seatschart/api/workspace_api.rb +1229 -51
  13. data/lib/seatschart/models/{api_error.rb → api_error_body.rb} +7 -7
  14. data/lib/seatschart/models/delete_api_workspaces_by_workspace_id_keys_by_key_id200_response.rb +237 -0
  15. data/lib/seatschart/models/delete_api_workspaces_by_workspace_id_members_by_user_id200_response.rb +221 -0
  16. data/lib/seatschart/models/get_api_workspaces200_response_items_inner.rb +50 -4
  17. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response.rb +239 -0
  18. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response_invitations_inner.rb +286 -0
  19. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_keys200_response.rb +239 -0
  20. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_keys200_response_api_keys_inner.rb +321 -0
  21. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_members200_response.rb +239 -0
  22. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_members200_response_members_inner.rb +288 -0
  23. data/lib/seatschart/models/get_api_workspaces_overview200_response.rb +288 -0
  24. data/lib/seatschart/models/get_api_workspaces_overview200_response_account.rb +270 -0
  25. data/lib/seatschart/models/get_api_workspaces_overview200_response_account_charts.rb +233 -0
  26. data/lib/seatschart/models/get_api_workspaces_overview200_response_account_plan.rb +237 -0
  27. data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner.rb +439 -0
  28. data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner_revenue.rb +234 -0
  29. data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner_usage.rb +271 -0
  30. data/lib/seatschart/models/get_api_workspaces_overview200_response_seats.rb +431 -0
  31. data/lib/seatschart/models/get_api_workspaces_overview200_response_seats_overage.rb +233 -0
  32. data/lib/seatschart/models/get_api_workspaces_overview200_response_seats_projected.rb +237 -0
  33. data/lib/seatschart/models/get_api_workspaces_overview200_response_totals.rb +318 -0
  34. data/lib/seatschart/models/get_api_workspaces_overview200_response_totals_revenue.rb +238 -0
  35. data/lib/seatschart/models/get_api_workspaces_overview200_response_totals_seats.rb +253 -0
  36. data/lib/seatschart/models/patch_api_events_by_event_id_request.rb +15 -15
  37. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_keys_by_key_id200_response.rb +221 -0
  38. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_keys_by_key_id_request.rb +292 -0
  39. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_request.rb +288 -0
  40. data/lib/seatschart/models/post_api_auth_new_workspace_request.rb +294 -0
  41. data/lib/seatschart/models/post_api_billing_actions_change_plan_request.rb +256 -0
  42. data/lib/seatschart/models/post_api_events_by_event_id_actions_update_extra_data_request_objects_inner.rb +0 -2
  43. data/lib/seatschart/models/post_api_sandboxes201_response.rb +0 -4
  44. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_reset200_response.rb +0 -2
  45. data/lib/seatschart/models/post_api_workspaces200_response.rb +464 -0
  46. data/lib/seatschart/models/post_api_workspaces200_response_api_key.rb +332 -0
  47. data/lib/seatschart/models/post_api_workspaces200_response_template.rb +260 -0
  48. data/lib/seatschart/models/post_api_workspaces200_response_template_webhooks_inner.rb +284 -0
  49. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_actions_delete200_response.rb +319 -0
  50. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_actions_delete_request.rb +281 -0
  51. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response.rb +238 -0
  52. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response_invitation.rb +286 -0
  53. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations_request.rb +300 -0
  54. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys201_response.rb +237 -0
  55. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys201_response_api_key.rb +338 -0
  56. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys_request.rb +299 -0
  57. data/lib/seatschart/models/post_api_workspaces_request.rb +100 -4
  58. data/lib/seatschart/models/post_api_workspaces_request_issue_key.rb +294 -0
  59. data/lib/seatschart/version.rb +1 -1
  60. data/lib/seatschart/workspaces.rb +172 -0
  61. data/lib/seatschart.rb +41 -2
  62. metadata +43 -4
  63. data/lib/seatschart/models/put_api_charts_by_chart_id_map_draft_request.rb +0 -349
@@ -0,0 +1,271 @@
1
+ =begin
2
+ #SeatsChart API
3
+
4
+ #Seat inventory and locking API for B2B2C integrations. Authenticate using `x-api-key` (partners) or `Authorization: Bearer` with an HS256 JWT.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SeatsChart
17
+ class GetApiWorkspacesOverview200ResponseItemsInnerUsage
18
+ # `YYYY-MM`.
19
+ attr_accessor :month
20
+
21
+ attr_accessor :used_objects
22
+
23
+ attr_accessor :used_seats
24
+
25
+ # Used seats of the month at the current pace.
26
+ attr_accessor :projected_seats
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'month' => :'month',
32
+ :'used_objects' => :'usedObjects',
33
+ :'used_seats' => :'usedSeats',
34
+ :'projected_seats' => :'projectedSeats'
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'month' => :'String',
47
+ :'used_objects' => :'Integer',
48
+ :'used_seats' => :'Integer',
49
+ :'projected_seats' => :'Integer'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::GetApiWorkspacesOverview200ResponseItemsInnerUsage` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::GetApiWorkspacesOverview200ResponseItemsInnerUsage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'month')
75
+ self.month = attributes[:'month']
76
+ else
77
+ self.month = nil
78
+ end
79
+
80
+ if attributes.key?(:'used_objects')
81
+ self.used_objects = attributes[:'used_objects']
82
+ else
83
+ self.used_objects = nil
84
+ end
85
+
86
+ if attributes.key?(:'used_seats')
87
+ self.used_seats = attributes[:'used_seats']
88
+ else
89
+ self.used_seats = nil
90
+ end
91
+
92
+ if attributes.key?(:'projected_seats')
93
+ self.projected_seats = attributes[:'projected_seats']
94
+ else
95
+ self.projected_seats = nil
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @month.nil?
105
+ invalid_properties.push('invalid value for "month", month cannot be nil.')
106
+ end
107
+
108
+ if @used_objects.nil?
109
+ invalid_properties.push('invalid value for "used_objects", used_objects cannot be nil.')
110
+ end
111
+
112
+ if @used_seats.nil?
113
+ invalid_properties.push('invalid value for "used_seats", used_seats cannot be nil.')
114
+ end
115
+
116
+ if @projected_seats.nil?
117
+ invalid_properties.push('invalid value for "projected_seats", projected_seats cannot be nil.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ return false if @month.nil?
128
+ return false if @used_objects.nil?
129
+ return false if @used_seats.nil?
130
+ return false if @projected_seats.nil?
131
+ true
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ month == o.month &&
140
+ used_objects == o.used_objects &&
141
+ used_seats == o.used_seats &&
142
+ projected_seats == o.projected_seats
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [month, used_objects, used_seats, projected_seats].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ attributes = attributes.transform_keys(&:to_sym)
163
+ transformed_hash = {}
164
+ openapi_types.each_pair do |key, type|
165
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def self._deserialize(type, value)
185
+ case type.to_sym
186
+ when :Time
187
+ Time.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ # models (e.g. Pet) or oneOf
218
+ klass = SeatsChart.const_get(type)
219
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end
@@ -0,0 +1,431 @@
1
+ =begin
2
+ #SeatsChart API
3
+
4
+ #Seat inventory and locking API for B2B2C integrations. Authenticate using `x-api-key` (partners) or `Authorization: Bearer` with an HS256 JWT.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SeatsChart
17
+ # Seat billing of the caller's billing account for the month; `null` without an account.
18
+ class GetApiWorkspacesOverview200ResponseSeats
19
+ attr_accessor :month
20
+
21
+ attr_accessor :plan_id
22
+
23
+ attr_accessor :mode
24
+
25
+ attr_accessor :used_seats
26
+
27
+ attr_accessor :included_seats
28
+
29
+ # US cents per seat beyond the included ones (may be fractional).
30
+ attr_accessor :overage_price_cents_per_seat
31
+
32
+ attr_accessor :overage
33
+
34
+ attr_accessor :allowance_exceeded
35
+
36
+ attr_accessor :allowance_near
37
+
38
+ attr_accessor :projected
39
+
40
+ attr_accessor :billing_owner_user_id
41
+
42
+ attr_accessor :rolled_up
43
+
44
+ attr_accessor :workspace_count
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.include?(value)
65
+ end
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'month' => :'month',
72
+ :'plan_id' => :'planId',
73
+ :'mode' => :'mode',
74
+ :'used_seats' => :'usedSeats',
75
+ :'included_seats' => :'includedSeats',
76
+ :'overage_price_cents_per_seat' => :'overagePriceCentsPerSeat',
77
+ :'overage' => :'overage',
78
+ :'allowance_exceeded' => :'allowanceExceeded',
79
+ :'allowance_near' => :'allowanceNear',
80
+ :'projected' => :'projected',
81
+ :'billing_owner_user_id' => :'billingOwnerUserId',
82
+ :'rolled_up' => :'rolledUp',
83
+ :'workspace_count' => :'workspaceCount'
84
+ }
85
+ end
86
+
87
+ # Returns all the JSON keys this model knows about
88
+ def self.acceptable_attributes
89
+ attribute_map.values
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'month' => :'String',
96
+ :'plan_id' => :'String',
97
+ :'mode' => :'String',
98
+ :'used_seats' => :'Integer',
99
+ :'included_seats' => :'Integer',
100
+ :'overage_price_cents_per_seat' => :'Float',
101
+ :'overage' => :'GetApiWorkspacesOverview200ResponseSeatsOverage',
102
+ :'allowance_exceeded' => :'Boolean',
103
+ :'allowance_near' => :'Boolean',
104
+ :'projected' => :'GetApiWorkspacesOverview200ResponseSeatsProjected',
105
+ :'billing_owner_user_id' => :'String',
106
+ :'rolled_up' => :'Boolean',
107
+ :'workspace_count' => :'Integer'
108
+ }
109
+ end
110
+
111
+ # List of attributes with nullable: true
112
+ def self.openapi_nullable
113
+ Set.new([
114
+ :'included_seats',
115
+ :'overage_price_cents_per_seat',
116
+ :'projected',
117
+ :'billing_owner_user_id',
118
+ ])
119
+ end
120
+
121
+ # Initializes the object
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ def initialize(attributes = {})
124
+ if (!attributes.is_a?(Hash))
125
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::GetApiWorkspacesOverview200ResponseSeats` initialize method"
126
+ end
127
+
128
+ # check to see if the attribute exists and convert string to symbol for hash key
129
+ attributes = attributes.each_with_object({}) { |(k, v), h|
130
+ if (!self.class.attribute_map.key?(k.to_sym))
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::GetApiWorkspacesOverview200ResponseSeats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
132
+ end
133
+ h[k.to_sym] = v
134
+ }
135
+
136
+ if attributes.key?(:'month')
137
+ self.month = attributes[:'month']
138
+ else
139
+ self.month = nil
140
+ end
141
+
142
+ if attributes.key?(:'plan_id')
143
+ self.plan_id = attributes[:'plan_id']
144
+ else
145
+ self.plan_id = nil
146
+ end
147
+
148
+ if attributes.key?(:'mode')
149
+ self.mode = attributes[:'mode']
150
+ else
151
+ self.mode = nil
152
+ end
153
+
154
+ if attributes.key?(:'used_seats')
155
+ self.used_seats = attributes[:'used_seats']
156
+ else
157
+ self.used_seats = nil
158
+ end
159
+
160
+ if attributes.key?(:'included_seats')
161
+ self.included_seats = attributes[:'included_seats']
162
+ else
163
+ self.included_seats = nil
164
+ end
165
+
166
+ if attributes.key?(:'overage_price_cents_per_seat')
167
+ self.overage_price_cents_per_seat = attributes[:'overage_price_cents_per_seat']
168
+ else
169
+ self.overage_price_cents_per_seat = nil
170
+ end
171
+
172
+ if attributes.key?(:'overage')
173
+ self.overage = attributes[:'overage']
174
+ else
175
+ self.overage = nil
176
+ end
177
+
178
+ if attributes.key?(:'allowance_exceeded')
179
+ self.allowance_exceeded = attributes[:'allowance_exceeded']
180
+ else
181
+ self.allowance_exceeded = nil
182
+ end
183
+
184
+ if attributes.key?(:'allowance_near')
185
+ self.allowance_near = attributes[:'allowance_near']
186
+ else
187
+ self.allowance_near = nil
188
+ end
189
+
190
+ if attributes.key?(:'projected')
191
+ self.projected = attributes[:'projected']
192
+ end
193
+
194
+ if attributes.key?(:'billing_owner_user_id')
195
+ self.billing_owner_user_id = attributes[:'billing_owner_user_id']
196
+ else
197
+ self.billing_owner_user_id = nil
198
+ end
199
+
200
+ if attributes.key?(:'rolled_up')
201
+ self.rolled_up = attributes[:'rolled_up']
202
+ else
203
+ self.rolled_up = nil
204
+ end
205
+
206
+ if attributes.key?(:'workspace_count')
207
+ self.workspace_count = attributes[:'workspace_count']
208
+ else
209
+ self.workspace_count = nil
210
+ end
211
+ end
212
+
213
+ # Show invalid properties with the reasons. Usually used together with valid?
214
+ # @return Array for valid properties with the reasons
215
+ def list_invalid_properties
216
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
217
+ invalid_properties = Array.new
218
+ if @month.nil?
219
+ invalid_properties.push('invalid value for "month", month cannot be nil.')
220
+ end
221
+
222
+ if @plan_id.nil?
223
+ invalid_properties.push('invalid value for "plan_id", plan_id cannot be nil.')
224
+ end
225
+
226
+ if @mode.nil?
227
+ invalid_properties.push('invalid value for "mode", mode cannot be nil.')
228
+ end
229
+
230
+ if @used_seats.nil?
231
+ invalid_properties.push('invalid value for "used_seats", used_seats cannot be nil.')
232
+ end
233
+
234
+ if @overage.nil?
235
+ invalid_properties.push('invalid value for "overage", overage cannot be nil.')
236
+ end
237
+
238
+ if @allowance_exceeded.nil?
239
+ invalid_properties.push('invalid value for "allowance_exceeded", allowance_exceeded cannot be nil.')
240
+ end
241
+
242
+ if @allowance_near.nil?
243
+ invalid_properties.push('invalid value for "allowance_near", allowance_near cannot be nil.')
244
+ end
245
+
246
+ if @rolled_up.nil?
247
+ invalid_properties.push('invalid value for "rolled_up", rolled_up cannot be nil.')
248
+ end
249
+
250
+ if @workspace_count.nil?
251
+ invalid_properties.push('invalid value for "workspace_count", workspace_count cannot be nil.')
252
+ end
253
+
254
+ invalid_properties
255
+ end
256
+
257
+ # Check to see if the all the properties in the model are valid
258
+ # @return true if the model is valid
259
+ def valid?
260
+ warn '[DEPRECATED] the `valid?` method is obsolete'
261
+ return false if @month.nil?
262
+ return false if @plan_id.nil?
263
+ return false if @mode.nil?
264
+ mode_validator = EnumAttributeValidator.new('String', ["allowance", "overage", "on_demand"])
265
+ return false unless mode_validator.valid?(@mode)
266
+ return false if @used_seats.nil?
267
+ return false if @overage.nil?
268
+ return false if @allowance_exceeded.nil?
269
+ return false if @allowance_near.nil?
270
+ return false if @rolled_up.nil?
271
+ return false if @workspace_count.nil?
272
+ true
273
+ end
274
+
275
+ # Custom attribute writer method checking allowed values (enum).
276
+ # @param [Object] mode Object to be assigned
277
+ def mode=(mode)
278
+ validator = EnumAttributeValidator.new('String', ["allowance", "overage", "on_demand"])
279
+ unless validator.valid?(mode)
280
+ fail ArgumentError, "invalid value for \"mode\", must be one of #{validator.allowable_values}."
281
+ end
282
+ @mode = mode
283
+ end
284
+
285
+ # Checks equality by comparing each attribute.
286
+ # @param [Object] Object to be compared
287
+ def ==(o)
288
+ return true if self.equal?(o)
289
+ self.class == o.class &&
290
+ month == o.month &&
291
+ plan_id == o.plan_id &&
292
+ mode == o.mode &&
293
+ used_seats == o.used_seats &&
294
+ included_seats == o.included_seats &&
295
+ overage_price_cents_per_seat == o.overage_price_cents_per_seat &&
296
+ overage == o.overage &&
297
+ allowance_exceeded == o.allowance_exceeded &&
298
+ allowance_near == o.allowance_near &&
299
+ projected == o.projected &&
300
+ billing_owner_user_id == o.billing_owner_user_id &&
301
+ rolled_up == o.rolled_up &&
302
+ workspace_count == o.workspace_count
303
+ end
304
+
305
+ # @see the `==` method
306
+ # @param [Object] Object to be compared
307
+ def eql?(o)
308
+ self == o
309
+ end
310
+
311
+ # Calculates hash code according to all attributes.
312
+ # @return [Integer] Hash code
313
+ def hash
314
+ [month, plan_id, mode, used_seats, included_seats, overage_price_cents_per_seat, overage, allowance_exceeded, allowance_near, projected, billing_owner_user_id, rolled_up, workspace_count].hash
315
+ end
316
+
317
+ # Builds the object from hash
318
+ # @param [Hash] attributes Model attributes in the form of hash
319
+ # @return [Object] Returns the model itself
320
+ def self.build_from_hash(attributes)
321
+ return nil unless attributes.is_a?(Hash)
322
+ attributes = attributes.transform_keys(&:to_sym)
323
+ transformed_hash = {}
324
+ openapi_types.each_pair do |key, type|
325
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
326
+ transformed_hash["#{key}"] = nil
327
+ elsif type =~ /\AArray<(.*)>/i
328
+ # check to ensure the input is an array given that the attribute
329
+ # is documented as an array but the input is not
330
+ if attributes[attribute_map[key]].is_a?(Array)
331
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
332
+ end
333
+ elsif !attributes[attribute_map[key]].nil?
334
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
335
+ end
336
+ end
337
+ new(transformed_hash)
338
+ end
339
+
340
+ # Deserializes the data based on type
341
+ # @param string type Data type
342
+ # @param string value Value to be deserialized
343
+ # @return [Object] Deserialized data
344
+ def self._deserialize(type, value)
345
+ case type.to_sym
346
+ when :Time
347
+ Time.parse(value)
348
+ when :Date
349
+ Date.parse(value)
350
+ when :String
351
+ value.to_s
352
+ when :Integer
353
+ value.to_i
354
+ when :Float
355
+ value.to_f
356
+ when :Boolean
357
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
358
+ true
359
+ else
360
+ false
361
+ end
362
+ when :Object
363
+ # generic object (usually a Hash), return directly
364
+ value
365
+ when /\AArray<(?<inner_type>.+)>\z/
366
+ inner_type = Regexp.last_match[:inner_type]
367
+ value.map { |v| _deserialize(inner_type, v) }
368
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
369
+ k_type = Regexp.last_match[:k_type]
370
+ v_type = Regexp.last_match[:v_type]
371
+ {}.tap do |hash|
372
+ value.each do |k, v|
373
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
374
+ end
375
+ end
376
+ else # model
377
+ # models (e.g. Pet) or oneOf
378
+ klass = SeatsChart.const_get(type)
379
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
380
+ end
381
+ end
382
+
383
+ # Returns the string representation of the object
384
+ # @return [String] String presentation of the object
385
+ def to_s
386
+ to_hash.to_s
387
+ end
388
+
389
+ # to_body is an alias to to_hash (backward compatibility)
390
+ # @return [Hash] Returns the object in the form of hash
391
+ def to_body
392
+ to_hash
393
+ end
394
+
395
+ # Returns the object in the form of hash
396
+ # @return [Hash] Returns the object in the form of hash
397
+ def to_hash
398
+ hash = {}
399
+ self.class.attribute_map.each_pair do |attr, param|
400
+ value = self.send(attr)
401
+ if value.nil?
402
+ is_nullable = self.class.openapi_nullable.include?(attr)
403
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
404
+ end
405
+
406
+ hash[param] = _to_hash(value)
407
+ end
408
+ hash
409
+ end
410
+
411
+ # Outputs non-array value in the form of hash
412
+ # For object, use to_hash. Otherwise, just return the value
413
+ # @param [Object] value Any valid value
414
+ # @return [Hash] Returns the value in the form of hash
415
+ def _to_hash(value)
416
+ if value.is_a?(Array)
417
+ value.compact.map { |v| _to_hash(v) }
418
+ elsif value.is_a?(Hash)
419
+ {}.tap do |hash|
420
+ value.each { |k, v| hash[k] = _to_hash(v) }
421
+ end
422
+ elsif value.respond_to? :to_hash
423
+ value.to_hash
424
+ else
425
+ value
426
+ end
427
+ end
428
+
429
+ end
430
+
431
+ end