Class: FdxV660Api::InsuranceTransactionEntity
- Inherits:
-
Transaction
- Object
- CoreLibrary::BaseModel
- BaseModel
- Transaction
- FdxV660Api::InsuranceTransactionEntity
- Defined in:
- lib/fdx_v660_api/models/insurance_transaction_entity.rb
Overview
An insurance transaction type
Instance Attribute Summary collapse
-
#transaction_type ⇒ InsuranceTransactionType
The type of an insurance transaction.
Attributes inherited from Transaction
#account_category, #account_id, #amount, #card_number_display, #category, #category_code, #category_type, #debit_credit_memo, #description, #fi_attributes, #foreign_amount, #foreign_currency, #image_ids, #line_item, #links, #memo, #posted_timestamp, #reference, #reference_transaction_id, #remittance, #reward, #rewards, #status, #sub_category, #transaction_id, #transaction_payee, #transaction_timestamp
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(transaction_type: SKIP, account_id: SKIP, transaction_id: SKIP, posted_timestamp: SKIP, transaction_timestamp: SKIP, description: SKIP, transaction_payee: SKIP, debit_credit_memo: SKIP, status: SKIP, amount: SKIP, reward: SKIP, rewards: SKIP, fi_attributes: SKIP, links: SKIP, account_category: 'Insurance Transaction entity', reference_transaction_id: SKIP, card_number_display: SKIP, memo: SKIP, category: SKIP, sub_category: SKIP, category_code: SKIP, category_type: SKIP, reference: SKIP, remittance: SKIP, foreign_amount: SKIP, foreign_currency: SKIP, image_ids: SKIP, line_item: SKIP, additional_properties: nil) ⇒ InsuranceTransactionEntity
constructor
A new instance of InsuranceTransactionEntity.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from Transaction
discriminators, #to_custom_posted_timestamp, #to_custom_transaction_timestamp
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(transaction_type: SKIP, account_id: SKIP, transaction_id: SKIP, posted_timestamp: SKIP, transaction_timestamp: SKIP, description: SKIP, transaction_payee: SKIP, debit_credit_memo: SKIP, status: SKIP, amount: SKIP, reward: SKIP, rewards: SKIP, fi_attributes: SKIP, links: SKIP, account_category: 'Insurance Transaction entity', reference_transaction_id: SKIP, card_number_display: SKIP, memo: SKIP, category: SKIP, sub_category: SKIP, category_code: SKIP, category_type: SKIP, reference: SKIP, remittance: SKIP, foreign_amount: SKIP, foreign_currency: SKIP, image_ids: SKIP, line_item: SKIP, additional_properties: nil) ⇒ InsuranceTransactionEntity
Returns a new instance of InsuranceTransactionEntity.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.rb', line 38 def initialize(transaction_type: SKIP, account_id: SKIP, transaction_id: SKIP, posted_timestamp: SKIP, transaction_timestamp: SKIP, description: SKIP, transaction_payee: SKIP, debit_credit_memo: SKIP, status: SKIP, amount: SKIP, reward: SKIP, rewards: SKIP, fi_attributes: SKIP, links: SKIP, account_category: 'Insurance Transaction entity', reference_transaction_id: SKIP, card_number_display: SKIP, memo: SKIP, category: SKIP, sub_category: SKIP, category_code: SKIP, category_type: SKIP, reference: SKIP, remittance: SKIP, foreign_amount: SKIP, foreign_currency: SKIP, image_ids: SKIP, line_item: SKIP, additional_properties: nil) @transaction_type = transaction_type unless transaction_type == SKIP @additional_properties = additional_properties # Call the constructor of the base class super(account_id: account_id, transaction_id: transaction_id, posted_timestamp: , transaction_timestamp: , description: description, transaction_payee: transaction_payee, debit_credit_memo: debit_credit_memo, status: status, amount: amount, reward: reward, rewards: rewards, fi_attributes: fi_attributes, links: links, account_category: account_category, reference_transaction_id: reference_transaction_id, card_number_display: card_number_display, memo: memo, category: category, sub_category: sub_category, category_code: category_code, category_type: category_type, reference: reference, remittance: remittance, foreign_amount: foreign_amount, foreign_currency: foreign_currency, image_ids: image_ids, line_item: line_item, additional_properties: additional_properties) end |
Instance Attribute Details
#transaction_type ⇒ InsuranceTransactionType
The type of an insurance transaction
14 15 16 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.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.
86 87 88 89 90 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 122 123 124 125 126 127 128 129 130 131 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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. transaction_type = hash.key?('transactionType') ? hash['transactionType'] : SKIP account_id = hash.key?('accountId') ? hash['accountId'] : SKIP transaction_id = hash.key?('transactionId') ? hash['transactionId'] : SKIP = if hash.key?('postedTimestamp') (DateTimeHelper.from_rfc3339(hash['postedTimestamp']) if hash['postedTimestamp']) else SKIP end = if hash.key?('transactionTimestamp') (DateTimeHelper.from_rfc3339(hash['transactionTimestamp']) if hash['transactionTimestamp']) else SKIP end description = hash.key?('description') ? hash['description'] : SKIP transaction_payee = TransactionPayeeEntity3.from_hash(hash['transactionPayee']) if hash['transactionPayee'] debit_credit_memo = hash.key?('debitCreditMemo') ? hash['debitCreditMemo'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP reward = TransactionRewardEntity.from_hash(hash['reward']) if hash['reward'] # Parameter is an array, so we need to iterate through it rewards = nil unless hash['rewards'].nil? rewards = [] hash['rewards'].each do |structure| rewards << (TransactionRewardEntity.from_hash(structure) if structure) end end rewards = SKIP unless hash.key?('rewards') # Parameter is an array, so we need to iterate through it fi_attributes = nil unless hash['fiAttributes'].nil? fi_attributes = [] hash['fiAttributes'].each do |structure| fi_attributes << (FiAttributeEntity.from_hash(structure) if structure) end end fi_attributes = SKIP unless hash.key?('fiAttributes') # Parameter is an array, so we need to iterate through it links = nil unless hash['links'].nil? links = [] hash['links'].each do |structure| links << (HateoasLink.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') account_category = hash['accountCategory'] ||= 'Insurance Transaction entity' reference_transaction_id = hash.key?('referenceTransactionId') ? hash['referenceTransactionId'] : SKIP card_number_display = hash.key?('cardNumberDisplay') ? hash['cardNumberDisplay'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP category = hash.key?('category') ? hash['category'] : SKIP sub_category = hash.key?('subCategory') ? hash['subCategory'] : SKIP category_code = hash.key?('categoryCode') ? hash['categoryCode'] : SKIP category_type = hash.key?('categoryType') ? hash['categoryType'] : SKIP reference = hash.key?('reference') ? hash['reference'] : SKIP remittance = Remittance2.from_hash(hash['remittance']) if hash['remittance'] foreign_amount = hash.key?('foreignAmount') ? hash['foreignAmount'] : SKIP foreign_currency = hash.key?('foreignCurrency') ? hash['foreignCurrency'] : SKIP image_ids = hash.key?('imageIds') ? hash['imageIds'] : SKIP # Parameter is an array, so we need to iterate through it line_item = nil unless hash['lineItem'].nil? line_item = [] hash['lineItem'].each do |structure| line_item << (LineItemEntity.from_hash(structure) if structure) end end line_item = SKIP unless hash.key?('lineItem') # 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. InsuranceTransactionEntity.new(transaction_type: transaction_type, account_id: account_id, transaction_id: transaction_id, posted_timestamp: , transaction_timestamp: , description: description, transaction_payee: transaction_payee, debit_credit_memo: debit_credit_memo, status: status, amount: amount, reward: reward, rewards: rewards, fi_attributes: fi_attributes, links: links, account_category: account_category, reference_transaction_id: reference_transaction_id, card_number_display: card_number_display, memo: memo, category: category, sub_category: sub_category, category_code: category_code, category_type: category_type, reference: reference, remittance: remittance, foreign_amount: foreign_amount, foreign_currency: foreign_currency, image_ids: image_ids, line_item: line_item, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
17 18 19 20 21 22 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.rb', line 17 def self.names @_hash = {} if @_hash.nil? @_hash['transaction_type'] = 'transactionType' @_hash = super().merge(@_hash) @_hash end |
.nullables ⇒ Object
An array for nullable fields
33 34 35 36 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.rb', line 33 def self.nullables _arr = [] (_arr << super()).flatten! end |
.optionals ⇒ Object
An array for optional fields
25 26 27 28 29 30 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.rb', line 25 def self.optionals _arr = %w[ transaction_type ] (_arr << super()).flatten! end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
211 212 213 214 215 216 217 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.rb', line 211 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
227 228 229 230 231 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.rb', line 227 def inspect class_name = self.class.name.split('::').last super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '') "<#{class_name} #{super_string}, transaction_type: #{@transaction_type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
220 221 222 223 224 |
# File 'lib/fdx_v660_api/models/insurance_transaction_entity.rb', line 220 def to_s class_name = self.class.name.split('::').last super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '') "<#{class_name} #{super_string}, transaction_type: #{@transaction_type}>" end |