Class: CcipDirectoryAndConfigurationRestApiV1::Data

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb

Overview

Chain details grouped by chain family

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(evm: SKIP, solana: SKIP, aptos: SKIP, sui: SKIP, tron: SKIP, canton: SKIP, ton: SKIP, stellar: SKIP, starknet: SKIP, additional_properties: nil) ⇒ Data

Returns a new instance of Data.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 83

def initialize(evm: SKIP, solana: SKIP, aptos: SKIP, sui: SKIP, tron: SKIP,
               canton: SKIP, ton: SKIP, stellar: SKIP, starknet: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @evm = evm unless evm == SKIP
  @solana = solana unless solana == SKIP
  @aptos = aptos unless aptos == SKIP
  @sui = sui unless sui == SKIP
  @tron = tron unless tron == SKIP
  @canton = canton unless canton == SKIP
  @ton = ton unless ton == SKIP
  @stellar = stellar unless stellar == SKIP
  @starknet = starknet unless starknet == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#aptosHash[String, ChainDetails]

Aptos chain details keyed by the specified output key

Returns:



22
23
24
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 22

def aptos
  @aptos
end

#cantonHash[String, ChainDetails]

Canton chain details keyed by the specified output key

Returns:



34
35
36
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 34

def canton
  @canton
end

#evmHash[String, ChainDetails]

EVM chain details keyed by the specified output key

Returns:



14
15
16
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 14

def evm
  @evm
end

#solanaHash[String, ChainDetails]

Solana chain details keyed by the specified output key

Returns:



18
19
20
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 18

def solana
  @solana
end

#starknetHash[String, ChainDetails]

Starknet chain details keyed by the specified output key

Returns:



46
47
48
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 46

def starknet
  @starknet
end

#stellarHash[String, ChainDetails]

Stellar chain details keyed by the specified output key

Returns:



42
43
44
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 42

def stellar
  @stellar
end

#suiHash[String, ChainDetails]

Sui chain details keyed by the specified output key

Returns:



26
27
28
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 26

def sui
  @sui
end

#tonHash[String, ChainDetails]

TON chain details keyed by the specified output key

Returns:



38
39
40
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 38

def ton
  @ton
end

#tronHash[String, ChainDetails]

Tron chain details keyed by the specified output key

Returns:



30
31
32
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 30

def tron
  @tron
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  evm = ChainDetails.from_hash(hash['evm']) if hash['evm']

  evm = SKIP unless hash.key?('evm')
  solana = ChainDetails.from_hash(hash['solana']) if hash['solana']

  solana = SKIP unless hash.key?('solana')
  aptos = ChainDetails.from_hash(hash['aptos']) if hash['aptos']

  aptos = SKIP unless hash.key?('aptos')
  sui = ChainDetails.from_hash(hash['sui']) if hash['sui']

  sui = SKIP unless hash.key?('sui')
  tron = ChainDetails.from_hash(hash['tron']) if hash['tron']

  tron = SKIP unless hash.key?('tron')
  canton = ChainDetails.from_hash(hash['canton']) if hash['canton']

  canton = SKIP unless hash.key?('canton')
  ton = ChainDetails.from_hash(hash['ton']) if hash['ton']

  ton = SKIP unless hash.key?('ton')
  stellar = ChainDetails.from_hash(hash['stellar']) if hash['stellar']

  stellar = SKIP unless hash.key?('stellar')
  starknet = ChainDetails.from_hash(hash['starknet']) if hash['starknet']

  starknet = SKIP unless hash.key?('starknet')

  # 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.
  Data.new(evm: evm,
           solana: solana,
           aptos: aptos,
           sui: sui,
           tron: tron,
           canton: canton,
           ton: ton,
           stellar: stellar,
           starknet: starknet,
           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['evm'] = 'evm'
  @_hash['solana'] = 'solana'
  @_hash['aptos'] = 'aptos'
  @_hash['sui'] = 'sui'
  @_hash['tron'] = 'tron'
  @_hash['canton'] = 'canton'
  @_hash['ton'] = 'ton'
  @_hash['stellar'] = 'stellar'
  @_hash['starknet'] = 'starknet'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 64

def self.optionals
  %w[
    evm
    solana
    aptos
    sui
    tron
    canton
    ton
    stellar
    starknet
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



163
164
165
166
167
168
169
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 163

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} evm: #{@evm.inspect}, solana: #{@solana.inspect}, aptos: #{@aptos.inspect},"\
  " sui: #{@sui.inspect}, tron: #{@tron.inspect}, canton: #{@canton.inspect}, ton:"\
  " #{@ton.inspect}, stellar: #{@stellar.inspect}, starknet: #{@starknet.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



155
156
157
158
159
160
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/data.rb', line 155

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} evm: #{@evm}, solana: #{@solana}, aptos: #{@aptos}, sui: #{@sui}, tron:"\
  " #{@tron}, canton: #{@canton}, ton: #{@ton}, stellar: #{@stellar}, starknet: #{@starknet},"\
  " additional_properties: #{@additional_properties}>"
end