togai_client 1.0.0 → 1.0.1

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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/docs/AccountsApi.md +1 -1
  4. data/docs/AssociatePricePlanRequest.md +4 -4
  5. data/docs/Bundle.md +22 -0
  6. data/docs/CreatePricePlanRequest.md +2 -4
  7. data/docs/EventPipelineInfoPricePlansInner.md +2 -0
  8. data/docs/EventSchemaListData.md +2 -2
  9. data/docs/EventSchemaListDataAllOf.md +2 -2
  10. data/docs/GetEventResponse.md +1 -1
  11. data/docs/PlanOverride.md +2 -2
  12. data/docs/PricePlan.md +0 -2
  13. data/docs/PricePlanDetails.md +20 -0
  14. data/docs/PricePlanDetailsOverride.md +20 -0
  15. data/docs/PricePlanListData.md +2 -4
  16. data/docs/PricePlanPaginatedResponse.md +1 -1
  17. data/docs/PricePlansApi.md +1 -1
  18. data/docs/PriceType.md +15 -0
  19. data/docs/{PricingCycle.md → PricingCycleConfig.md} +3 -3
  20. data/docs/{PricingCycleStartOffset.md → PricingCycleConfigStartOffset.md} +2 -2
  21. data/docs/PricingModel.md +15 -0
  22. data/docs/PricingSchedule.md +2 -2
  23. data/docs/RateCard.md +6 -6
  24. data/docs/RateCardBundleAggregation.md +15 -0
  25. data/docs/RateCardType.md +15 -0
  26. data/docs/RateConfigBundle.md +20 -0
  27. data/docs/RateConfigUsage.md +20 -0
  28. data/docs/SlabBundle.md +24 -0
  29. data/docs/{UsageStrategy.md → SlabUsage.md} +6 -2
  30. data/docs/UpdatePricePlanRequest.md +2 -4
  31. data/examples/example.rb +222 -0
  32. data/lib/togai_client/models/associate_price_plan_request.rb +17 -7
  33. data/lib/togai_client/models/{bundle_strategy.rb → bundle.rb} +34 -85
  34. data/lib/togai_client/models/create_customer_request.rb +0 -9
  35. data/lib/togai_client/models/create_customer_response.rb +0 -9
  36. data/lib/togai_client/models/create_price_plan_request.rb +10 -24
  37. data/lib/togai_client/models/customer.rb +0 -9
  38. data/lib/togai_client/models/event_pipeline_info_price_plans_inner.rb +15 -1
  39. data/lib/togai_client/models/event_schema_list_data.rb +7 -9
  40. data/lib/togai_client/models/event_schema_list_data_all_of.rb +7 -9
  41. data/lib/togai_client/models/get_event_response.rb +5 -0
  42. data/lib/togai_client/models/ingestion_status.rb +2 -2
  43. data/lib/togai_client/models/plan_override.rb +7 -7
  44. data/lib/togai_client/models/price_plan.rb +1 -15
  45. data/lib/togai_client/models/price_plan_details.rb +259 -0
  46. data/lib/togai_client/models/price_plan_details_override.rb +245 -0
  47. data/lib/togai_client/models/price_plan_list_data.rb +10 -25
  48. data/lib/togai_client/models/price_plan_paginated_response.rb +5 -0
  49. data/lib/togai_client/models/price_type.rb +38 -0
  50. data/lib/togai_client/models/{pricing_cycle.rb → pricing_cycle_config.rb} +4 -4
  51. data/lib/togai_client/models/{pricing_cycle_start_offset.rb → pricing_cycle_config_start_offset.rb} +3 -3
  52. data/lib/togai_client/models/pricing_model.rb +37 -0
  53. data/lib/togai_client/models/pricing_schedule.rb +7 -7
  54. data/lib/togai_client/models/rate_card.rb +32 -59
  55. data/lib/togai_client/models/rate_card_bundle_aggregation.rb +39 -0
  56. data/lib/togai_client/models/rate_card_type.rb +37 -0
  57. data/lib/togai_client/models/{bundle_strategy_usage_meters_value.rb → rate_config_bundle.rb} +28 -13
  58. data/lib/togai_client/models/{rate_card_usage_value.rb → rate_config_usage.rb} +15 -98
  59. data/lib/togai_client/models/signup_request.rb +0 -11
  60. data/lib/togai_client/models/slab_bundle.rb +264 -0
  61. data/lib/togai_client/models/{usage_strategy.rb → slab_usage.rb} +30 -5
  62. data/lib/togai_client/models/update_customer_request.rb +0 -9
  63. data/lib/togai_client/models/update_price_plan_request.rb +7 -16
  64. data/lib/togai_client/models/user_details.rb +0 -11
  65. data/lib/togai_client/version.rb +1 -1
  66. data/lib/togai_client.rb +13 -7
  67. metadata +36 -23
  68. data/docs/BundleStrategy.md +0 -24
  69. data/docs/BundleStrategyUsageMetersValue.md +0 -18
  70. data/docs/RateCardBundle.md +0 -22
  71. data/docs/RateCardUsageValue.md +0 -24
  72. data/lib/togai_client/models/rate_card_bundle.rb +0 -328
