Class: AdvancedBilling::Component
- Defined in:
- lib/advanced_billing/models/component.rb
Overview
Component Model.
Instance Attribute Summary collapse
-
#accounting_code ⇒ String
E.g.
-
#allow_fractional_quantities ⇒ TrueClass | FalseClass
(Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
-
#archived ⇒ TrueClass | FalseClass
Boolean flag describing whether a component is archived or not.
-
#archived_at ⇒ DateTime
Timestamp indicating when this component was archived.
-
#created_at ⇒ DateTime
Timestamp indicating when this component was created.
-
#default_price_point_id ⇒ Integer
The description of the component.
-
#default_price_point_name ⇒ String
URL that points to the location to read the existing price points via GET request.
-
#description ⇒ String
The description of the component.
-
#downgrade_credit ⇒ CreditType
The type of credit to be created when upgrading/downgrading.
-
#event_based_billing_metric_id ⇒ Integer
(Only for Event Based Components) This is an ID of a metric attached to the component.
-
#handle ⇒ String
The component API handle.
-
#hide_date_range_on_invoice ⇒ TrueClass | FalseClass
(Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
-
#id ⇒ Integer
The unique ID assigned to the component by Chargify.
-
#interval ⇒ Integer
The numerical interval.
-
#interval_unit ⇒ IntervalUnit
A string representing the interval unit for this component’s default price point, either month or day.
-
#item_category ⇒ ItemCategory
One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other.
-
#kind ⇒ ComponentKind
A handle for the component type.
-
#name ⇒ String
The name of the Component, suitable for display on statements.
-
#overage_prices ⇒ Array[ComponentPrice]
Applicable only to prepaid usage components.
-
#price_per_unit_in_cents ⇒ Integer
deprecated - use unit_price instead.
-
#price_point_count ⇒ Integer
Count for the number of price points associated with the component.
-
#price_points_url ⇒ String
URL that points to the location to read the existing price points via GET request.
-
#prices ⇒ Array[ComponentPrice]
An array of price brackets.
-
#pricing_scheme ⇒ PricingScheme
The component API handle.
-
#product_family_handle ⇒ String
The handle of the Product Family to which the Component belongs.
-
#product_family_id ⇒ Integer
The id of the Product Family to which the Component belongs.
-
#product_family_name ⇒ String
The name of the Product Family to which the Component belongs.
-
#recurring ⇒ TrueClass | FalseClass
A string representing the tax code related to the component type.
-
#tax_code ⇒ String
A string representing the tax code related to the component type.
-
#taxable ⇒ TrueClass | FalseClass
Boolean flag describing whether a component is taxable or not.
-
#unit_name ⇒ String
The name of the unit that the component’s usage is measured in.
-
#unit_price ⇒ String
The amount the customer will be charged per unit.
-
#updated_at ⇒ DateTime
Timestamp indicating when this component was updated.
-
#upgrade_charge ⇒ CreditType
The type of credit to be created when upgrading/downgrading.
-
#use_site_exchange_rate ⇒ TrueClass | FalseClass
One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(id: SKIP, name: SKIP, handle: SKIP, pricing_scheme: SKIP, unit_name: SKIP, unit_price: SKIP, product_family_id: SKIP, product_family_name: SKIP, product_family_handle: SKIP, price_per_unit_in_cents: SKIP, kind: SKIP, archived: SKIP, taxable: SKIP, description: SKIP, default_price_point_id: SKIP, overage_prices: SKIP, prices: SKIP, price_point_count: SKIP, price_points_url: SKIP, default_price_point_name: SKIP, tax_code: SKIP, recurring: SKIP, upgrade_charge: SKIP, downgrade_credit: SKIP, created_at: SKIP, updated_at: SKIP, archived_at: SKIP, hide_date_range_on_invoice: SKIP, allow_fractional_quantities: SKIP, item_category: SKIP, use_site_exchange_rate: SKIP, accounting_code: SKIP, event_based_billing_metric_id: SKIP, interval: SKIP, interval_unit: SKIP, additional_properties: {}) ⇒ Component
constructor
A new instance of Component.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_archived_at ⇒ Object
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #get_additional_properties, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id: SKIP, name: SKIP, handle: SKIP, pricing_scheme: SKIP, unit_name: SKIP, unit_price: SKIP, product_family_id: SKIP, product_family_name: SKIP, product_family_handle: SKIP, price_per_unit_in_cents: SKIP, kind: SKIP, archived: SKIP, taxable: SKIP, description: SKIP, default_price_point_id: SKIP, overage_prices: SKIP, prices: SKIP, price_point_count: SKIP, price_points_url: SKIP, default_price_point_name: SKIP, tax_code: SKIP, recurring: SKIP, upgrade_charge: SKIP, downgrade_credit: SKIP, created_at: SKIP, updated_at: SKIP, archived_at: SKIP, hide_date_range_on_invoice: SKIP, allow_fractional_quantities: SKIP, item_category: SKIP, use_site_exchange_rate: SKIP, accounting_code: SKIP, event_based_billing_metric_id: SKIP, interval: SKIP, interval_unit: SKIP, additional_properties: {}) ⇒ Component
Returns a new instance of Component.
287 288 289 290 291 292 293 294 295 296 297 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 351 |
# File 'lib/advanced_billing/models/component.rb', line 287 def initialize(id: SKIP, name: SKIP, handle: SKIP, pricing_scheme: SKIP, unit_name: SKIP, unit_price: SKIP, product_family_id: SKIP, product_family_name: SKIP, product_family_handle: SKIP, price_per_unit_in_cents: SKIP, kind: SKIP, archived: SKIP, taxable: SKIP, description: SKIP, default_price_point_id: SKIP, overage_prices: SKIP, prices: SKIP, price_point_count: SKIP, price_points_url: SKIP, default_price_point_name: SKIP, tax_code: SKIP, recurring: SKIP, upgrade_charge: SKIP, downgrade_credit: SKIP, created_at: SKIP, updated_at: SKIP, archived_at: SKIP, hide_date_range_on_invoice: SKIP, allow_fractional_quantities: SKIP, item_category: SKIP, use_site_exchange_rate: SKIP, accounting_code: SKIP, event_based_billing_metric_id: SKIP, interval: SKIP, interval_unit: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @id = id unless id == SKIP @name = name unless name == SKIP @handle = handle unless handle == SKIP @pricing_scheme = pricing_scheme unless pricing_scheme == SKIP @unit_name = unit_name unless unit_name == SKIP @unit_price = unit_price unless unit_price == SKIP @product_family_id = product_family_id unless product_family_id == SKIP @product_family_name = product_family_name unless product_family_name == SKIP @product_family_handle = product_family_handle unless product_family_handle == SKIP @price_per_unit_in_cents = price_per_unit_in_cents unless price_per_unit_in_cents == SKIP @kind = kind unless kind == SKIP @archived = archived unless archived == SKIP @taxable = taxable unless taxable == SKIP @description = description unless description == SKIP @default_price_point_id = default_price_point_id unless default_price_point_id == SKIP @overage_prices = overage_prices unless overage_prices == SKIP @prices = prices unless prices == SKIP @price_point_count = price_point_count unless price_point_count == SKIP @price_points_url = price_points_url unless price_points_url == SKIP @default_price_point_name = default_price_point_name unless default_price_point_name == SKIP @tax_code = tax_code unless tax_code == SKIP @recurring = recurring unless recurring == SKIP @upgrade_charge = upgrade_charge unless upgrade_charge == SKIP @downgrade_credit = downgrade_credit unless downgrade_credit == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP @archived_at = archived_at unless archived_at == SKIP unless hide_date_range_on_invoice == SKIP @hide_date_range_on_invoice = hide_date_range_on_invoice end unless allow_fractional_quantities == SKIP @allow_fractional_quantities = allow_fractional_quantities end @item_category = item_category unless item_category == SKIP @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP @accounting_code = accounting_code unless accounting_code == SKIP unless event_based_billing_metric_id == SKIP @event_based_billing_metric_id = event_based_billing_metric_id end @interval = interval unless interval == SKIP @interval_unit = interval_unit unless interval_unit == SKIP end |
Instance Attribute Details
#accounting_code ⇒ String
E.g. Internal ID or SKU Number
161 162 163 |
# File 'lib/advanced_billing/models/component.rb', line 161 def accounting_code @accounting_code end |
#allow_fractional_quantities ⇒ TrueClass | FalseClass
(Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
147 148 149 |
# File 'lib/advanced_billing/models/component.rb', line 147 def allow_fractional_quantities @allow_fractional_quantities end |
#archived ⇒ TrueClass | FalseClass
Boolean flag describing whether a component is archived or not.
63 64 65 |
# File 'lib/advanced_billing/models/component.rb', line 63 def archived @archived end |
#archived_at ⇒ DateTime
Timestamp indicating when this component was archived
135 136 137 |
# File 'lib/advanced_billing/models/component.rb', line 135 def archived_at @archived_at end |
#created_at ⇒ DateTime
Timestamp indicating when this component was created
127 128 129 |
# File 'lib/advanced_billing/models/component.rb', line 127 def created_at @created_at end |
#default_price_point_id ⇒ Integer
The description of the component.
75 76 77 |
# File 'lib/advanced_billing/models/component.rb', line 75 def default_price_point_id @default_price_point_id end |
#default_price_point_name ⇒ String
URL that points to the location to read the existing price points via GET request
99 100 101 |
# File 'lib/advanced_billing/models/component.rb', line 99 def default_price_point_name @default_price_point_name end |
#description ⇒ String
The description of the component.
71 72 73 |
# File 'lib/advanced_billing/models/component.rb', line 71 def description @description end |
#downgrade_credit ⇒ CreditType
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Available values: ‘full`, `prorated`, `none`.
123 124 125 |
# File 'lib/advanced_billing/models/component.rb', line 123 def downgrade_credit @downgrade_credit end |
#event_based_billing_metric_id ⇒ Integer
(Only for Event Based Components) This is an ID of a metric attached to the component. This metric is used to bill upon collected events.
166 167 168 |
# File 'lib/advanced_billing/models/component.rb', line 166 def event_based_billing_metric_id @event_based_billing_metric_id end |
#handle ⇒ String
The component API handle
25 26 27 |
# File 'lib/advanced_billing/models/component.rb', line 25 def handle @handle end |
#hide_date_range_on_invoice ⇒ TrueClass | FalseClass
(Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
141 142 143 |
# File 'lib/advanced_billing/models/component.rb', line 141 def hide_date_range_on_invoice @hide_date_range_on_invoice end |
#id ⇒ Integer
The unique ID assigned to the component by Chargify. This ID can be used to fetch the component from the API.
16 17 18 |
# File 'lib/advanced_billing/models/component.rb', line 16 def id @id end |
#interval ⇒ Integer
The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component’s default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled.
173 174 175 |
# File 'lib/advanced_billing/models/component.rb', line 173 def interval @interval end |
#interval_unit ⇒ IntervalUnit
A string representing the interval unit for this component’s default price point, either month or day. This property is only available for sites with Multifrequency enabled.
179 180 181 |
# File 'lib/advanced_billing/models/component.rb', line 179 def interval_unit @interval_unit end |
#item_category ⇒ ItemCategory
One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other
152 153 154 |
# File 'lib/advanced_billing/models/component.rb', line 152 def item_category @item_category end |
#kind ⇒ ComponentKind
A handle for the component type
59 60 61 |
# File 'lib/advanced_billing/models/component.rb', line 59 def kind @kind end |
#name ⇒ String
The name of the Component, suitable for display on statements. i.e. Text Messages.
21 22 23 |
# File 'lib/advanced_billing/models/component.rb', line 21 def name @name end |
#overage_prices ⇒ Array[ComponentPrice]
Applicable only to prepaid usage components. An array of overage price brackets.
80 81 82 |
# File 'lib/advanced_billing/models/component.rb', line 80 def overage_prices @overage_prices end |
#price_per_unit_in_cents ⇒ Integer
deprecated - use unit_price instead
55 56 57 |
# File 'lib/advanced_billing/models/component.rb', line 55 def price_per_unit_in_cents @price_per_unit_in_cents end |
#price_point_count ⇒ Integer
Count for the number of price points associated with the component
89 90 91 |
# File 'lib/advanced_billing/models/component.rb', line 89 def price_point_count @price_point_count end |
#price_points_url ⇒ String
URL that points to the location to read the existing price points via GET request
94 95 96 |
# File 'lib/advanced_billing/models/component.rb', line 94 def price_points_url @price_points_url end |
#prices ⇒ Array[ComponentPrice]
An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty.
85 86 87 |
# File 'lib/advanced_billing/models/component.rb', line 85 def prices @prices end |
#pricing_scheme ⇒ PricingScheme
The component API handle
29 30 31 |
# File 'lib/advanced_billing/models/component.rb', line 29 def pricing_scheme @pricing_scheme end |
#product_family_handle ⇒ String
The handle of the Product Family to which the Component belongs
51 52 53 |
# File 'lib/advanced_billing/models/component.rb', line 51 def product_family_handle @product_family_handle end |
#product_family_id ⇒ Integer
The id of the Product Family to which the Component belongs
43 44 45 |
# File 'lib/advanced_billing/models/component.rb', line 43 def product_family_id @product_family_id end |
#product_family_name ⇒ String
The name of the Product Family to which the Component belongs
47 48 49 |
# File 'lib/advanced_billing/models/component.rb', line 47 def product_family_name @product_family_name end |
#recurring ⇒ TrueClass | FalseClass
A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters.
111 112 113 |
# File 'lib/advanced_billing/models/component.rb', line 111 def recurring @recurring end |
#tax_code ⇒ String
A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters.
105 106 107 |
# File 'lib/advanced_billing/models/component.rb', line 105 def tax_code @tax_code end |
#taxable ⇒ TrueClass | FalseClass
Boolean flag describing whether a component is taxable or not.
67 68 69 |
# File 'lib/advanced_billing/models/component.rb', line 67 def taxable @taxable end |
#unit_name ⇒ String
The name of the unit that the component’s usage is measured in. i.e. message
34 35 36 |
# File 'lib/advanced_billing/models/component.rb', line 34 def unit_name @unit_name end |
#unit_price ⇒ String
The amount the customer will be charged per unit. This field is only populated for ‘per_unit’ pricing schemes, otherwise it may be null.
39 40 41 |
# File 'lib/advanced_billing/models/component.rb', line 39 def unit_price @unit_price end |
#updated_at ⇒ DateTime
Timestamp indicating when this component was updated
131 132 133 |
# File 'lib/advanced_billing/models/component.rb', line 131 def updated_at @updated_at end |
#upgrade_charge ⇒ CreditType
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Available values: ‘full`, `prorated`, `none`.
117 118 119 |
# File 'lib/advanced_billing/models/component.rb', line 117 def upgrade_charge @upgrade_charge end |
#use_site_exchange_rate ⇒ TrueClass | FalseClass
One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other
157 158 159 |
# File 'lib/advanced_billing/models/component.rb', line 157 def use_site_exchange_rate @use_site_exchange_rate end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/advanced_billing/models/component.rb', line 354 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP handle = hash.key?('handle') ? hash['handle'] : SKIP pricing_scheme = hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP unit_name = hash.key?('unit_name') ? hash['unit_name'] : SKIP unit_price = hash.key?('unit_price') ? hash['unit_price'] : SKIP product_family_id = hash.key?('product_family_id') ? hash['product_family_id'] : SKIP product_family_name = hash.key?('product_family_name') ? hash['product_family_name'] : SKIP product_family_handle = hash.key?('product_family_handle') ? hash['product_family_handle'] : SKIP price_per_unit_in_cents = hash.key?('price_per_unit_in_cents') ? hash['price_per_unit_in_cents'] : SKIP kind = hash.key?('kind') ? hash['kind'] : SKIP archived = hash.key?('archived') ? hash['archived'] : SKIP taxable = hash.key?('taxable') ? hash['taxable'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP default_price_point_id = hash.key?('default_price_point_id') ? hash['default_price_point_id'] : SKIP # Parameter is an array, so we need to iterate through it overage_prices = nil unless hash['overage_prices'].nil? overage_prices = [] hash['overage_prices'].each do |structure| overage_prices << (ComponentPrice.from_hash(structure) if structure) end end overage_prices = SKIP unless hash.key?('overage_prices') # Parameter is an array, so we need to iterate through it prices = nil unless hash['prices'].nil? prices = [] hash['prices'].each do |structure| prices << (ComponentPrice.from_hash(structure) if structure) end end prices = SKIP unless hash.key?('prices') price_point_count = hash.key?('price_point_count') ? hash['price_point_count'] : SKIP price_points_url = hash.key?('price_points_url') ? hash['price_points_url'] : SKIP default_price_point_name = hash.key?('default_price_point_name') ? hash['default_price_point_name'] : SKIP tax_code = hash.key?('tax_code') ? hash['tax_code'] : SKIP recurring = hash.key?('recurring') ? hash['recurring'] : SKIP upgrade_charge = hash.key?('upgrade_charge') ? hash['upgrade_charge'] : SKIP downgrade_credit = hash.key?('downgrade_credit') ? hash['downgrade_credit'] : SKIP created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) else SKIP end archived_at = if hash.key?('archived_at') (DateTimeHelper.from_rfc3339(hash['archived_at']) if hash['archived_at']) else SKIP end hide_date_range_on_invoice = hash.key?('hide_date_range_on_invoice') ? hash['hide_date_range_on_invoice'] : SKIP allow_fractional_quantities = hash.key?('allow_fractional_quantities') ? hash['allow_fractional_quantities'] : SKIP item_category = hash.key?('item_category') ? hash['item_category'] : SKIP use_site_exchange_rate = hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP accounting_code = hash.key?('accounting_code') ? hash['accounting_code'] : SKIP event_based_billing_metric_id = hash.key?('event_based_billing_metric_id') ? hash['event_based_billing_metric_id'] : SKIP interval = hash.key?('interval') ? hash['interval'] : SKIP interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. Component.new(id: id, name: name, handle: handle, pricing_scheme: pricing_scheme, unit_name: unit_name, unit_price: unit_price, product_family_id: product_family_id, product_family_name: product_family_name, product_family_handle: product_family_handle, price_per_unit_in_cents: price_per_unit_in_cents, kind: kind, archived: archived, taxable: taxable, description: description, default_price_point_id: default_price_point_id, overage_prices: overage_prices, prices: prices, price_point_count: price_point_count, price_points_url: price_points_url, default_price_point_name: default_price_point_name, tax_code: tax_code, recurring: recurring, upgrade_charge: upgrade_charge, downgrade_credit: downgrade_credit, created_at: created_at, updated_at: updated_at, archived_at: archived_at, hide_date_range_on_invoice: hide_date_range_on_invoice, allow_fractional_quantities: allow_fractional_quantities, item_category: item_category, use_site_exchange_rate: use_site_exchange_rate, accounting_code: accounting_code, event_based_billing_metric_id: event_based_billing_metric_id, interval: interval, interval_unit: interval_unit, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
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 |
# File 'lib/advanced_billing/models/component.rb', line 182 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['name'] = 'name' @_hash['handle'] = 'handle' @_hash['pricing_scheme'] = 'pricing_scheme' @_hash['unit_name'] = 'unit_name' @_hash['unit_price'] = 'unit_price' @_hash['product_family_id'] = 'product_family_id' @_hash['product_family_name'] = 'product_family_name' @_hash['product_family_handle'] = 'product_family_handle' @_hash['price_per_unit_in_cents'] = 'price_per_unit_in_cents' @_hash['kind'] = 'kind' @_hash['archived'] = 'archived' @_hash['taxable'] = 'taxable' @_hash['description'] = 'description' @_hash['default_price_point_id'] = 'default_price_point_id' @_hash['overage_prices'] = 'overage_prices' @_hash['prices'] = 'prices' @_hash['price_point_count'] = 'price_point_count' @_hash['price_points_url'] = 'price_points_url' @_hash['default_price_point_name'] = 'default_price_point_name' @_hash['tax_code'] = 'tax_code' @_hash['recurring'] = 'recurring' @_hash['upgrade_charge'] = 'upgrade_charge' @_hash['downgrade_credit'] = 'downgrade_credit' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['archived_at'] = 'archived_at' @_hash['hide_date_range_on_invoice'] = 'hide_date_range_on_invoice' @_hash['allow_fractional_quantities'] = 'allow_fractional_quantities' @_hash['item_category'] = 'item_category' @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate' @_hash['accounting_code'] = 'accounting_code' @_hash['event_based_billing_metric_id'] = 'event_based_billing_metric_id' @_hash['interval'] = 'interval' @_hash['interval_unit'] = 'interval_unit' @_hash end |
.nullables ⇒ Object
An array for nullable fields
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/advanced_billing/models/component.rb', line 265 def self.nullables %w[ handle pricing_scheme unit_price price_per_unit_in_cents description default_price_point_id overage_prices prices price_points_url tax_code upgrade_charge downgrade_credit archived_at item_category use_site_exchange_rate accounting_code interval_unit ] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/advanced_billing/models/component.rb', line 224 def self.optionals %w[ id name handle pricing_scheme unit_name unit_price product_family_id product_family_name product_family_handle price_per_unit_in_cents kind archived taxable description default_price_point_id overage_prices prices price_point_count price_points_url default_price_point_name tax_code recurring upgrade_charge downgrade_credit created_at updated_at archived_at hide_date_range_on_invoice allow_fractional_quantities item_category use_site_exchange_rate accounting_code event_based_billing_metric_id interval interval_unit ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/advanced_billing/models/component.rb', line 516 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, handle: #{@handle.inspect},"\ " pricing_scheme: #{@pricing_scheme.inspect}, unit_name: #{@unit_name.inspect}, unit_price:"\ " #{@unit_price.inspect}, product_family_id: #{@product_family_id.inspect},"\ " product_family_name: #{@product_family_name.inspect}, product_family_handle:"\ " #{@product_family_handle.inspect}, price_per_unit_in_cents:"\ " #{@price_per_unit_in_cents.inspect}, kind: #{@kind.inspect}, archived:"\ " #{@archived.inspect}, taxable: #{@taxable.inspect}, description: #{@description.inspect},"\ " default_price_point_id: #{@default_price_point_id.inspect}, overage_prices:"\ " #{@overage_prices.inspect}, prices: #{@prices.inspect}, price_point_count:"\ " #{@price_point_count.inspect}, price_points_url: #{@price_points_url.inspect},"\ " default_price_point_name: #{@default_price_point_name.inspect}, tax_code:"\ " #{@tax_code.inspect}, recurring: #{@recurring.inspect}, upgrade_charge:"\ " #{@upgrade_charge.inspect}, downgrade_credit: #{@downgrade_credit.inspect}, created_at:"\ " #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, archived_at:"\ " #{@archived_at.inspect}, hide_date_range_on_invoice:"\ " #{@hide_date_range_on_invoice.inspect}, allow_fractional_quantities:"\ " #{@allow_fractional_quantities.inspect}, item_category: #{@item_category.inspect},"\ " use_site_exchange_rate: #{@use_site_exchange_rate.inspect}, accounting_code:"\ " #{@accounting_code.inspect}, event_based_billing_metric_id:"\ " #{@event_based_billing_metric_id.inspect}, interval: #{@interval.inspect}, interval_unit:"\ " #{@interval_unit.inspect}, additional_properties: #{get_additional_properties}>" end |
#to_custom_archived_at ⇒ Object
490 491 492 |
# File 'lib/advanced_billing/models/component.rb', line 490 def to_custom_archived_at DateTimeHelper.to_rfc3339(archived_at) end |
#to_custom_created_at ⇒ Object
482 483 484 |
# File 'lib/advanced_billing/models/component.rb', line 482 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
486 487 488 |
# File 'lib/advanced_billing/models/component.rb', line 486 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/advanced_billing/models/component.rb', line 495 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, name: #{@name}, handle: #{@handle}, pricing_scheme:"\ " #{@pricing_scheme}, unit_name: #{@unit_name}, unit_price: #{@unit_price},"\ " product_family_id: #{@product_family_id}, product_family_name: #{@product_family_name},"\ " product_family_handle: #{@product_family_handle}, price_per_unit_in_cents:"\ " #{@price_per_unit_in_cents}, kind: #{@kind}, archived: #{@archived}, taxable: #{@taxable},"\ " description: #{@description}, default_price_point_id: #{@default_price_point_id},"\ " overage_prices: #{@overage_prices}, prices: #{@prices}, price_point_count:"\ " #{@price_point_count}, price_points_url: #{@price_points_url}, default_price_point_name:"\ " #{@default_price_point_name}, tax_code: #{@tax_code}, recurring: #{@recurring},"\ " upgrade_charge: #{@upgrade_charge}, downgrade_credit: #{@downgrade_credit}, created_at:"\ " #{@created_at}, updated_at: #{@updated_at}, archived_at: #{@archived_at},"\ " hide_date_range_on_invoice: #{@hide_date_range_on_invoice}, allow_fractional_quantities:"\ " #{@allow_fractional_quantities}, item_category: #{@item_category}, use_site_exchange_rate:"\ " #{@use_site_exchange_rate}, accounting_code: #{@accounting_code},"\ " event_based_billing_metric_id: #{@event_based_billing_metric_id}, interval: #{@interval},"\ " interval_unit: #{@interval_unit}, additional_properties: #{get_additional_properties}>" end |