pnap_billing_api 2.1.2 → 3.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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/VERSION +1 -1
  4. data/docs/BandwidthRecord.md +4 -2
  5. data/docs/LocationAvailabilityDetail.md +1 -1
  6. data/docs/OperatingSystemRecord.md +4 -2
  7. data/docs/PackageDetails.md +20 -0
  8. data/docs/PackageQuantity.md +20 -0
  9. data/docs/PricingPlan.md +3 -1
  10. data/docs/ProductAvailabilityApi.md +4 -4
  11. data/docs/ProductLocationEnum.md +15 -0
  12. data/docs/PublicSubnetRecord.md +4 -2
  13. data/docs/Quantity.md +20 -0
  14. data/docs/QuantityUnitEnum.md +15 -0
  15. data/docs/RatedUsageRecord.md +4 -2
  16. data/docs/Reservation.md +10 -2
  17. data/docs/ReservationDetails.md +20 -0
  18. data/docs/ReservationRequest.md +3 -1
  19. data/docs/ReservationStateEnum.md +15 -0
  20. data/docs/ReservationTerm.md +20 -0
  21. data/docs/ReservationsApi.md +2 -2
  22. data/docs/ServerRecord.md +4 -2
  23. data/docs/StorageDetails.md +5 -5
  24. data/docs/StorageRecord.md +4 -2
  25. data/docs/Utilization.md +20 -0
  26. data/lib/pnap_billing_api/api/billing_configurations_api.rb +2 -2
  27. data/lib/pnap_billing_api/api/product_availability_api.rb +14 -6
  28. data/lib/pnap_billing_api/api/products_api.rb +2 -2
  29. data/lib/pnap_billing_api/api/rated_usage_api.rb +3 -3
  30. data/lib/pnap_billing_api/api/reservations_api.rb +7 -7
  31. data/lib/pnap_billing_api/api_client.rb +17 -14
  32. data/lib/pnap_billing_api/api_error.rb +1 -1
  33. data/lib/pnap_billing_api/api_model_base.rb +88 -0
  34. data/lib/pnap_billing_api/configuration.rb +11 -1
  35. data/lib/pnap_billing_api/models/applicable_discount_details.rb +41 -78
  36. data/lib/pnap_billing_api/models/applicable_discounts.rb +11 -78
  37. data/lib/pnap_billing_api/models/bandwidth_details.rb +31 -78
  38. data/lib/pnap_billing_api/models/bandwidth_record.rb +151 -93
  39. data/lib/pnap_billing_api/models/configuration_details.rb +11 -78
  40. data/lib/pnap_billing_api/models/credit_details.rb +5 -7
  41. data/lib/pnap_billing_api/models/credit_details_base.rb +31 -78
  42. data/lib/pnap_billing_api/models/credit_type_enum.rb +1 -1
  43. data/lib/pnap_billing_api/models/discount_details.rb +41 -78
  44. data/lib/pnap_billing_api/models/discount_type_enum.rb +1 -1
  45. data/lib/pnap_billing_api/models/error.rb +21 -78
  46. data/lib/pnap_billing_api/models/gpu_configuration_metadata.rb +11 -78
  47. data/lib/pnap_billing_api/models/location_availability_detail.rb +52 -79
  48. data/lib/pnap_billing_api/models/location_enum.rb +1 -1
  49. data/lib/pnap_billing_api/models/operating_system_details.rb +31 -78
  50. data/lib/pnap_billing_api/models/operating_system_record.rb +151 -93
  51. data/lib/pnap_billing_api/models/package_details.rb +179 -0
  52. data/lib/pnap_billing_api/models/package_quantity.rb +193 -0
  53. data/lib/pnap_billing_api/models/package_unit_enum.rb +1 -1
  54. data/lib/pnap_billing_api/models/price_unit_enum.rb +3 -2
  55. data/lib/pnap_billing_api/models/pricing_plan.rb +56 -84
  56. data/lib/pnap_billing_api/models/product.rb +31 -78
  57. data/lib/pnap_billing_api/models/product_availability.rb +41 -78
  58. data/lib/pnap_billing_api/models/product_category_enum.rb +1 -1
  59. data/lib/pnap_billing_api/models/product_location_enum.rb +44 -0
  60. data/lib/pnap_billing_api/models/products_get200_response_inner.rb +1 -2
  61. data/lib/pnap_billing_api/models/promo_credit_details.rb +51 -78
  62. data/lib/pnap_billing_api/models/public_subnet_details.rb +31 -78
  63. data/lib/pnap_billing_api/models/public_subnet_record.rb +151 -93
  64. data/lib/pnap_billing_api/models/quantity.rb +223 -0
  65. data/lib/pnap_billing_api/models/quantity_unit_enum.rb +40 -0
  66. data/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb +1 -2
  67. data/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb +1 -1
  68. data/lib/pnap_billing_api/models/rated_usage_record.rb +141 -93
  69. data/lib/pnap_billing_api/models/reservation.rb +186 -83
  70. data/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb +11 -78
  71. data/lib/pnap_billing_api/models/reservation_details.rb +158 -0
  72. data/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb +1 -1
  73. data/lib/pnap_billing_api/models/reservation_model_enum.rb +3 -2
  74. data/lib/pnap_billing_api/models/reservation_product_category_enum.rb +3 -2
  75. data/lib/pnap_billing_api/models/reservation_request.rb +51 -82
  76. data/lib/pnap_billing_api/models/reservation_state_enum.rb +44 -0
  77. data/lib/pnap_billing_api/models/reservation_term.rb +214 -0
  78. data/lib/pnap_billing_api/models/server_details.rb +31 -78
  79. data/lib/pnap_billing_api/models/server_product.rb +41 -78
  80. data/lib/pnap_billing_api/models/server_product_metadata.rb +81 -78
  81. data/lib/pnap_billing_api/models/server_record.rb +151 -93
  82. data/lib/pnap_billing_api/models/storage_details.rb +21 -113
  83. data/lib/pnap_billing_api/models/storage_record.rb +151 -93
  84. data/lib/pnap_billing_api/models/system_credit_cause_enum.rb +1 -1
  85. data/lib/pnap_billing_api/models/system_credit_details.rb +41 -78
  86. data/lib/pnap_billing_api/models/threshold_configuration_details.rb +21 -78
  87. data/lib/pnap_billing_api/models/utilization.rb +208 -0
  88. data/lib/pnap_billing_api/version.rb +1 -2
  89. data/lib/pnap_billing_api.rb +11 -1
  90. data/pnap_billing_api.gemspec +6 -6
  91. data/spec/api/billing_configurations_api_spec.rb +1 -1
  92. data/spec/api/product_availability_api_spec.rb +3 -3
  93. data/spec/api/products_api_spec.rb +1 -1
  94. data/spec/api/rated_usage_api_spec.rb +1 -1
  95. data/spec/api/reservations_api_spec.rb +1 -1
  96. data/spec/models/applicable_discount_details_spec.rb +2 -2
  97. data/spec/models/applicable_discounts_spec.rb +2 -2
  98. data/spec/models/bandwidth_details_spec.rb +2 -2
  99. data/spec/models/bandwidth_record_spec.rb +8 -2
  100. data/spec/models/configuration_details_spec.rb +2 -2
  101. data/spec/models/credit_details_base_spec.rb +2 -2
  102. data/spec/models/credit_details_spec.rb +1 -1
  103. data/spec/models/credit_type_enum_spec.rb +2 -2
  104. data/spec/models/discount_details_spec.rb +2 -2
  105. data/spec/models/discount_type_enum_spec.rb +2 -2
  106. data/spec/models/error_spec.rb +2 -2
  107. data/spec/models/gpu_configuration_metadata_spec.rb +2 -2
  108. data/spec/models/location_availability_detail_spec.rb +2 -2
  109. data/spec/models/location_enum_spec.rb +2 -2
  110. data/spec/models/operating_system_details_spec.rb +2 -2
  111. data/spec/models/operating_system_record_spec.rb +8 -2
  112. data/spec/models/package_details_spec.rb +42 -0
  113. data/spec/models/package_quantity_spec.rb +42 -0
  114. data/spec/models/package_unit_enum_spec.rb +2 -2
  115. data/spec/models/price_unit_enum_spec.rb +2 -2
  116. data/spec/models/pricing_plan_spec.rb +9 -3
  117. data/spec/models/product_availability_spec.rb +2 -2
  118. data/spec/models/product_category_enum_spec.rb +2 -2
  119. data/spec/models/product_location_enum_spec.rb +30 -0
  120. data/spec/models/product_spec.rb +2 -2
  121. data/spec/models/products_get200_response_inner_spec.rb +1 -1
  122. data/spec/models/promo_credit_details_spec.rb +2 -2
  123. data/spec/models/public_subnet_details_spec.rb +2 -2
  124. data/spec/models/public_subnet_record_spec.rb +8 -2
  125. data/spec/models/quantity_spec.rb +42 -0
  126. data/spec/models/quantity_unit_enum_spec.rb +30 -0
  127. data/spec/models/rated_usage_get200_response_inner_spec.rb +1 -1
  128. data/spec/models/rated_usage_product_category_enum_spec.rb +2 -2
  129. data/spec/models/rated_usage_record_spec.rb +8 -2
  130. data/spec/models/reservation_auto_renew_disable_request_spec.rb +2 -2
  131. data/spec/models/reservation_details_spec.rb +42 -0
  132. data/spec/models/reservation_invoicing_model_enum_spec.rb +2 -2
  133. data/spec/models/reservation_model_enum_spec.rb +2 -2
  134. data/spec/models/reservation_product_category_enum_spec.rb +2 -2
  135. data/spec/models/reservation_request_spec.rb +8 -2
  136. data/spec/models/reservation_spec.rb +26 -2
  137. data/spec/models/reservation_state_enum_spec.rb +30 -0
  138. data/spec/models/reservation_term_spec.rb +42 -0
  139. data/spec/models/server_details_spec.rb +2 -2
  140. data/spec/models/server_product_metadata_spec.rb +2 -2
  141. data/spec/models/server_product_spec.rb +2 -2
  142. data/spec/models/server_record_spec.rb +8 -2
  143. data/spec/models/storage_details_spec.rb +2 -2
  144. data/spec/models/storage_record_spec.rb +8 -2
  145. data/spec/models/system_credit_cause_enum_spec.rb +2 -2
  146. data/spec/models/system_credit_details_spec.rb +2 -2
  147. data/spec/models/threshold_configuration_details_spec.rb +2 -2
  148. data/spec/models/utilization_spec.rb +42 -0
  149. data/spec/spec_helper.rb +1 -1
  150. metadata +82 -41
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #Billing API
3
+
4
+ #Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/phoenixnap-bare-metal-cloud-billing-models' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/billing/v1/)</b>
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.20.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BillingApi
17
+ # Represents the quantity.
18
+ class Quantity < ApiModelBase
19
+ # Quantity size.
20
+ attr_accessor :quantity
21
+
22
+ attr_accessor :unit
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'quantity' => :'quantity',
50
+ :'unit' => :'unit'
51
+ }
52
+ end
53
+
54
+ # Returns attribute mapping this model knows about
55
+ def self.acceptable_attribute_map
56
+ attribute_map
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ acceptable_attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.openapi_types
66
+ {
67
+ :'quantity' => :'Float',
68
+ :'unit' => :'QuantityUnitEnum'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BillingApi::Quantity` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ acceptable_attribute_map = self.class.acceptable_attribute_map
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!acceptable_attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Quantity`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'quantity')
95
+ self.quantity = attributes[:'quantity']
96
+ else
97
+ self.quantity = nil
98
+ end
99
+
100
+ if attributes.key?(:'unit')
101
+ self.unit = attributes[:'unit']
102
+ else
103
+ self.unit = nil
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @quantity.nil?
113
+ invalid_properties.push('invalid value for "quantity", quantity cannot be nil.')
114
+ end
115
+
116
+ if @quantity < 1
117
+ invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.')
118
+ end
119
+
120
+ if @unit.nil?
121
+ invalid_properties.push('invalid value for "unit", unit cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ return false if @quantity.nil?
132
+ return false if @quantity < 1
133
+ return false if @unit.nil?
134
+ true
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] quantity Value to be assigned
139
+ def quantity=(quantity)
140
+ if quantity.nil?
141
+ fail ArgumentError, 'quantity cannot be nil'
142
+ end
143
+
144
+ if quantity < 1
145
+ fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.'
146
+ end
147
+
148
+ @quantity = quantity
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] unit Value to be assigned
153
+ def unit=(unit)
154
+ if unit.nil?
155
+ fail ArgumentError, 'unit cannot be nil'
156
+ end
157
+
158
+ @unit = unit
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ quantity == o.quantity &&
167
+ unit == o.unit
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Integer] Hash code
178
+ def hash
179
+ [quantity, unit].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def self.build_from_hash(attributes)
186
+ return nil unless attributes.is_a?(Hash)
187
+ attributes = attributes.transform_keys(&:to_sym)
188
+ transformed_hash = {}
189
+ openapi_types.each_pair do |key, type|
190
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
191
+ transformed_hash["#{key}"] = nil
192
+ elsif type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[attribute_map[key]].is_a?(Array)
196
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
197
+ end
198
+ elsif !attributes[attribute_map[key]].nil?
199
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
200
+ end
201
+ end
202
+ new(transformed_hash)
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #Billing API
3
+
4
+ #Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/phoenixnap-bare-metal-cloud-billing-models' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/billing/v1/)</b>
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.20.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BillingApi
17
+ class QuantityUnitEnum
18
+ TB = "TB".freeze
19
+ COUNT = "COUNT".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [TB, COUNT].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if QuantityUnitEnum.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #QuantityUnitEnum"
38
+ end
39
+ end
40
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -60,5 +60,4 @@ module BillingApi
60
60
  end
