Class: AdvancedBilling::ServiceCredit1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ServiceCredit1
- Defined in:
- lib/advanced_billing/models/service_credit1.rb
Overview
ServiceCredit1 Model.
Instance Attribute Summary collapse
-
#amount_in_cents ⇒ Integer
The amount in cents of the entry.
-
#created_at ⇒ DateTime
The date and time the entry was created.
-
#ending_balance_in_cents ⇒ Integer
The new balance for the credit account.
-
#entry_type ⇒ ServiceCreditType
The type of entry.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#invoice_uid ⇒ String
The invoice uid associated with the entry.
-
#memo ⇒ String
The memo attached to the entry.
-
#remaining_balance_in_cents ⇒ Integer
The remaining balance for the entry.
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(id: SKIP, amount_in_cents: SKIP, ending_balance_in_cents: SKIP, entry_type: SKIP, memo: SKIP, invoice_uid: SKIP, remaining_balance_in_cents: SKIP, created_at: SKIP, additional_properties: {}) ⇒ ServiceCredit1
constructor
A new instance of ServiceCredit1.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_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, amount_in_cents: SKIP, ending_balance_in_cents: SKIP, entry_type: SKIP, memo: SKIP, invoice_uid: SKIP, remaining_balance_in_cents: SKIP, created_at: SKIP, additional_properties: {}) ⇒ ServiceCredit1
Returns a new instance of ServiceCredit1.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 80 def initialize(id: SKIP, amount_in_cents: SKIP, ending_balance_in_cents: SKIP, entry_type: SKIP, memo: SKIP, invoice_uid: SKIP, remaining_balance_in_cents: SKIP, created_at: 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 @amount_in_cents = amount_in_cents unless amount_in_cents == SKIP @ending_balance_in_cents = ending_balance_in_cents unless ending_balance_in_cents == SKIP @entry_type = entry_type unless entry_type == SKIP @memo = memo unless memo == SKIP @invoice_uid = invoice_uid unless invoice_uid == SKIP unless remaining_balance_in_cents == SKIP @remaining_balance_in_cents = remaining_balance_in_cents end @created_at = created_at unless created_at == SKIP end |
Instance Attribute Details
#amount_in_cents ⇒ Integer
The amount in cents of the entry
19 20 21 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 19 def amount_in_cents @amount_in_cents end |
#created_at ⇒ DateTime
The date and time the entry was created
43 44 45 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 43 def created_at @created_at end |
#ending_balance_in_cents ⇒ Integer
The new balance for the credit account
23 24 25 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 23 def ending_balance_in_cents @ending_balance_in_cents end |
#entry_type ⇒ ServiceCreditType
The type of entry
27 28 29 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 27 def entry_type @entry_type end |
#id ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 15 def id @id end |
#invoice_uid ⇒ String
The invoice uid associated with the entry. Only present for debit entries
35 36 37 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 35 def invoice_uid @invoice_uid end |
#memo ⇒ String
The memo attached to the entry
31 32 33 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 31 def memo @memo end |
#remaining_balance_in_cents ⇒ Integer
The remaining balance for the entry
39 40 41 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 39 def remaining_balance_in_cents @remaining_balance_in_cents end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 129 130 131 132 133 134 135 136 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 103 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP amount_in_cents = hash.key?('amount_in_cents') ? hash['amount_in_cents'] : SKIP ending_balance_in_cents = hash.key?('ending_balance_in_cents') ? hash['ending_balance_in_cents'] : SKIP entry_type = hash.key?('entry_type') ? hash['entry_type'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP invoice_uid = hash.key?('invoice_uid') ? hash['invoice_uid'] : SKIP remaining_balance_in_cents = hash.key?('remaining_balance_in_cents') ? hash['remaining_balance_in_cents'] : SKIP created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. ServiceCredit1.new(id: id, amount_in_cents: amount_in_cents, ending_balance_in_cents: ending_balance_in_cents, entry_type: entry_type, memo: memo, invoice_uid: invoice_uid, remaining_balance_in_cents: remaining_balance_in_cents, created_at: created_at, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['amount_in_cents'] = 'amount_in_cents' @_hash['ending_balance_in_cents'] = 'ending_balance_in_cents' @_hash['entry_type'] = 'entry_type' @_hash['memo'] = 'memo' @_hash['invoice_uid'] = 'invoice_uid' @_hash['remaining_balance_in_cents'] = 'remaining_balance_in_cents' @_hash['created_at'] = 'created_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 77 78 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 74 def self.nullables %w[ invoice_uid ] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 60 def self.optionals %w[ id amount_in_cents ending_balance_in_cents entry_type memo invoice_uid remaining_balance_in_cents created_at ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
152 153 154 155 156 157 158 159 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 152 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, amount_in_cents: #{@amount_in_cents.inspect},"\ " ending_balance_in_cents: #{@ending_balance_in_cents.inspect}, entry_type:"\ " #{@entry_type.inspect}, memo: #{@memo.inspect}, invoice_uid: #{@invoice_uid.inspect},"\ " remaining_balance_in_cents: #{@remaining_balance_in_cents.inspect}, created_at:"\ " #{@created_at.inspect}, additional_properties: #{get_additional_properties}>" end |
#to_custom_created_at ⇒ Object
138 139 140 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 138 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
143 144 145 146 147 148 149 |
# File 'lib/advanced_billing/models/service_credit1.rb', line 143 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, amount_in_cents: #{@amount_in_cents}, ending_balance_in_cents:"\ " #{@ending_balance_in_cents}, entry_type: #{@entry_type}, memo: #{@memo}, invoice_uid:"\ " #{@invoice_uid}, remaining_balance_in_cents: #{@remaining_balance_in_cents}, created_at:"\ " #{@created_at}, additional_properties: #{get_additional_properties}>" end |