Class: SplititWebApiV4::InstallmentItem
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SplititWebApiV4::InstallmentItem
- Defined in:
- lib/splitit_web_api_v4/models/installment_item.rb
Overview
InstallmentItem Model.
Instance Attribute Summary collapse
-
#amount ⇒ AmountData
TODO: Write general description for this method.
-
#installment_number ⇒ Integer
TODO: Write general description for this method.
-
#process_date_time ⇒ DateTime
TODO: Write general description for this method.
-
#status ⇒ InstallmentStatus
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(installment_number:, status:, amount: SKIP, process_date_time: SKIP, additional_properties: nil) ⇒ InstallmentItem
constructor
A new instance of InstallmentItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_process_date_time ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(installment_number:, status:, amount: SKIP, process_date_time: SKIP, additional_properties: nil) ⇒ InstallmentItem
Returns a new instance of InstallmentItem.
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 52 def initialize(installment_number:, status:, amount: SKIP, process_date_time: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @installment_number = installment_number @amount = amount unless amount == SKIP @status = status @process_date_time = process_date_time unless process_date_time == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ AmountData
TODO: Write general description for this method
19 20 21 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 19 def amount @amount end |
#installment_number ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 15 def installment_number @installment_number end |
#process_date_time ⇒ DateTime
TODO: Write general description for this method
27 28 29 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 27 def process_date_time @process_date_time end |
#status ⇒ InstallmentStatus
TODO: Write general description for this method
23 24 25 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 23 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. installment_number = hash.key?('InstallmentNumber') ? hash['InstallmentNumber'] : nil status = hash.key?('Status') ? hash['Status'] : nil amount = AmountData.from_hash(hash['Amount']) if hash['Amount'] process_date_time = if hash.key?('ProcessDateTime') (DateTimeHelper.from_rfc3339(hash['ProcessDateTime']) if hash['ProcessDateTime']) else SKIP end # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. InstallmentItem.new(installment_number: installment_number, status: status, amount: amount, process_date_time: process_date_time, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['installment_number'] = 'InstallmentNumber' @_hash['amount'] = 'Amount' @_hash['status'] = 'Status' @_hash['process_date_time'] = 'ProcessDateTime' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 48 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 40 def self.optionals %w[ amount process_date_time ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
107 108 109 110 111 112 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 107 def inspect class_name = self.class.name.split('::').last "<#{class_name} installment_number: #{@installment_number.inspect}, amount:"\ " #{@amount.inspect}, status: #{@status.inspect}, process_date_time:"\ " #{@process_date_time.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_process_date_time ⇒ Object
94 95 96 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 94 def to_custom_process_date_time DateTimeHelper.to_rfc3339(process_date_time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
99 100 101 102 103 104 |
# File 'lib/splitit_web_api_v4/models/installment_item.rb', line 99 def to_s class_name = self.class.name.split('::').last "<#{class_name} installment_number: #{@installment_number}, amount: #{@amount}, status:"\ " #{@status}, process_date_time: #{@process_date_time}, additional_properties:"\ " #{@additional_properties}>" end |