61
61
  end
62
62
  end
63
-
64
63
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module BillingApi
17
17
  # Rated usage record.
18
- class RatedUsageRecord
18
+ class RatedUsageRecord < ApiModelBase
19
19
  # The unique identifier of the rated usage record.
20
20
  attr_accessor :id
21
21
 
@@ -68,6 +68,8 @@ module BillingApi
68
68
  # Reservation id associated with this rated usage record.
69
69
  attr_accessor :reservation_id
70
70
 
71
+ attr_accessor :reservation_details
72
+
71
73
  attr_accessor :discount_details
72
74
 
73
75
  attr_accessor :credit_details
@@ -115,14 +117,20 @@ module BillingApi
115
117
  :'usage_session_id' => :'usageSessionId',
116
118
  :'correlation_id' => :'correlationId',
117
119
  :'reservation_id' => :'reservationId',
120
+ :'reservation_details' => :'reservationDetails',
118
121
  :'discount_details' => :'discountDetails',
119
122
  :'credit_details' => :'creditDetails'
120
123
  }
121
124
  end
122
125
 
126
+ # Returns attribute mapping this model knows about
127
+ def self.acceptable_attribute_map
128
+ attribute_map
129
+ end
130
+
123
131
  # Returns all the JSON keys this model knows about
124
132
  def self.acceptable_attributes