@@ -19,6 +19,8 @@ module TogaiClient
19
19
 
20
20
  attr_accessor :id
21
21
 
22
+ attr_accessor :schedule_id
23
+
22
24
  attr_accessor :cycle_start
23
25
 
24
26
  attr_accessor :cycle_end
@@ -30,6 +32,7 @@ module TogaiClient
30
32
  {
31
33
  :'name' => :'name',
32
34
  :'id' => :'id',
35
+ :'schedule_id' => :'scheduleId',
33
36
  :'cycle_start' => :'cycleStart',
34
37
  :'cycle_end' => :'cycleEnd',
35
38
  :'usage_meters' => :'usageMeters'
@@ -46,6 +49,7 @@ module TogaiClient
46
49
  {
47
50
  :'name' => :'String',
48
51
  :'id' => :'String',
52
+ :'schedule_id' => :'String',
49
53
  :'cycle_start' => :'Date',
50
54
  :'cycle_end' => :'Date',
51
55
  :'usage_meters' => :'Array<String>'
@@ -81,6 +85,10 @@ module TogaiClient
81
85
  self.id = attributes[:'id']
82
86
  end
83
87
 
88
+ if attributes.key?(:'schedule_id')
89
+ self.schedule_id = attributes[:'schedule_id']
90
+ end
91
+
84
92
  if attributes.key?(:'cycle_start')
85
93
  self.cycle_start = attributes[:'cycle_start']
86
94
  end
@@ -108,6 +116,10 @@ module TogaiClient
108
116
  invalid_properties.push('invalid value for "id", id cannot be nil.')
109
117
  end
110
118
 
119
+ if @schedule_id.nil?
120
+ invalid_properties.push('invalid value for "schedule_id", schedule_id cannot be nil.')
121
+ end
122
+
111
123
  if @cycle_start.nil?
112
124
  invalid_properties.push('invalid value for "cycle_start", cycle_start cannot be nil.')
113
125
  end
@@ -124,6 +136,7 @@ module TogaiClient
124
136
  def valid?
125
137
  return false if @name.nil?
126
138
  return false if @id.nil?
139
+ return false if @schedule_id.nil?
127
140
  return false if @cycle_start.nil?
128
141
  return false if @cycle_end.nil?
129
142
  true
@@ -142,6 +155,7 @@ module TogaiClient
142
155
  self.class == o.class &&
143
156
  name == o.name &&
144
157
  id == o.id &&
158
+ schedule_id == o.schedule_id &&
145
159
  cycle_start == o.cycle_start &&
146
160
  cycle_end == o.cycle_end &&
147
161
  usage_meters == o.usage_meters
@@ -156,7 +170,7 @@ module TogaiClient
156
170
  # Calculates hash code according to all attributes.
157
171
  # @return [Integer] Hash code
158
172
  def hash
159
- [name, id, cycle_start, cycle_end, usage_meters].hash
173
+ [name, id, schedule_id, cycle_start, cycle_end, usage_meters].hash
160
174
  end
161
175
 
162
176
  # Builds the object from hash
@@ -35,7 +35,7 @@ module TogaiClient
35
35
 
36
36
  attr_accessor :updated_at
37
37
 
38
- attr_accessor :associated_usage_meters
38
+ attr_accessor :usage_meters_count
39
39
 
40
40
  class EnumAttributeValidator
41
41
  attr_reader :datatype
@@ -70,7 +70,7 @@ module TogaiClient
70
70
  :'dimensions' => :'dimensions',
71
71
  :'created_at' => :'createdAt',
72
72
  :'updated_at' => :'updatedAt',
73
- :'associated_usage_meters' => :'associatedUsageMeters'
73
+ :'usage_meters_count' => :'usageMetersCount'
74
74
  }
75
75
  end
76
76
 
@@ -90,7 +90,7 @@ module TogaiClient
90
90
  :'dimensions' => :'Array<DimensionsSchema>',
91
91
  :'created_at' => :'Time',
92
92
  :'updated_at' => :'Time',
93
- :'associated_usage_meters' => :'Array<String>'
93
+ :'usage_meters_count' => :'Integer'
94
94
  }
