Class: AdvancedBilling::AllocationSettings
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::AllocationSettings
- Defined in:
- lib/advanced_billing/models/allocation_settings.rb
Overview
AllocationSettings Model.
Instance Attribute Summary collapse
-
#accrue_charge ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#downgrade_credit ⇒ String
TODO: Write general description for this method.
-
#upgrade_charge ⇒ String
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(upgrade_charge = SKIP, downgrade_credit = SKIP, accrue_charge = SKIP) ⇒ AllocationSettings
constructor
A new instance of AllocationSettings.
Methods inherited from BaseModel
Constructor Details
#initialize(upgrade_charge = SKIP, downgrade_credit = SKIP, accrue_charge = SKIP) ⇒ AllocationSettings
Returns a new instance of AllocationSettings.
50 51 52 53 54 55 |
# File 'lib/advanced_billing/models/allocation_settings.rb', line 50 def initialize(upgrade_charge = SKIP, downgrade_credit = SKIP, accrue_charge = SKIP) @upgrade_charge = upgrade_charge unless upgrade_charge == SKIP @downgrade_credit = downgrade_credit unless downgrade_credit == SKIP @accrue_charge = accrue_charge unless accrue_charge == SKIP end |
Instance Attribute Details
#accrue_charge ⇒ TrueClass | FalseClass
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/allocation_settings.rb', line 22 def accrue_charge @accrue_charge end |
#downgrade_credit ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/allocation_settings.rb', line 18 def downgrade_credit @downgrade_credit end |
#upgrade_charge ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/allocation_settings.rb', line 14 def upgrade_charge @upgrade_charge end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/advanced_billing/models/allocation_settings.rb', line 58 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. upgrade_charge = hash.key?('upgrade_charge') ? hash['upgrade_charge'] : SKIP downgrade_credit = hash.key?('downgrade_credit') ? hash['downgrade_credit'] : SKIP accrue_charge = hash.key?('accrue_charge') ? hash['accrue_charge'] : SKIP # Create object from extracted values. AllocationSettings.new(upgrade_charge, downgrade_credit, accrue_charge) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/advanced_billing/models/allocation_settings.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['upgrade_charge'] = 'upgrade_charge' @_hash['downgrade_credit'] = 'downgrade_credit' @_hash['accrue_charge'] = 'accrue_charge' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 46 47 48 |
# File 'lib/advanced_billing/models/allocation_settings.rb', line 43 def self.nullables %w[ upgrade_charge downgrade_credit ] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/advanced_billing/models/allocation_settings.rb', line 34 def self.optionals %w[ upgrade_charge downgrade_credit accrue_charge ] end |