125
- attribute_map.values
133
+ acceptable_attribute_map.values
126
134
  end
127
135
 
128
136
  # Attribute type mapping.
@@ -146,6 +154,7 @@ module BillingApi
146
154
  :'usage_session_id' => :'String',
147
155
  :'correlation_id' => :'String',
148
156
  :'reservation_id' => :'String',
157
+ :'reservation_details' => :'ReservationDetails',
149
158
  :'discount_details' => :'ApplicableDiscountDetails',
150
159
  :'credit_details' => :'Array<CreditDetails>'
151
160
  }
@@ -165,9 +174,10 @@ module BillingApi
165
174
  end
166
175
 
167
176
  # check to see if the attribute exists and convert string to symbol for hash key
177
+ acceptable_attribute_map = self.class.acceptable_attribute_map
168
178
  attributes = attributes.each_with_object({}) { |(k, v), h|
169
- if (!self.class.attribute_map.key?(k.to_sym))
170
- fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::RatedUsageRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
179
+ if (!acceptable_attribute_map.key?(k.to_sym))
180
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::RatedUsageRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
171
181
  end
172
182
  h[k.to_sym] = v
173
183
  }
@@ -258,20 +268,20 @@ module BillingApi
258
268
 
259
269
  if attributes.key?(:'usage_session_id')