95
95
  end
96
96
 
@@ -159,10 +159,8 @@ module TogaiClient
159
159
  self.updated_at = attributes[:'updated_at']
160
160
  end
161
161
 
162
- if attributes.key?(:'associated_usage_meters')
163
- if (value = attributes[:'associated_usage_meters']).is_a?(Array)
164
- self.associated_usage_meters = value
165
- end
162
+ if attributes.key?(:'usage_meters_count')
163
+ self.usage_meters_count = attributes[:'usage_meters_count']
166
164
  end
167
165
  end
168
166
 
@@ -317,7 +315,7 @@ module TogaiClient
317
315
  dimensions == o.dimensions &&
318
316
  created_at == o.created_at &&
319
317
  updated_at == o.updated_at &&
320
- associated_usage_meters == o.associated_usage_meters
318
+ usage_meters_count == o.usage_meters_count
321
319
  end
322
320
 
323
321
  # @see the `==` method
@@ -329,7 +327,7 @@ module TogaiClient
329
327
  # Calculates hash code according to all attributes.
330
328
  # @return [Integer] Hash code
331
329
  def hash
332
- [name, description, version, status, attributes, dimensions, created_at, updated_at, associated_usage_meters].hash
330
+ [name, description, version, status, attributes, dimensions, created_at, updated_at, usage_meters_count].hash
333
331
  end
334
332
 
335
333
  # Builds the object from hash
@@ -15,12 +15,12 @@ require 'time'
15
15
 
16
16
  module TogaiClient
17
17
  class EventSchemaListDataAllOf
18
- attr_accessor :associated_usage_meters
18
+ attr_accessor :usage_meters_count
19
19
 
20
20
  # Attribute mapping from ruby-style variable name to JSON key.
21
21
  def self.attribute_map
22
22
  {
23
- :'associated_usage_meters' => :'associatedUsageMeters'
23
+ :'usage_meters_count' => :'usageMetersCount'
24
24
  }
25
25
  end
26
26
 
@@ -32,7 +32,7 @@ module TogaiClient
32
32
  # Attribute type mapping.
33
33
  def self.openapi_types
34
34
  {
35
- :'associated_usage_meters' => :'Array<String>'
35
+ :'usage_meters_count' => :'Integer'
36
36
  }
37
37
  end
38
38
 
@@ -57,10 +57,8 @@ module TogaiClient
57
57
  h[k.to_sym] = v
58
58
  }
59
59
 
60
- if attributes.key?(:'associated_usage_meters')
61
- if (value = attributes[:'associated_usage_meters']).is_a?(Array)
62
- self.associated_usage_meters = value
63
- end
60
+ if attributes.key?(:'usage_meters_count')
61
+ self.usage_meters_count = attributes[:'usage_meters_count']
64
62
  end
