Class: BillingApi::RatedUsageRecord
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- BillingApi::RatedUsageRecord
- Defined in:
- lib/pnap_billing_api/models/rated_usage_record.rb
Overview
Rated usage record.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#active ⇒ Object
A flag indicating whether the rated usage record is still active.
-
#correlation_id ⇒ Object
Holds usage record id.
-
#cost ⇒ Object
The rated usage in cents.
-
#cost_before_discount ⇒ Object
The cost in cents before discount.
-
#cost_description ⇒ Object
The rated usage cost description.
-
#credit_details ⇒ Object
Returns the value of attribute credit_details.
-
#discount_details ⇒ Object
Returns the value of attribute discount_details.
-
#end_date_time ⇒ Object
The point in time (in UTC) until usage has been rated.
-
#id ⇒ Object
The unique identifier of the rated usage record.
-
#location ⇒ Object
Returns the value of attribute location.
-
#price_model ⇒ Object
The price model applied to this usage record.
-
#product_category ⇒ Object
Returns the value of attribute product_category.
-
#product_code ⇒ Object
The code identifying the product associated to this usage record.
-
#quantity ⇒ Object
The number of units being charged.
-
#reservation_details ⇒ Object
Returns the value of attribute reservation_details.
-
#reservation_id ⇒ Object
Reservation id associated with this rated usage record.
-
#start_date_time ⇒ Object
The point in time (in UTC) when usage has started.
-
#unit_price ⇒ Object
The unit price.
-
#unit_price_description ⇒ Object
User friendly description of the unit price.
-
#usage_session_id ⇒ Object
The usage session ID is used to correlate rated usage records across periods of time.
-
#year_month ⇒ Object
Year and month of the usage record.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ RatedUsageRecord
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ RatedUsageRecord
Initializes the object
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 171 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `BillingApi::RatedUsageRecord` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) 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 end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'product_category') self.product_category = attributes[:'product_category'] else self.product_category = nil end if attributes.key?(:'product_code') self.product_code = attributes[:'product_code'] else self.product_code = nil end if attributes.key?(:'location') self.location = attributes[:'location'] else self.location = nil end if attributes.key?(:'year_month') self.year_month = attributes[:'year_month'] end if attributes.key?(:'start_date_time') self.start_date_time = attributes[:'start_date_time'] else self.start_date_time = nil end if attributes.key?(:'end_date_time') self.end_date_time = attributes[:'end_date_time'] else self.end_date_time = nil end if attributes.key?(:'cost') self.cost = attributes[:'cost'] else self.cost = nil end if attributes.key?(:'cost_before_discount') self.cost_before_discount = attributes[:'cost_before_discount'] end if attributes.key?(:'cost_description') self.cost_description = attributes[:'cost_description'] end if attributes.key?(:'price_model') self.price_model = attributes[:'price_model'] else self.price_model = nil end if attributes.key?(:'unit_price') self.unit_price = attributes[:'unit_price'] else self.unit_price = nil end if attributes.key?(:'unit_price_description') self.unit_price_description = attributes[:'unit_price_description'] else self.unit_price_description = nil end if attributes.key?(:'quantity') self.quantity = attributes[:'quantity'] else self.quantity = nil end if attributes.key?(:'active') self.active = attributes[:'active'] else self.active = nil end if attributes.key?(:'usage_session_id') self.usage_session_id = attributes[:'usage_session_id'] end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end if attributes.key?(:'reservation_details') self.reservation_details = attributes[:'reservation_details'] end if attributes.key?(:'discount_details') self.discount_details = attributes[:'discount_details'] end if attributes.key?(:'credit_details') if (value = attributes[:'credit_details']).is_a?(Array) self.credit_details = value end end end |
Instance Attribute Details
#active ⇒ Object
A flag indicating whether the rated usage record is still active.
60 61 62 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 60 def active @active end |
#correlation_id ⇒ Object
Holds usage record id
66 67 68 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 66 def correlation_id @correlation_id end |
#cost ⇒ Object
The rated usage in cents.
39 40 41 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 39 def cost @cost end |
#cost_before_discount ⇒ Object
The cost in cents before discount.
42 43 44 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 42 def cost_before_discount @cost_before_discount end |
#cost_description ⇒ Object
The rated usage cost description.
45 46 47 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 45 def cost_description @cost_description end |
#credit_details ⇒ Object
Returns the value of attribute credit_details.
75 76 77 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 75 def credit_details @credit_details end |
#discount_details ⇒ Object
Returns the value of attribute discount_details.
73 74 75 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 73 def discount_details @discount_details end |
#end_date_time ⇒ Object
The point in time (in UTC) until usage has been rated.
36 37 38 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 36 def end_date_time @end_date_time end |
#id ⇒ Object
The unique identifier of the rated usage record.
20 21 22 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 20 def id @id end |
#location ⇒ Object
Returns the value of attribute location.
27 28 29 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 27 def location @location end |
#price_model ⇒ Object
The price model applied to this usage record.
48 49 50 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 48 def price_model @price_model end |
#product_category ⇒ Object
Returns the value of attribute product_category.
22 23 24 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 22 def product_category @product_category end |
#product_code ⇒ Object
The code identifying the product associated to this usage record.
25 26 27 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 25 def product_code @product_code end |
#quantity ⇒ Object
The number of units being charged.
57 58 59 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 57 def quantity @quantity end |
#reservation_details ⇒ Object
Returns the value of attribute reservation_details.
71 72 73 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 71 def reservation_details @reservation_details end |
#reservation_id ⇒ Object
Reservation id associated with this rated usage record.
69 70 71 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 69 def reservation_id @reservation_id end |
#start_date_time ⇒ Object
The point in time (in UTC) when usage has started.
33 34 35 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 33 def start_date_time @start_date_time end |
#unit_price ⇒ Object
The unit price.
51 52 53 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 51 def unit_price @unit_price end |
#unit_price_description ⇒ Object
User friendly description of the unit price.
54 55 56 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 54 def unit_price_description @unit_price_description end |
#usage_session_id ⇒ Object
The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice.
63 64 65 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 63 def usage_session_id @usage_session_id end |
#year_month ⇒ Object
Year and month of the usage record.
30 31 32 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 30 def year_month @year_month end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
127 128 129 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 127 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
132 133 134 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 132 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 100 def self.attribute_map { :'id' => :'id', :'product_category' => :'productCategory', :'product_code' => :'productCode', :'location' => :'location', :'year_month' => :'yearMonth', :'start_date_time' => :'startDateTime', :'end_date_time' => :'endDateTime', :'cost' => :'cost', :'cost_before_discount' => :'costBeforeDiscount', :'cost_description' => :'costDescription', :'price_model' => :'priceModel', :'unit_price' => :'unitPrice', :'unit_price_description' => :'unitPriceDescription', :'quantity' => :'quantity', :'active' => :'active', :'usage_session_id' => :'usageSessionId', :'correlation_id' => :'correlationId', :'reservation_id' => :'reservationId', :'reservation_details' => :'reservationDetails', :'discount_details' => :'discountDetails', :'credit_details' => :'creditDetails' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 534 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
164 165 166 167 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 164 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 137 def self.openapi_types { :'id' => :'String', :'product_category' => :'RatedUsageProductCategoryEnum', :'product_code' => :'String', :'location' => :'LocationEnum', :'year_month' => :'String', :'start_date_time' => :'Time', :'end_date_time' => :'Time', :'cost' => :'Integer', :'cost_before_discount' => :'Integer', :'cost_description' => :'String', :'price_model' => :'String', :'unit_price' => :'Float', :'unit_price_description' => :'String', :'quantity' => :'Float', :'active' => :'Boolean', :'usage_session_id' => :'String', :'correlation_id' => :'String', :'reservation_id' => :'String', :'reservation_details' => :'ReservationDetails', :'discount_details' => :'ApplicableDiscountDetails', :'credit_details' => :'Array<CreditDetails>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 493 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && product_category == o.product_category && product_code == o.product_code && location == o.location && year_month == o.year_month && start_date_time == o.start_date_time && end_date_time == o.end_date_time && cost == o.cost && cost_before_discount == o.cost_before_discount && cost_description == o.cost_description && price_model == o.price_model && unit_price == o.unit_price && unit_price_description == o.unit_price_description && quantity == o.quantity && active == o.active && usage_session_id == o.usage_session_id && correlation_id == o.correlation_id && reservation_id == o.reservation_id && reservation_details == o.reservation_details && discount_details == o.discount_details && credit_details == o.credit_details end |
#eql?(o) ⇒ Boolean
521 522 523 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 521 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
527 528 529 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 527 def hash [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 end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 298 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @product_category.nil? invalid_properties.push('invalid value for "product_category", product_category cannot be nil.') end if @product_code.nil? invalid_properties.push('invalid value for "product_code", product_code cannot be nil.') end if @location.nil? invalid_properties.push('invalid value for "location", location cannot be nil.') end if @start_date_time.nil? invalid_properties.push('invalid value for "start_date_time", start_date_time cannot be nil.') end if @end_date_time.nil? invalid_properties.push('invalid value for "end_date_time", end_date_time cannot be nil.') end if @cost.nil? invalid_properties.push('invalid value for "cost", cost cannot be nil.') end if @price_model.nil? invalid_properties.push('invalid value for "price_model", price_model cannot be nil.') end if @unit_price.nil? invalid_properties.push('invalid value for "unit_price", unit_price cannot be nil.') end if @unit_price_description.nil? invalid_properties.push('invalid value for "unit_price_description", unit_price_description cannot be nil.') end if @quantity.nil? invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') end if @active.nil? invalid_properties.push('invalid value for "active", active cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 556 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/pnap_billing_api/models/rated_usage_record.rb', line 354 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @product_category.nil? return false if @product_code.nil? return false if @location.nil? return false if @start_date_time.nil? return false if @end_date_time.nil? return false if @cost.nil? return false if @price_model.nil? return false if @unit_price.nil? return false if @unit_price_description.nil? return false if @quantity.nil? return false if @active.nil? true end |