260
270
  self.usage_session_id = attributes[:'usage_session_id']
261
- else
262
- self.usage_session_id = nil
263
271
  end
264
272
 
265
273
  if attributes.key?(:'correlation_id')
266
274
  self.correlation_id = attributes[:'correlation_id']
267
- else
268
- self.correlation_id = nil
269
275
  end
270
276
 
271
277
  if attributes.key?(:'reservation_id')
272
278
  self.reservation_id = attributes[:'reservation_id']
273
279
  end
274
280
 
281
+ if attributes.key?(:'reservation_details')
282
+ self.reservation_details = attributes[:'reservation_details']
283
+ end
284
+
275
285
  if attributes.key?(:'discount_details')
276
286
  self.discount_details = attributes[:'discount_details']
277
287
  end
@@ -336,14 +346,6 @@ module BillingApi
336
346
  invalid_properties.push('invalid value for "active", active cannot be nil.')
337
347
  end
338
348
 
339
- if @usage_session_id.nil?
340
- invalid_properties.push('invalid value for "usage_session_id", usage_session_id cannot be nil.')
341
- end
342
-
343
- if @correlation_id.nil?
344
- invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.')
345
- end
346
-
347
349
  invalid_properties
348
350
  end
349
351
 
@@ -363,11 +365,129 @@ module BillingApi
363
365
  return false if @unit_price_description.nil?