65
63
  end
66
64
 
@@ -82,7 +80,7 @@ module TogaiClient
82
80
  def ==(o)
83
81
  return true if self.equal?(o)
84
82
  self.class == o.class &&
85
- associated_usage_meters == o.associated_usage_meters
83
+ usage_meters_count == o.usage_meters_count
86
84
  end
87
85
 
88
86
  # @see the `==` method
@@ -94,7 +92,7 @@ module TogaiClient
94
92
  # Calculates hash code according to all attributes.
95
93
  # @return [Integer] Hash code
96
94
  def hash
97
- [associated_usage_meters].hash
95
+ [usage_meters_count].hash
98
96
  end
99
97
 
100
98
  # Builds the object from hash
@@ -69,12 +69,17 @@ module TogaiClient
69
69
  # @return Array for valid properties with the reasons
70
70
  def list_invalid_properties
71
71
  invalid_properties = Array.new
72
+ if @events.nil?
73
+ invalid_properties.push('invalid value for "events", events cannot be nil.')
74
+ end
75
+
72
76
  invalid_properties
73
77
  end
74
78
 
75
79
  # Check to see if the all the properties in the model are valid
76
80
  # @return true if the model is valid
77
81
  def valid?
82
+ return false if @events.nil?
78
83
  true
79
84
  end
80
85
 
@@ -113,7 +113,7 @@ module TogaiClient
113
113
  # @return true if the model is valid
114
114
  def valid?
115
115
  return false if @status.nil?
116
- status_validator = EnumAttributeValidator.new('String', ["INGESTION_IN_PROGRESS", "INGESTION_FAILED", "INGESTION_FAILED_SCHEMA_NOT_DEFINED", "INGESTION_FAILED_UNITS_INVALID", "INGESTION_COMPLETED_NO_MATCHING_METERS", "INGESTION_COMPLETED_EVENT_METERED", "INGESTION_COMPLETED_EVENT_NOT_METERED", "UNKNOWN"])
116
+ status_validator = EnumAttributeValidator.new('String', ["INGESTION_IN_PROGRESS", "INGESTION_FAILED", "INGESTION_FAILED_SCHEMA_NOT_DEFINED", "INGESTION_FAILED_UNITS_INVALID", "INGESTION_FAILED_EVENT_INVALID", "INGESTION_COMPLETED_NO_MATCHING_METERS", "INGESTION_COMPLETED_EVENT_METERED", "INGESTION_COMPLETED_EVENT_NOT_METERED", "UNKNOWN"])
117
117
  return false unless status_validator.valid?(@status)
118
118
  return false if !@status_description.nil? && @status_description.to_s.length > 250
119
119
  true
@@ -122,7 +122,7 @@ module TogaiClient
122
122
  # Custom attribute writer method checking allowed values (enum).
123
123
  # @param [Object] status Object to be assigned
124
124
  def status=(status)
125
- validator = EnumAttributeValidator.new('String', ["INGESTION_IN_PROGRESS", "INGESTION_FAILED", "INGESTION_FAILED_SCHEMA_NOT_DEFINED", "INGESTION_FAILED_UNITS_INVALID", "INGESTION_COMPLETED_NO_MATCHING_METERS", "INGESTION_COMPLETED_EVENT_METERED", "INGESTION_COMPLETED_EVENT_NOT_METERED", "UNKNOWN"])
125
+ validator = EnumAttributeValidator.new('String', ["INGESTION_IN_PROGRESS", "INGESTION_FAILED", "INGESTION_FAILED_SCHEMA_NOT_DEFINED", "INGESTION_FAILED_UNITS_INVALID", "INGESTION_FAILED_EVENT_INVALID", "INGESTION_COMPLETED_NO_MATCHING_METERS", "INGESTION_COMPLETED_EVENT_METERED", "INGESTION_COMPLETED_EVENT_NOT_METERED", "UNKNOWN"])
126
126
  unless validator.valid?(status)
