Class: CcipDirectoryAndConfigurationRestApiV1::TokenChainInfo
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CcipDirectoryAndConfigurationRestApiV1::TokenChainInfo
- Defined in:
- lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb
Overview
TokenChainInfo Model.
Instance Attribute Summary collapse
-
#chain_id ⇒ Object
Identifier of the chain (numeric for EVM chains, string for Solana/Aptos chains).
-
#chain_name ⇒ String
Human-readable name of the chain.
-
#decimals ⇒ Integer
Number of decimals used for the token.
-
#pool_address ⇒ String
Token pool contract address (if applicable).
-
#pool_type ⇒ PoolType
Type of pool for this token.
-
#token_address ⇒ String
Token contract address on this chain.
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(chain_id:, chain_name:, token_address:, decimals:, pool_type:, pool_address:, additional_properties: nil) ⇒ TokenChainInfo
constructor
A new instance of TokenChainInfo.
-
#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 BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(chain_id:, chain_name:, token_address:, decimals:, pool_type:, pool_address:, additional_properties: nil) ⇒ TokenChainInfo
Returns a new instance of TokenChainInfo.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 59 def initialize(chain_id:, chain_name:, token_address:, decimals:, pool_type:, pool_address:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @chain_id = chain_id @chain_name = chain_name @token_address = token_address @decimals = decimals @pool_type = pool_type @pool_address = pool_address @additional_properties = additional_properties end |
Instance Attribute Details
#chain_id ⇒ Object
Identifier of the chain (numeric for EVM chains, string for Solana/Aptos chains)
15 16 17 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 15 def chain_id @chain_id end |
#chain_name ⇒ String
Human-readable name of the chain
19 20 21 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 19 def chain_name @chain_name end |
#decimals ⇒ Integer
Number of decimals used for the token
27 28 29 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 27 def decimals @decimals end |
#pool_address ⇒ String
Token pool contract address (if applicable)
35 36 37 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 35 def pool_address @pool_address end |
#pool_type ⇒ PoolType
Type of pool for this token
31 32 33 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 31 def pool_type @pool_type end |
#token_address ⇒ String
Token contract address on this chain
23 24 25 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 23 def token_address @token_address end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 74 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. chain_id = hash.key?('chainId') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:TokenChainInfoChainId), hash['chainId'] ) : nil chain_name = hash.key?('chainName') ? hash['chainName'] : nil token_address = hash.key?('tokenAddress') ? hash['tokenAddress'] : nil decimals = hash.key?('decimals') ? hash['decimals'] : nil pool_type = hash.key?('poolType') ? hash['poolType'] : nil pool_address = hash.key?('poolAddress') ? hash['poolAddress'] : nil # 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. TokenChainInfo.new(chain_id: chain_id, chain_name: chain_name, token_address: token_address, decimals: decimals, pool_type: pool_type, pool_address: pool_address, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['chain_id'] = 'chainId' @_hash['chain_name'] = 'chainName' @_hash['token_address'] = 'tokenAddress' @_hash['decimals'] = 'decimals' @_hash['pool_type'] = 'poolType' @_hash['pool_address'] = 'poolAddress' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 50 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 106 def self.validate(value) if value.instance_of? self return ( UnionTypeLookUp.get(:TokenChainInfoChainId) .validate(value.chain_id) and APIHelper.valid_type?(value.chain_name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.token_address, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.decimals, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.pool_type, ->(val) { PoolType.validate(val) }) and APIHelper.valid_type?(value.pool_address, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( UnionTypeLookUp.get(:TokenChainInfoChainId) .validate(value['chainId']) and APIHelper.valid_type?(value['chainName'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['tokenAddress'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['decimals'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['poolType'], ->(val) { PoolType.validate(val) }) and APIHelper.valid_type?(value['poolAddress'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
151 152 153 154 155 156 157 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 151 def inspect class_name = self.class.name.split('::').last "<#{class_name} chain_id: #{@chain_id.inspect}, chain_name: #{@chain_name.inspect},"\ " token_address: #{@token_address.inspect}, decimals: #{@decimals.inspect}, pool_type:"\ " #{@pool_type.inspect}, pool_address: #{@pool_address.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
143 144 145 146 147 148 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_info.rb', line 143 def to_s class_name = self.class.name.split('::').last "<#{class_name} chain_id: #{@chain_id}, chain_name: #{@chain_name}, token_address:"\ " #{@token_address}, decimals: #{@decimals}, pool_type: #{@pool_type}, pool_address:"\ " #{@pool_address}, additional_properties: #{@additional_properties}>" end |