364
366
  return false if @quantity.nil?
365
367
  return false if @active.nil?
366
- return false if @usage_session_id.nil?
367
- return false if @correlation_id.nil?
368
368
  true
369
369
  end
370
370
 
371
+ # Custom attribute writer method with validation
372
+ # @param [Object] id Value to be assigned
373
+ def id=(id)
374
+ if id.nil?
375
+ fail ArgumentError, 'id cannot be nil'
376
+ end
377
+
378
+ @id = id
379
+ end
380
+
381
+ # Custom attribute writer method with validation
382
+ # @param [Object] product_category Value to be assigned
383
+ def product_category=(product_category)
384
+ if product_category.nil?
385
+ fail ArgumentError, 'product_category cannot be nil'
386
+ end
387
+
388
+ @product_category = product_category
389
+ end
390
+
391
+ # Custom attribute writer method with validation
392
+ # @param [Object] product_code Value to be assigned
393
+ def product_code=(product_code)
394
+ if product_code.nil?
395
+ fail ArgumentError, 'product_code cannot be nil'
396
+ end
397
+
398
+ @product_code = product_code
399
+ end
400
+
401
+ # Custom attribute writer method with validation
402
+ # @param [Object] location Value to be assigned
403
+ def location=(location)
404
+ if location.nil?
405
+ fail ArgumentError, 'location cannot be nil'
406
+ end
407
+
408
+ @location = location
409
+ end
410
+
411
+ # Custom attribute writer method with validation
412
+ # @param [Object] start_date_time Value to be assigned
413
+ def start_date_time=(start_date_time)
414
+ if start_date_time.nil?
415
+ fail ArgumentError, 'start_date_time cannot be nil'
416
+ end
417
+
418
+ @start_date_time = start_date_time
419
+ end
420
+
421
+ # Custom attribute writer method with validation
422
+ # @param [Object] end_date_time Value to be assigned
423
+ def end_date_time=(end_date_time)
424
+ if end_date_time.nil?
425
+ fail ArgumentError, 'end_date_time cannot be nil'
426
+ end
427
+
428
+ @end_date_time = end_date_time
429
+ end
430
+
431
+ # Custom attribute writer method with validation
432
+ # @param [Object] cost Value to be assigned
433
+ def cost=(cost)
434
+ if cost.nil?
435
+ fail ArgumentError, 'cost cannot be nil'
436
+ end
437
+
438
+ @cost = cost
439
+ end
440
+
441
+ # Custom attribute writer method with validation
442
+ # @param [Object] price_model Value to be assigned
443
+ def price_model=(price_model)
444
+ if price_model.nil?
445
+ fail ArgumentError, 'price_model cannot be nil'
446
+ end
447
+
448
+ @price_model = price_model
449
+ end
450
+
451
+ # Custom attribute writer method with validation
452
+ # @param [Object] unit_price Value to be assigned
453
+ def unit_price=(unit_price)
454
+ if unit_price.nil?
455
+ fail ArgumentError, 'unit_price cannot be nil'
456
+ end
457
+
458
+ @unit_price = unit_price
459
+ end
460
+
461
+ # Custom attribute writer method with validation
462
+ # @param [Object] unit_price_description Value to be assigned
463
+ def unit_price_description=(unit_price_description)
464
+ if unit_price_description.nil?
465
+ fail ArgumentError, 'unit_price_description cannot be nil'
466
+ end
467
+
468
+ @unit_price_description = unit_price_description
469
+ end
470
+
471
+ # Custom attribute writer method with validation
472
+ # @param [Object] quantity Value to be assigned
473
+ def quantity=(quantity)
474
+ if quantity.nil?
475
+ fail ArgumentError, 'quantity cannot be nil'
476
+ end
477
+
478
+ @quantity = quantity
479
+ end
480
+
481
+ # Custom attribute writer method with validation
482
+ # @param [Object] active Value to be assigned
483
+ def active=(active)
484
+ if active.nil?
485
+ fail ArgumentError, 'active cannot be nil'
486
+ end
487
+
488
+ @active = active
489
+ end
490
+
371
491
  # Checks equality by comparing each attribute.
