Class: ModernTreasury::DocumentDetail
- Defined in:
- lib/modern_treasury/models/document_detail.rb
Overview
DocumentDetail Model.
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#discarded_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#document_identifier ⇒ String
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#document_identifier_type ⇒ String
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#id ⇒ UUID | String
TODO: Write general description for this method.
-
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#object ⇒ String
TODO: Write general description for this method.
-
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
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:, object:, live_mode:, created_at:, updated_at:, discarded_at:, document_identifier_type:, document_identifier:) ⇒ DocumentDetail
constructor
A new instance of DocumentDetail.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #to_custom_discarded_at ⇒ Object
- #to_custom_updated_at ⇒ 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(id:, object:, live_mode:, created_at:, updated_at:, discarded_at:, document_identifier_type:, document_identifier:) ⇒ DocumentDetail
Returns a new instance of DocumentDetail.
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/modern_treasury/models/document_detail.rb', line 77 def initialize(id:, object:, live_mode:, created_at:, updated_at:, discarded_at:, document_identifier_type:, document_identifier:) @id = id @object = object @live_mode = live_mode @created_at = created_at @updated_at = updated_at @discarded_at = discarded_at @document_identifier_type = document_identifier_type @document_identifier = document_identifier end |
Instance Attribute Details
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
29 30 31 |
# File 'lib/modern_treasury/models/document_detail.rb', line 29 def created_at @created_at end |
#discarded_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
39 40 41 |
# File 'lib/modern_treasury/models/document_detail.rb', line 39 def discarded_at @discarded_at end |
#document_identifier ⇒ String
This field will be true if this object exists in the live environment or false if it exists in the test environment.
49 50 51 |
# File 'lib/modern_treasury/models/document_detail.rb', line 49 def document_identifier @document_identifier end |
#document_identifier_type ⇒ String
This field will be true if this object exists in the live environment or false if it exists in the test environment.
44 45 46 |
# File 'lib/modern_treasury/models/document_detail.rb', line 44 def document_identifier_type @document_identifier_type end |
#id ⇒ UUID | String
TODO: Write general description for this method
15 16 17 |
# File 'lib/modern_treasury/models/document_detail.rb', line 15 def id @id end |
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
24 25 26 |
# File 'lib/modern_treasury/models/document_detail.rb', line 24 def live_mode @live_mode end |
#object ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/modern_treasury/models/document_detail.rb', line 19 def object @object end |
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
34 35 36 |
# File 'lib/modern_treasury/models/document_detail.rb', line 34 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/modern_treasury/models/document_detail.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil object = hash.key?('object') ? hash['object'] : nil live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) end discarded_at = if hash.key?('discarded_at') (DateTimeHelper.from_rfc3339(hash['discarded_at']) if hash['discarded_at']) end document_identifier_type = hash.key?('document_identifier_type') ? hash['document_identifier_type'] : nil document_identifier = hash.key?('document_identifier') ? hash['document_identifier'] : nil # Create object from extracted values. DocumentDetail.new(id: id, object: object, live_mode: live_mode, created_at: created_at, updated_at: updated_at, discarded_at: discarded_at, document_identifier_type: document_identifier_type, document_identifier: document_identifier) end |
.names ⇒ Object
A mapping from model property names to API property names.
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/modern_treasury/models/document_detail.rb', line 52 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['object'] = 'object' @_hash['live_mode'] = 'live_mode' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['discarded_at'] = 'discarded_at' @_hash['document_identifier_type'] = 'document_identifier_type' @_hash['document_identifier'] = 'document_identifier' @_hash end |
.nullables ⇒ Object
An array for nullable fields
71 72 73 74 75 |
# File 'lib/modern_treasury/models/document_detail.rb', line 71 def self.nullables %w[ discarded_at ] end |
.optionals ⇒ Object
An array for optional fields
66 67 68 |
# File 'lib/modern_treasury/models/document_detail.rb', line 66 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
145 146 147 148 149 150 151 152 |
# File 'lib/modern_treasury/models/document_detail.rb', line 145 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\ " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, updated_at:"\ " #{@updated_at.inspect}, discarded_at: #{@discarded_at.inspect}, document_identifier_type:"\ " #{@document_identifier_type.inspect}, document_identifier:"\ " #{@document_identifier.inspect}>" end |
#to_custom_created_at ⇒ Object
123 124 125 |
# File 'lib/modern_treasury/models/document_detail.rb', line 123 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_discarded_at ⇒ Object
131 132 133 |
# File 'lib/modern_treasury/models/document_detail.rb', line 131 def to_custom_discarded_at DateTimeHelper.to_rfc3339(discarded_at) end |
#to_custom_updated_at ⇒ Object
127 128 129 |
# File 'lib/modern_treasury/models/document_detail.rb', line 127 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
136 137 138 139 140 141 142 |
# File 'lib/modern_treasury/models/document_detail.rb', line 136 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\ " #{@created_at}, updated_at: #{@updated_at}, discarded_at: #{@discarded_at},"\ " document_identifier_type: #{@document_identifier_type}, document_identifier:"\ " #{@document_identifier}>" end |