Class: AdvancedBilling::Breakouts
- Defined in:
- lib/advanced_billing/models/breakouts.rb
Overview
Breakouts Model.
Instance Attribute Summary collapse
-
#plan_amount_formatted ⇒ String
TODO: Write general description for this method.
-
#plan_amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#usage_amount_formatted ⇒ String
TODO: Write general description for this method.
-
#usage_amount_in_cents ⇒ Integer
TODO: Write general description for this method.
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(plan_amount_in_cents: SKIP, plan_amount_formatted: SKIP, usage_amount_in_cents: SKIP, usage_amount_formatted: SKIP, additional_properties: {}) ⇒ Breakouts
constructor
A new instance of Breakouts.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(plan_amount_in_cents: SKIP, plan_amount_formatted: SKIP, usage_amount_in_cents: SKIP, usage_amount_formatted: SKIP, additional_properties: {}) ⇒ Breakouts
Returns a new instance of Breakouts.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/advanced_billing/models/breakouts.rb', line 53 def initialize(plan_amount_in_cents: SKIP, plan_amount_formatted: SKIP, usage_amount_in_cents: SKIP, usage_amount_formatted: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @plan_amount_in_cents = plan_amount_in_cents unless plan_amount_in_cents == SKIP @plan_amount_formatted = plan_amount_formatted unless plan_amount_formatted == SKIP @usage_amount_in_cents = usage_amount_in_cents unless usage_amount_in_cents == SKIP @usage_amount_formatted = usage_amount_formatted unless usage_amount_formatted == SKIP end |
Instance Attribute Details
#plan_amount_formatted ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/breakouts.rb', line 18 def plan_amount_formatted @plan_amount_formatted end |
#plan_amount_in_cents ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/breakouts.rb', line 14 def plan_amount_in_cents @plan_amount_in_cents end |
#usage_amount_formatted ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/breakouts.rb', line 26 def usage_amount_formatted @usage_amount_formatted end |
#usage_amount_in_cents ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/breakouts.rb', line 22 def usage_amount_in_cents @usage_amount_in_cents end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/advanced_billing/models/breakouts.rb', line 68 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. plan_amount_in_cents = hash.key?('plan_amount_in_cents') ? hash['plan_amount_in_cents'] : SKIP plan_amount_formatted = hash.key?('plan_amount_formatted') ? hash['plan_amount_formatted'] : SKIP usage_amount_in_cents = hash.key?('usage_amount_in_cents') ? hash['usage_amount_in_cents'] : SKIP usage_amount_formatted = hash.key?('usage_amount_formatted') ? hash['usage_amount_formatted'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. Breakouts.new(plan_amount_in_cents: plan_amount_in_cents, plan_amount_formatted: plan_amount_formatted, usage_amount_in_cents: usage_amount_in_cents, usage_amount_formatted: usage_amount_formatted, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/advanced_billing/models/breakouts.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['plan_amount_in_cents'] = 'plan_amount_in_cents' @_hash['plan_amount_formatted'] = 'plan_amount_formatted' @_hash['usage_amount_in_cents'] = 'usage_amount_in_cents' @_hash['usage_amount_formatted'] = 'usage_amount_formatted' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/advanced_billing/models/breakouts.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/breakouts.rb', line 39 def self.optionals %w[ plan_amount_in_cents plan_amount_formatted usage_amount_in_cents usage_amount_formatted ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
102 103 104 105 106 107 108 |
# File 'lib/advanced_billing/models/breakouts.rb', line 102 def inspect class_name = self.class.name.split('::').last "<#{class_name} plan_amount_in_cents: #{@plan_amount_in_cents.inspect},"\ " plan_amount_formatted: #{@plan_amount_formatted.inspect}, usage_amount_in_cents:"\ " #{@usage_amount_in_cents.inspect}, usage_amount_formatted:"\ " #{@usage_amount_formatted.inspect}, additional_properties: #{get_additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
93 94 95 96 97 98 99 |
# File 'lib/advanced_billing/models/breakouts.rb', line 93 def to_s class_name = self.class.name.split('::').last "<#{class_name} plan_amount_in_cents: #{@plan_amount_in_cents}, plan_amount_formatted:"\ " #{@plan_amount_formatted}, usage_amount_in_cents: #{@usage_amount_in_cents},"\ " usage_amount_formatted: #{@usage_amount_formatted}, additional_properties:"\ " #{get_additional_properties}>" end |