127
127
  fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
128
128
  end
@@ -18,7 +18,7 @@ module TogaiClient
18
18
  class PlanOverride
19
19
  attr_accessor :price_plan_name
20
20
 
21
- attr_accessor :override
21
+ attr_accessor :price_plan_details_override
22
22
 
23
23
  attr_accessor :start_date
24
24
 
@@ -28,7 +28,7 @@ module TogaiClient
28
28
  def self.attribute_map
29
29
  {
30
30
  :'price_plan_name' => :'pricePlanName',
31
- :'override' => :'override',
31
+ :'price_plan_details_override' => :'pricePlanDetailsOverride',
32
32
  :'start_date' => :'startDate',
33
33
  :'end_date' => :'endDate'
34
34
  }
@@ -43,7 +43,7 @@ module TogaiClient
43
43
  def self.openapi_types
44
44
  {
45
45
  :'price_plan_name' => :'String',
46
- :'override' => :'RateCard',
46
+ :'price_plan_details_override' => :'PricePlanDetailsOverride',
47
47
  :'start_date' => :'Time',
48
48
  :'end_date' => :'Time'
49
49
  }
@@ -74,8 +74,8 @@ module TogaiClient
74
74
  self.price_plan_name = attributes[:'price_plan_name']
75
75
  end
76
76
 
77
- if attributes.key?(:'override')
78
- self.override = attributes[:'override']
77
+ if attributes.key?(:'price_plan_details_override')
78
+ self.price_plan_details_override = attributes[:'price_plan_details_override']
79
79
  end
80
80
 
81
81
  if attributes.key?(:'start_date')
@@ -121,7 +121,7 @@ module TogaiClient
121
121
  return true if self.equal?(o)
122
122
  self.class == o.class &&
123
123
  price_plan_name == o.price_plan_name &&
124
- override == o.override &&
124
+ price_plan_details_override == o.price_plan_details_override &&
125
125
  start_date == o.start_date &&
126
126
  end_date == o.end_date
127
127
  end
@@ -135,7 +135,7 @@ module TogaiClient
135
135
  # Calculates hash code according to all attributes.
136
136
  # @return [Integer] Hash code
137
137
  def hash
138
- [price_plan_name, override, start_date, end_date].hash
138
+ [price_plan_name, price_plan_details_override, start_date, end_date].hash
139
139
  end
140
140
 
141
141
  # Builds the object from hash
@@ -25,8 +25,6 @@ module TogaiClient
25
25
  # Status of Price plan
26
26
  attr_accessor :status
27
27
 
28
- attr_accessor :pricing_cycle
29
-
30
28
  attr_accessor :pricing_schedule
31
29
 
32
30
  class EnumAttributeValidator
@@ -57,7 +55,6 @@ module TogaiClient
57
55
  :'name' => :'name',
58
56
  :'description' => :'description',
59
57
  :'status' => :'status',
60
- :'pricing_cycle' => :'pricingCycle',
61
58
  :'pricing_schedule' => :'pricingSchedule'
62
59
  }
63
60
  end
@@ -73,7 +70,6 @@ module TogaiClient
73
70
  :'name' => :'String',
74
71
  :'description' => :'String',
75
72
  :'status' => :'String',
76
- :'pricing_cycle' => :'PricingCycle',
77
73
  :'pricing_schedule' => :'Array<PricingSchedule>'
78
74
  }
79
75
  end
@@ -111,10 +107,6 @@ module TogaiClient
111
107
  self.status = attributes[:'status']
112
108
  end
113
109
 
114
- if attributes.key?(:'pricing_cycle')
115
- self.pricing_cycle = attributes[:'pricing_cycle']
116
- end
117
-
118
110
  if attributes.key?(:'pricing_schedule')
119
111
  if (value = attributes[:'pricing_schedule']).is_a?(Array)
120
112
  self.pricing_schedule = value
@@ -142,10 +134,6 @@ module TogaiClient
142
134
  invalid_properties.push('invalid value for "status", status cannot be nil.')