372
492
  # @param [Object] Object to be compared
373
493
  def ==(o)
@@ -391,6 +511,7 @@ module BillingApi
391
511
  usage_session_id == o.usage_session_id &&
392
512
  correlation_id == o.correlation_id &&
393
513
  reservation_id == o.reservation_id &&
514
+ reservation_details == o.reservation_details &&
394
515
  discount_details == o.discount_details &&
395
516
  credit_details == o.credit_details
396
517
  end
@@ -404,7 +525,7 @@ module BillingApi
404
525
  # Calculates hash code according to all attributes.
405
526
  # @return [Integer] Hash code
406
527
  def hash
407
- [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, discount_details, credit_details].hash
528
+ [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, reservation_details, discount_details, credit_details].hash
408
529
  end
409
530
 
410
531
  # Builds the object from hash
@@ -430,61 +551,6 @@ module BillingApi
430
551
  new(transformed_hash)
431
552
  end
432
553
 
433
- # Deserializes the data based on type
434
- # @param string type Data type
435
- # @param string value Value to be deserialized
436
- # @return [Object] Deserialized data
437
- def self._deserialize(type, value)
438
- case type.to_sym
439
- when :Time
440
- Time.parse(value)
441
- when :Date
442
- Date.parse(value)
443
- when :String
444
- value.to_s
445
- when :Integer
446
- value.to_i
447
- when :Float
448
- value.to_f
449
- when :Boolean
450
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
451
- true
452
- else
453
- false
454
- end
455
- when :Object
456
- # generic object (usually a Hash), return directly
457
- value
458
- when /\AArray<(?<inner_type>.+)>\z/
459
- inner_type = Regexp.last_match[:inner_type]
460
- value.map { |v| _deserialize(inner_type, v) }
461
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
462
- k_type = Regexp.last_match[:k_type]
463
- v_type = Regexp.last_match[:v_type]
464
- {}.tap do |hash|
465
- value.each do |k, v|
466
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
467
- end
468
- end
469
- else # model
470
- # models (e.g. Pet) or oneOf
471
- klass = BillingApi.const_get(type)
472
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
473
- end
474
- end
475
-
476
- # Returns the string representation of the object
477
- # @return [String] String presentation of the object
478
- def to_s
479
- to_hash.to_s
480
- end
481
-
482
- # to_body is an alias to to_hash (backward compatibility)
483
- # @return [Hash] Returns the object in the form of hash
484
- def to_body
485
- to_hash
486
- end
487
-
488
554
  # Returns the object in the form of hash
489
555
  # @return [Hash] Returns the object in the form of hash
490
556
  def to_hash
@@ -501,24 +567,6 @@ module BillingApi
501
567
  hash
502
568
  end
503
569
 
504
- # Outputs non-array value in the form of hash
505
- # For object, use to_hash. Otherwise, just return the value
506
- # @param [Object] value Any valid value
507
- # @return [Hash] Returns the value in the form of hash
508
- def _to_hash(value)
509
- if value.is_a?(Array)
510
- value.compact.map { |v| _to_hash(v) }
511
- elsif value.is_a?(Hash)
512
- {}.tap do |hash|
513
- value.each { |k, v| hash[k] = _to_hash(v) }
514
- end
515
- elsif value.respond_to? :to_hash
516
- value.to_hash
517
- else
518
- value
519
- end
520
- end
521
-
522
570
  end
523
571
 
524
572
  end