Class: AdvancedBilling::SubscriptionComponent
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::SubscriptionComponent
- Defined in:
- lib/advanced_billing/models/subscription_component.rb
Overview
SubscriptionComponent Model.
Instance Attribute Summary collapse
-
#allocated_quantity ⇒ Object
For Quantity-based components: The current allocation for the component on the given subscription.
-
#allow_fractional_quantities ⇒ TrueClass | FalseClass
The type of credit to be created when upgrading/downgrading.
-
#archived_at ⇒ DateTime
The type of credit to be created when upgrading/downgrading.
-
#component_handle ⇒ String
For Quantity-based components: The current allocation for the component on the given subscription.
-
#component_id ⇒ Integer
For Quantity-based components: The current allocation for the component on the given subscription.
-
#created_at ⇒ DateTime
The type of credit to be created when upgrading/downgrading.
-
#currency ⇒ String
(for on/off components) indicates if the component is enabled for the subscription.
-
#description ⇒ String
The type of credit to be created when upgrading/downgrading.
-
#display_on_hosted_page ⇒ TrueClass | FalseClass
An optional object, will be returned if provided ‘include=subscription` query param.
-
#downgrade_credit ⇒ CreditType
The type of credit to be created when upgrading/downgrading.
-
#enabled ⇒ TrueClass | FalseClass
(for on/off components) indicates if the component is enabled for the subscription.
-
#historic_usages ⇒ Array[HistoricUsage]
An optional object, will be returned if provided ‘include=subscription` query param.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#interval ⇒ Integer
The numerical interval.
-
#interval_unit ⇒ IntervalUnit
A string representing the interval unit for this component price point, either month or day.
-
#kind ⇒ ComponentKind
A handle for the component type.
-
#name ⇒ String
TODO: Write general description for this method.
-
#price_point_handle ⇒ String
The type of credit to be created when upgrading/downgrading.
-
#price_point_id ⇒ Integer
The type of credit to be created when upgrading/downgrading.
-
#price_point_name ⇒ String
The type of credit to be created when upgrading/downgrading.
-
#price_point_type ⇒ PricePointType
The type of credit to be created when upgrading/downgrading.
-
#pricing_scheme ⇒ PricingScheme
For Quantity-based components: The current allocation for the component on the given subscription.
-
#product_family_handle ⇒ String
The type of credit to be created when upgrading/downgrading.
-
#product_family_id ⇒ Integer
The type of credit to be created when upgrading/downgrading.
-
#recurring ⇒ TrueClass | FalseClass
For Quantity-based components: The current allocation for the component on the given subscription.
-
#subscription ⇒ SubscriptionComponentSubscription
An optional object, will be returned if provided ‘include=subscription` query param.
-
#subscription_id ⇒ Integer
For Quantity-based components: The current allocation for the component on the given subscription.
-
#unit_balance ⇒ Integer
(for on/off components) indicates if the component is enabled for the subscription.
-
#unit_name ⇒ String
A handle for the component type.
-
#updated_at ⇒ DateTime
The type of credit to be created when upgrading/downgrading.
-
#upgrade_charge ⇒ CreditType
The type of credit to be created when upgrading/downgrading.
-
#use_site_exchange_rate ⇒ TrueClass | FalseClass
The type of credit to be created when upgrading/downgrading.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(id: SKIP, name: SKIP, kind: SKIP, unit_name: SKIP, enabled: SKIP, unit_balance: SKIP, currency: SKIP, allocated_quantity: SKIP, pricing_scheme: SKIP, component_id: SKIP, component_handle: SKIP, subscription_id: SKIP, recurring: SKIP, upgrade_charge: SKIP, downgrade_credit: SKIP, archived_at: SKIP, price_point_id: SKIP, price_point_handle: SKIP, price_point_type: SKIP, price_point_name: SKIP, product_family_id: SKIP, product_family_handle: SKIP, created_at: SKIP, updated_at: SKIP, use_site_exchange_rate: SKIP, description: SKIP, allow_fractional_quantities: SKIP, subscription: SKIP, historic_usages: SKIP, display_on_hosted_page: SKIP, interval: SKIP, interval_unit: SKIP, additional_properties: {}) ⇒ SubscriptionComponent
constructor
A new instance of SubscriptionComponent.
-
#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, kind: SKIP, unit_name: SKIP, enabled: SKIP, unit_balance: SKIP, currency: SKIP, allocated_quantity: SKIP, pricing_scheme: SKIP, component_id: SKIP, component_handle: SKIP, subscription_id: SKIP, recurring: SKIP, upgrade_charge: SKIP, downgrade_credit: SKIP, archived_at: SKIP, price_point_id: SKIP, price_point_handle: SKIP, price_point_type: SKIP, price_point_name: SKIP, product_family_id: SKIP, product_family_handle: SKIP, created_at: SKIP, updated_at: SKIP, use_site_exchange_rate: SKIP, description: SKIP, allow_fractional_quantities: SKIP, subscription: SKIP, historic_usages: SKIP, display_on_hosted_page: SKIP, interval: SKIP, interval_unit: SKIP, additional_properties: {}) ⇒ SubscriptionComponent
Returns a new instance of SubscriptionComponent.
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 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 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 272 def initialize(id: SKIP, name: SKIP, kind: SKIP, unit_name: SKIP, enabled: SKIP, unit_balance: SKIP, currency: SKIP, allocated_quantity: SKIP, pricing_scheme: SKIP, component_id: SKIP, component_handle: SKIP, subscription_id: SKIP, recurring: SKIP, upgrade_charge: SKIP, downgrade_credit: SKIP, archived_at: SKIP, price_point_id: SKIP, price_point_handle: SKIP, price_point_type: SKIP, price_point_name: SKIP, product_family_id: SKIP, product_family_handle: SKIP, created_at: SKIP, updated_at: SKIP, use_site_exchange_rate: SKIP, description: SKIP, allow_fractional_quantities: SKIP, subscription: SKIP, historic_usages: SKIP, display_on_hosted_page: 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 @kind = kind unless kind == SKIP @unit_name = unit_name unless unit_name == SKIP @enabled = enabled unless enabled == SKIP @unit_balance = unit_balance unless unit_balance == SKIP @currency = currency unless currency == SKIP @allocated_quantity = allocated_quantity unless allocated_quantity == SKIP @pricing_scheme = pricing_scheme unless pricing_scheme == SKIP @component_id = component_id unless component_id == SKIP @component_handle = component_handle unless component_handle == SKIP @subscription_id = subscription_id unless subscription_id == SKIP @recurring = recurring unless recurring == SKIP @upgrade_charge = upgrade_charge unless upgrade_charge == SKIP @downgrade_credit = downgrade_credit unless downgrade_credit == SKIP @archived_at = archived_at unless archived_at == SKIP @price_point_id = price_point_id unless price_point_id == SKIP @price_point_handle = price_point_handle unless price_point_handle == SKIP @price_point_type = price_point_type unless price_point_type == SKIP @price_point_name = price_point_name unless price_point_name == SKIP @product_family_id = product_family_id unless product_family_id == SKIP @product_family_handle = product_family_handle unless product_family_handle == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP @description = description unless description == SKIP unless allow_fractional_quantities == SKIP @allow_fractional_quantities = allow_fractional_quantities end @subscription = subscription unless subscription == SKIP @historic_usages = historic_usages unless historic_usages == SKIP @display_on_hosted_page = display_on_hosted_page unless display_on_hosted_page == SKIP @interval = interval unless interval == SKIP @interval_unit = interval_unit unless interval_unit == SKIP end |
Instance Attribute Details
#allocated_quantity ⇒ Object
For Quantity-based components: The current allocation for the component on the given subscription. For On/Off components: Use 1 for on. Use 0 for off.
48 49 50 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 48 def allocated_quantity @allocated_quantity end |
#allow_fractional_quantities ⇒ TrueClass | FalseClass
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
148 149 150 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 148 def allow_fractional_quantities @allow_fractional_quantities end |
#archived_at ⇒ DateTime
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
93 94 95 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 93 def archived_at @archived_at end |
#component_handle ⇒ String
For Quantity-based components: The current allocation for the component on the given subscription. For On/Off components: Use 1 for on. Use 0 for off.
66 67 68 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 66 def component_handle @component_handle end |
#component_id ⇒ Integer
For Quantity-based components: The current allocation for the component on the given subscription. For On/Off components: Use 1 for on. Use 0 for off.
60 61 62 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 60 def component_id @component_id end |
#created_at ⇒ DateTime
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
128 129 130 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 128 def created_at @created_at end |
#currency ⇒ String
(for on/off components) indicates if the component is enabled for the subscription
42 43 44 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 42 def currency @currency end |
#description ⇒ String
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
143 144 145 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 143 def description @description end |
#display_on_hosted_page ⇒ TrueClass | FalseClass
An optional object, will be returned if provided ‘include=subscription` query param.
163 164 165 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 163 def display_on_hosted_page @display_on_hosted_page 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.
88 89 90 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 88 def downgrade_credit @downgrade_credit end |
#enabled ⇒ TrueClass | FalseClass
(for on/off components) indicates if the component is enabled for the subscription
32 33 34 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 32 def enabled @enabled end |
#historic_usages ⇒ Array[HistoricUsage]
An optional object, will be returned if provided ‘include=subscription` query param.
158 159 160 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 158 def historic_usages @historic_usages end |
#id ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 15 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 price point would renew every 30 days. This property is only available for sites with Multifrequency enabled.
170 171 172 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 170 def interval @interval end |
#interval_unit ⇒ IntervalUnit
A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled.
176 177 178 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 176 def interval_unit @interval_unit end |
#kind ⇒ ComponentKind
A handle for the component type
23 24 25 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 23 def kind @kind end |
#name ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 19 def name @name end |
#price_point_handle ⇒ String
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
103 104 105 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 103 def price_point_handle @price_point_handle end |
#price_point_id ⇒ Integer
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
98 99 100 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 98 def price_point_id @price_point_id end |
#price_point_name ⇒ String
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
113 114 115 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 113 def price_point_name @price_point_name end |
#price_point_type ⇒ PricePointType
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
108 109 110 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 108 def price_point_type @price_point_type end |
#pricing_scheme ⇒ PricingScheme
For Quantity-based components: The current allocation for the component on the given subscription. For On/Off components: Use 1 for on. Use 0 for off.
54 55 56 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 54 def pricing_scheme @pricing_scheme end |
#product_family_handle ⇒ String
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
123 124 125 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 123 def product_family_handle @product_family_handle end |
#product_family_id ⇒ Integer
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
118 119 120 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 118 def product_family_id @product_family_id end |
#recurring ⇒ TrueClass | FalseClass
For Quantity-based components: The current allocation for the component on the given subscription. For On/Off components: Use 1 for on. Use 0 for off.
78 79 80 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 78 def recurring @recurring end |
#subscription ⇒ SubscriptionComponentSubscription
An optional object, will be returned if provided ‘include=subscription` query param.
153 154 155 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 153 def subscription @subscription end |
#subscription_id ⇒ Integer
For Quantity-based components: The current allocation for the component on the given subscription. For On/Off components: Use 1 for on. Use 0 for off.
72 73 74 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 72 def subscription_id @subscription_id end |
#unit_balance ⇒ Integer
(for on/off components) indicates if the component is enabled for the subscription
37 38 39 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 37 def unit_balance @unit_balance end |
#unit_name ⇒ String
A handle for the component type
27 28 29 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 27 def unit_name @unit_name end |
#updated_at ⇒ DateTime
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
133 134 135 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 133 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.
83 84 85 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 83 def upgrade_charge @upgrade_charge end |
#use_site_exchange_rate ⇒ TrueClass | FalseClass
The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
138 139 140 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 138 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.
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 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 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 330 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 kind = hash.key?('kind') ? hash['kind'] : SKIP unit_name = hash.key?('unit_name') ? hash['unit_name'] : SKIP enabled = hash.key?('enabled') ? hash['enabled'] : SKIP unit_balance = hash.key?('unit_balance') ? hash['unit_balance'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP allocated_quantity = hash.key?('allocated_quantity') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:SubscriptionComponentAllocatedQuantity), hash['allocated_quantity'] ) : SKIP pricing_scheme = hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP component_id = hash.key?('component_id') ? hash['component_id'] : SKIP component_handle = hash.key?('component_handle') ? hash['component_handle'] : SKIP subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : 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 archived_at = if hash.key?('archived_at') (DateTimeHelper.from_rfc3339(hash['archived_at']) if hash['archived_at']) else SKIP end price_point_id = hash.key?('price_point_id') ? hash['price_point_id'] : SKIP price_point_handle = hash.key?('price_point_handle') ? hash['price_point_handle'] : SKIP price_point_type = hash.key?('price_point_type') ? hash['price_point_type'] : SKIP price_point_name = hash.key?('price_point_name') ? hash['price_point_name'] : SKIP product_family_id = hash.key?('product_family_id') ? hash['product_family_id'] : SKIP product_family_handle = hash.key?('product_family_handle') ? hash['product_family_handle'] : 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 use_site_exchange_rate = hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP allow_fractional_quantities = hash.key?('allow_fractional_quantities') ? hash['allow_fractional_quantities'] : SKIP subscription = SubscriptionComponentSubscription.from_hash(hash['subscription']) if hash['subscription'] # Parameter is an array, so we need to iterate through it historic_usages = nil unless hash['historic_usages'].nil? historic_usages = [] hash['historic_usages'].each do |structure| historic_usages << (HistoricUsage.from_hash(structure) if structure) end end historic_usages = SKIP unless hash.key?('historic_usages') display_on_hosted_page = hash.key?('display_on_hosted_page') ? hash['display_on_hosted_page'] : 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. SubscriptionComponent.new(id: id, name: name, kind: kind, unit_name: unit_name, enabled: enabled, unit_balance: unit_balance, currency: currency, allocated_quantity: allocated_quantity, pricing_scheme: pricing_scheme, component_id: component_id, component_handle: component_handle, subscription_id: subscription_id, recurring: recurring, upgrade_charge: upgrade_charge, downgrade_credit: downgrade_credit, archived_at: archived_at, price_point_id: price_point_id, price_point_handle: price_point_handle, price_point_type: price_point_type, price_point_name: price_point_name, product_family_id: product_family_id, product_family_handle: product_family_handle, created_at: created_at, updated_at: updated_at, use_site_exchange_rate: use_site_exchange_rate, description: description, allow_fractional_quantities: allow_fractional_quantities, subscription: subscription, historic_usages: historic_usages, display_on_hosted_page: display_on_hosted_page, interval: interval, interval_unit: interval_unit, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
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 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 179 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['name'] = 'name' @_hash['kind'] = 'kind' @_hash['unit_name'] = 'unit_name' @_hash['enabled'] = 'enabled' @_hash['unit_balance'] = 'unit_balance' @_hash['currency'] = 'currency' @_hash['allocated_quantity'] = 'allocated_quantity' @_hash['pricing_scheme'] = 'pricing_scheme' @_hash['component_id'] = 'component_id' @_hash['component_handle'] = 'component_handle' @_hash['subscription_id'] = 'subscription_id' @_hash['recurring'] = 'recurring' @_hash['upgrade_charge'] = 'upgrade_charge' @_hash['downgrade_credit'] = 'downgrade_credit' @_hash['archived_at'] = 'archived_at' @_hash['price_point_id'] = 'price_point_id' @_hash['price_point_handle'] = 'price_point_handle' @_hash['price_point_type'] = 'price_point_type' @_hash['price_point_name'] = 'price_point_name' @_hash['product_family_id'] = 'product_family_id' @_hash['product_family_handle'] = 'product_family_handle' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate' @_hash['description'] = 'description' @_hash['allow_fractional_quantities'] = 'allow_fractional_quantities' @_hash['subscription'] = 'subscription' @_hash['historic_usages'] = 'historic_usages' @_hash['display_on_hosted_page'] = 'display_on_hosted_page' @_hash['interval'] = 'interval' @_hash['interval_unit'] = 'interval_unit' @_hash end |
.nullables ⇒ Object
An array for nullable fields
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 255 def self.nullables %w[ pricing_scheme component_handle upgrade_charge downgrade_credit archived_at price_point_id price_point_handle price_point_type price_point_name use_site_exchange_rate description interval_unit ] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 217 def self.optionals %w[ id name kind unit_name enabled unit_balance currency allocated_quantity pricing_scheme component_id component_handle subscription_id recurring upgrade_charge downgrade_credit archived_at price_point_id price_point_handle price_point_type price_point_name product_family_id product_family_handle created_at updated_at use_site_exchange_rate description allow_fractional_quantities subscription historic_usages display_on_hosted_page interval interval_unit ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
458 459 460 461 462 463 464 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 458 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 487 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, kind: #{@kind.inspect},"\ " unit_name: #{@unit_name.inspect}, enabled: #{@enabled.inspect}, unit_balance:"\ " #{@unit_balance.inspect}, currency: #{@currency.inspect}, allocated_quantity:"\ " #{@allocated_quantity.inspect}, pricing_scheme: #{@pricing_scheme.inspect}, component_id:"\ " #{@component_id.inspect}, component_handle: #{@component_handle.inspect}, subscription_id:"\ " #{@subscription_id.inspect}, recurring: #{@recurring.inspect}, upgrade_charge:"\ " #{@upgrade_charge.inspect}, downgrade_credit: #{@downgrade_credit.inspect}, archived_at:"\ " #{@archived_at.inspect}, price_point_id: #{@price_point_id.inspect}, price_point_handle:"\ " #{@price_point_handle.inspect}, price_point_type: #{@price_point_type.inspect},"\ " price_point_name: #{@price_point_name.inspect}, product_family_id:"\ " #{@product_family_id.inspect}, product_family_handle: #{@product_family_handle.inspect},"\ " created_at: #{@created_at.inspect}, updated_at: #{@updated_at.inspect},"\ " use_site_exchange_rate: #{@use_site_exchange_rate.inspect}, description:"\ " #{@description.inspect}, allow_fractional_quantities:"\ " #{@allow_fractional_quantities.inspect}, subscription: #{@subscription.inspect},"\ " historic_usages: #{@historic_usages.inspect}, display_on_hosted_page:"\ " #{@display_on_hosted_page.inspect}, interval: #{@interval.inspect}, interval_unit:"\ " #{@interval_unit.inspect}, additional_properties: #{get_additional_properties}>" end |
#to_custom_archived_at ⇒ Object
444 445 446 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 444 def to_custom_archived_at DateTimeHelper.to_rfc3339(archived_at) end |
#to_custom_created_at ⇒ Object
448 449 450 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 448 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
452 453 454 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 452 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File 'lib/advanced_billing/models/subscription_component.rb', line 467 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, name: #{@name}, kind: #{@kind}, unit_name: #{@unit_name},"\ " enabled: #{@enabled}, unit_balance: #{@unit_balance}, currency: #{@currency},"\ " allocated_quantity: #{@allocated_quantity}, pricing_scheme: #{@pricing_scheme},"\ " component_id: #{@component_id}, component_handle: #{@component_handle}, subscription_id:"\ " #{@subscription_id}, recurring: #{@recurring}, upgrade_charge: #{@upgrade_charge},"\ " downgrade_credit: #{@downgrade_credit}, archived_at: #{@archived_at}, price_point_id:"\ " #{@price_point_id}, price_point_handle: #{@price_point_handle}, price_point_type:"\ " #{@price_point_type}, price_point_name: #{@price_point_name}, product_family_id:"\ " #{@product_family_id}, product_family_handle: #{@product_family_handle}, created_at:"\ " #{@created_at}, updated_at: #{@updated_at}, use_site_exchange_rate:"\ " #{@use_site_exchange_rate}, description: #{@description}, allow_fractional_quantities:"\ " #{@allow_fractional_quantities}, subscription: #{@subscription}, historic_usages:"\ " #{@historic_usages}, display_on_hosted_page: #{@display_on_hosted_page}, interval:"\ " #{@interval}, interval_unit: #{@interval_unit}, additional_properties:"\ " #{get_additional_properties}>" end |