Class: AdvancedBilling::AllocationPreviewLineItem
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::AllocationPreviewLineItem
- Defined in:
- lib/advanced_billing/models/allocation_preview_line_item.rb
Overview
AllocationPreviewLineItem Model.
Instance Attribute Summary collapse
-
#amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#component_handle ⇒ String
TODO: Write general description for this method.
-
#component_id ⇒ Integer
TODO: Write general description for this method.
-
#direction ⇒ String
TODO: Write general description for this method.
-
#discount_amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#kind ⇒ String
TODO: Write general description for this method.
-
#memo ⇒ String
TODO: Write general description for this method.
-
#taxable_amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#transaction_type ⇒ 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(transaction_type = SKIP, kind = SKIP, amount_in_cents = SKIP, memo = SKIP, discount_amount_in_cents = SKIP, taxable_amount_in_cents = SKIP, component_id = SKIP, component_handle = SKIP, direction = SKIP) ⇒ AllocationPreviewLineItem
constructor
A new instance of AllocationPreviewLineItem.
Methods inherited from BaseModel
Constructor Details
#initialize(transaction_type = SKIP, kind = SKIP, amount_in_cents = SKIP, memo = SKIP, discount_amount_in_cents = SKIP, taxable_amount_in_cents = SKIP, component_id = SKIP, component_handle = SKIP, direction = SKIP) ⇒ AllocationPreviewLineItem
Returns a new instance of AllocationPreviewLineItem.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 83 def initialize(transaction_type = SKIP, kind = SKIP, amount_in_cents = SKIP, memo = SKIP, discount_amount_in_cents = SKIP, taxable_amount_in_cents = SKIP, component_id = SKIP, component_handle = SKIP, direction = SKIP) @transaction_type = transaction_type unless transaction_type == SKIP @kind = kind unless kind == SKIP @amount_in_cents = amount_in_cents unless amount_in_cents == SKIP @memo = memo unless memo == SKIP @discount_amount_in_cents = discount_amount_in_cents unless discount_amount_in_cents == SKIP @taxable_amount_in_cents = taxable_amount_in_cents unless taxable_amount_in_cents == SKIP @component_id = component_id unless component_id == SKIP @component_handle = component_handle unless component_handle == SKIP @direction = direction unless direction == SKIP end |
Instance Attribute Details
#amount_in_cents ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 22 def amount_in_cents @amount_in_cents end |
#component_handle ⇒ String
TODO: Write general description for this method
42 43 44 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 42 def component_handle @component_handle end |
#component_id ⇒ Integer
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 38 def component_id @component_id end |
#direction ⇒ String
TODO: Write general description for this method
46 47 48 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 46 def direction @direction end |
#discount_amount_in_cents ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 30 def discount_amount_in_cents @discount_amount_in_cents end |
#kind ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 18 def kind @kind end |
#memo ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 26 def memo @memo end |
#taxable_amount_in_cents ⇒ Integer
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 34 def taxable_amount_in_cents @taxable_amount_in_cents end |
#transaction_type ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 14 def transaction_type @transaction_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 99 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. transaction_type = hash.key?('transaction_type') ? hash['transaction_type'] : SKIP kind = hash.key?('kind') ? hash['kind'] : SKIP amount_in_cents = hash.key?('amount_in_cents') ? hash['amount_in_cents'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP discount_amount_in_cents = hash.key?('discount_amount_in_cents') ? hash['discount_amount_in_cents'] : SKIP taxable_amount_in_cents = hash.key?('taxable_amount_in_cents') ? hash['taxable_amount_in_cents'] : SKIP component_id = hash.key?('component_id') ? hash['component_id'] : SKIP component_handle = hash.key?('component_handle') ? hash['component_handle'] : SKIP direction = hash.key?('direction') ? hash['direction'] : SKIP # Create object from extracted values. AllocationPreviewLineItem.new(transaction_type, kind, amount_in_cents, memo, discount_amount_in_cents, taxable_amount_in_cents, component_id, component_handle, direction) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['transaction_type'] = 'transaction_type' @_hash['kind'] = 'kind' @_hash['amount_in_cents'] = 'amount_in_cents' @_hash['memo'] = 'memo' @_hash['discount_amount_in_cents'] = 'discount_amount_in_cents' @_hash['taxable_amount_in_cents'] = 'taxable_amount_in_cents' @_hash['component_id'] = 'component_id' @_hash['component_handle'] = 'component_handle' @_hash['direction'] = 'direction' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 79 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/advanced_billing/models/allocation_preview_line_item.rb', line 64 def self.optionals %w[ transaction_type kind amount_in_cents memo discount_amount_in_cents taxable_amount_in_cents component_id component_handle direction ] end |