Class: AdvancedBilling::AllocationPreview
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::AllocationPreview
- Defined in:
- lib/advanced_billing/models/allocation_preview.rb
Overview
AllocationPreview Model.
Instance Attribute Summary collapse
-
#accrue_charge ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#allocations ⇒ Array[AllocationPreviewItem]
TODO: Write general description for this method.
-
#direction ⇒ String
TODO: Write general description for this method.
-
#end_date ⇒ String
TODO: Write general description for this method.
-
#existing_balance_in_cents ⇒ Integer
An integer representing the amount of the subscription’s current balance.
-
#line_items ⇒ Array[AllocationPreviewLineItem]
TODO: Write general description for this method.
-
#period_type ⇒ String
TODO: Write general description for this method.
-
#proration_scheme ⇒ String
TODO: Write general description for this method.
-
#start_date ⇒ String
TODO: Write general description for this method.
-
#subtotal_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#total_discount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#total_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#total_tax_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(start_date = SKIP, end_date = SKIP, subtotal_in_cents = SKIP, total_tax_in_cents = SKIP, total_discount_in_cents = SKIP, total_in_cents = SKIP, direction = SKIP, proration_scheme = SKIP, line_items = SKIP, accrue_charge = SKIP, allocations = SKIP, period_type = SKIP, existing_balance_in_cents = SKIP) ⇒ AllocationPreview
constructor
A new instance of AllocationPreview.
Methods inherited from BaseModel
Constructor Details
#initialize(start_date = SKIP, end_date = SKIP, subtotal_in_cents = SKIP, total_tax_in_cents = SKIP, total_discount_in_cents = SKIP, total_in_cents = SKIP, direction = SKIP, proration_scheme = SKIP, line_items = SKIP, accrue_charge = SKIP, allocations = SKIP, period_type = SKIP, existing_balance_in_cents = SKIP) ⇒ AllocationPreview
Returns a new instance of AllocationPreview.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 107 def initialize(start_date = SKIP, end_date = SKIP, subtotal_in_cents = SKIP, total_tax_in_cents = SKIP, total_discount_in_cents = SKIP, total_in_cents = SKIP, direction = SKIP, proration_scheme = SKIP, line_items = SKIP, accrue_charge = SKIP, allocations = SKIP, period_type = SKIP, existing_balance_in_cents = SKIP) @start_date = start_date unless start_date == SKIP @end_date = end_date unless end_date == SKIP @subtotal_in_cents = subtotal_in_cents unless subtotal_in_cents == SKIP @total_tax_in_cents = total_tax_in_cents unless total_tax_in_cents == SKIP @total_discount_in_cents = total_discount_in_cents unless total_discount_in_cents == SKIP @total_in_cents = total_in_cents unless total_in_cents == SKIP @direction = direction unless direction == SKIP @proration_scheme = proration_scheme unless proration_scheme == SKIP @line_items = line_items unless line_items == SKIP @accrue_charge = accrue_charge unless accrue_charge == SKIP @allocations = allocations unless allocations == SKIP @period_type = period_type unless period_type == SKIP unless existing_balance_in_cents == SKIP @existing_balance_in_cents = existing_balance_in_cents end end |
Instance Attribute Details
#accrue_charge ⇒ TrueClass | FalseClass
TODO: Write general description for this method
50 51 52 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 50 def accrue_charge @accrue_charge end |
#allocations ⇒ Array[AllocationPreviewItem]
TODO: Write general description for this method
54 55 56 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 54 def allocations @allocations end |
#direction ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 38 def direction @direction end |
#end_date ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 18 def end_date @end_date end |
#existing_balance_in_cents ⇒ Integer
An integer representing the amount of the subscription’s current balance
62 63 64 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 62 def existing_balance_in_cents @existing_balance_in_cents end |
#line_items ⇒ Array[AllocationPreviewLineItem]
TODO: Write general description for this method
46 47 48 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 46 def line_items @line_items end |
#period_type ⇒ String
TODO: Write general description for this method
58 59 60 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 58 def period_type @period_type end |
#proration_scheme ⇒ String
TODO: Write general description for this method
42 43 44 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 42 def proration_scheme @proration_scheme end |
#start_date ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 14 def start_date @start_date end |
#subtotal_in_cents ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 22 def subtotal_in_cents @subtotal_in_cents end |
#total_discount_in_cents ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 30 def total_discount_in_cents @total_discount_in_cents end |
#total_in_cents ⇒ Integer
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 34 def total_in_cents @total_in_cents end |
#total_tax_in_cents ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 26 def total_tax_in_cents @total_tax_in_cents end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
132 133 134 135 136 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 132 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. start_date = hash.key?('start_date') ? hash['start_date'] : SKIP end_date = hash.key?('end_date') ? hash['end_date'] : SKIP subtotal_in_cents = hash.key?('subtotal_in_cents') ? hash['subtotal_in_cents'] : SKIP total_tax_in_cents = hash.key?('total_tax_in_cents') ? hash['total_tax_in_cents'] : SKIP total_discount_in_cents = hash.key?('total_discount_in_cents') ? hash['total_discount_in_cents'] : SKIP total_in_cents = hash.key?('total_in_cents') ? hash['total_in_cents'] : SKIP direction = hash.key?('direction') ? hash['direction'] : SKIP proration_scheme = hash.key?('proration_scheme') ? hash['proration_scheme'] : SKIP # Parameter is an array, so we need to iterate through it line_items = nil unless hash['line_items'].nil? line_items = [] hash['line_items'].each do |structure| line_items << (AllocationPreviewLineItem.from_hash(structure) if structure) end end line_items = SKIP unless hash.key?('line_items') accrue_charge = hash.key?('accrue_charge') ? hash['accrue_charge'] : SKIP # Parameter is an array, so we need to iterate through it allocations = nil unless hash['allocations'].nil? allocations = [] hash['allocations'].each do |structure| allocations << (AllocationPreviewItem.from_hash(structure) if structure) end end allocations = SKIP unless hash.key?('allocations') period_type = hash.key?('period_type') ? hash['period_type'] : SKIP existing_balance_in_cents = hash.key?('existing_balance_in_cents') ? hash['existing_balance_in_cents'] : SKIP # Create object from extracted values. AllocationPreview.new(start_date, end_date, subtotal_in_cents, total_tax_in_cents, total_discount_in_cents, total_in_cents, direction, proration_scheme, line_items, accrue_charge, allocations, period_type, existing_balance_in_cents) end |
.names ⇒ Object
A mapping from model property names to API property names.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 65 def self.names @_hash = {} if @_hash.nil? @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash['subtotal_in_cents'] = 'subtotal_in_cents' @_hash['total_tax_in_cents'] = 'total_tax_in_cents' @_hash['total_discount_in_cents'] = 'total_discount_in_cents' @_hash['total_in_cents'] = 'total_in_cents' @_hash['direction'] = 'direction' @_hash['proration_scheme'] = 'proration_scheme' @_hash['line_items'] = 'line_items' @_hash['accrue_charge'] = 'accrue_charge' @_hash['allocations'] = 'allocations' @_hash['period_type'] = 'period_type' @_hash['existing_balance_in_cents'] = 'existing_balance_in_cents' @_hash end |
.nullables ⇒ Object
An array for nullable fields
103 104 105 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 103 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/advanced_billing/models/allocation_preview.rb', line 84 def self.optionals %w[ start_date end_date subtotal_in_cents total_tax_in_cents total_discount_in_cents total_in_cents direction proration_scheme line_items accrue_charge allocations period_type existing_balance_in_cents ] end |