143
135
  end
144
136
 
145
- if @pricing_cycle.nil?
146
- invalid_properties.push('invalid value for "pricing_cycle", pricing_cycle cannot be nil.')
147
- end
148
-
149
137
  if @pricing_schedule.nil?
150
138
  invalid_properties.push('invalid value for "pricing_schedule", pricing_schedule cannot be nil.')
151
139
  end
@@ -162,7 +150,6 @@ module TogaiClient
162
150
  return false if @status.nil?
163
151
  status_validator = EnumAttributeValidator.new('String', ["DRAFT", "ACTIVE", "ARCHIVED"])
164
152
  return false unless status_validator.valid?(@status)
165
- return false if @pricing_cycle.nil?
166
153
  return false if @pricing_schedule.nil?
167
154
  true
168
155
  end
@@ -209,7 +196,6 @@ module TogaiClient
209
196
  name == o.name &&
210
197
  description == o.description &&
211
198
  status == o.status &&
212
- pricing_cycle == o.pricing_cycle &&
213
199
  pricing_schedule == o.pricing_schedule
214
200
  end
215
201
 
@@ -222,7 +208,7 @@ module TogaiClient
222
208
  # Calculates hash code according to all attributes.
223
209
  # @return [Integer] Hash code
224
210
  def hash
225
- [name, description, status, pricing_cycle, pricing_schedule].hash
211
+ [name, description, status, pricing_schedule].hash
226
212
  end
227
213
 
228
214
  # Builds the object from hash
@@ -0,0 +1,259 @@
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 PricePlanDetails
18
+ attr_accessor :pricing_cycle_config
19
+
20
+ attr_accessor :rate_cards
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'pricing_cycle_config' => :'pricingCycleConfig',
26
+ :'rate_cards' => :'rateCards'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'pricing_cycle_config' => :'PricingCycleConfig',
39
+ :'rate_cards' => :'Array<RateCard>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TogaiClient::PricePlanDetails` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TogaiClient::PricePlanDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'pricing_cycle_config')
65
+ self.pricing_cycle_config = attributes[:'pricing_cycle_config']
66
+ end
67
+
68
+ if attributes.key?(:'rate_cards')
69
+ if (value = attributes[:'rate_cards']).is_a?(Array)
70
+ self.rate_cards = value
71
+ end
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @pricing_cycle_config.nil?
80
+ invalid_properties.push('invalid value for "pricing_cycle_config", pricing_cycle_config cannot be nil.')
81
+ end
82
+
83
+ if @rate_cards.nil?
84
+ invalid_properties.push('invalid value for "rate_cards", rate_cards cannot be nil.')
85
+ end
86
+
87
+ if @rate_cards.length < 1
88
+ invalid_properties.push('invalid value for "rate_cards", number of items must be greater than or equal to 1.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @pricing_cycle_config.nil?
98
+ return false if @rate_cards.nil?
99
+ return false if @rate_cards.length < 1
100
+ true
101
+ end
102
+
103
+ # Custom attribute writer method with validation
104
+ # @param [Object] rate_cards Value to be assigned
105
+ def rate_cards=(rate_cards)
106
+ if rate_cards.nil?
107
+ fail ArgumentError, 'rate_cards cannot be nil'
108
+ end
109
+
110
+ if rate_cards.length < 1
111
+ fail ArgumentError, 'invalid value for "rate_cards", number of items must be greater than or equal to 1.'
112
+ end
113
+
114
+ @rate_cards = rate_cards
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ pricing_cycle_config == o.pricing_cycle_config &&
123
+ rate_cards == o.rate_cards
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Integer] Hash code
134
+ def hash
135
+ [pricing_cycle_config, rate_cards].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def self.build_from_hash(attributes)
142
+ new.build_from_hash(attributes)
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ self.class.openapi_types.each_pair do |key, type|
152
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ # models (e.g. Pet) or oneOf
206
+ klass = TogaiClient.const_get(type)
207
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end