Class: CcipDirectoryAndConfigurationRestApiV1::TokenMetadata

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

Overview

TokenMetadata Model.

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(environment:, timestamp:, request_id:, ignored_token_count:, valid_token_count:, additional_properties: nil) ⇒ TokenMetadata

Returns a new instance of TokenMetadata.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 54

def initialize(environment:, timestamp:, request_id:, ignored_token_count:,
               valid_token_count:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @environment = environment
  @timestamp = timestamp
  @request_id = request_id
  @ignored_token_count = ignored_token_count
  @valid_token_count = valid_token_count
  @additional_properties = additional_properties
end

Instance Attribute Details

#environmentEnvironment

The network environment

Returns:



15
16
17
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 15

def environment
  @environment
end

#ignored_token_countInteger

Number of tokens ignored due to configuration issues

Returns:

  • (Integer)


27
28
29
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 27

def ignored_token_count
  @ignored_token_count
end

#request_idUUID | String

Unique identifier for the request

Returns:

  • (UUID | String)


23
24
25
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 23

def request_id
  @request_id
end

#timestampDateTime

ISO timestamp of the response

Returns:

  • (DateTime)


19
20
21
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 19

def timestamp
  @timestamp
end

#valid_token_countInteger

Number of valid tokens in the response

Returns:

  • (Integer)


31
32
33
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 31

def valid_token_count
  @valid_token_count
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
93
94
95
96
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  environment = hash.key?('environment') ? hash['environment'] : nil
  timestamp = if hash.key?('timestamp')
                (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
              end
  request_id = hash.key?('requestId') ? hash['requestId'] : nil
  ignored_token_count =
    hash.key?('ignoredTokenCount') ? hash['ignoredTokenCount'] : nil
  valid_token_count =
    hash.key?('validTokenCount') ? hash['validTokenCount'] : 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.
  TokenMetadata.new(environment: environment,
                    timestamp: timestamp,
                    request_id: request_id,
                    ignored_token_count: ignored_token_count,
                    valid_token_count: valid_token_count,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['environment'] = 'environment'
  @_hash['timestamp'] = 'timestamp'
  @_hash['request_id'] = 'requestId'
  @_hash['ignored_token_count'] = 'ignoredTokenCount'
  @_hash['valid_token_count'] = 'validTokenCount'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 45

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
115
116
117
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 111

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} environment: #{@environment.inspect}, timestamp: #{@timestamp.inspect},"\
  " request_id: #{@request_id.inspect}, ignored_token_count: #{@ignored_token_count.inspect},"\
  " valid_token_count: #{@valid_token_count.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_timestampObject



98
99
100
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 98

def to_custom_timestamp
  DateTimeHelper.to_rfc3339(timestamp)
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
108
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_metadata.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} environment: #{@environment}, timestamp: #{@timestamp}, request_id:"\
  " #{@request_id}, ignored_token_count: #{@ignored_token_count}, valid_token_count:"\
  " #{@valid_token_count}, additional_properties: #{@additional_properties}>"
end