Class: Weft::SearchEndpointHit

Inherits:
ApiModelBase show all
Defined in:
lib/weft/generated/models/search_endpoint_hit.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ SearchEndpointHit

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 127

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchEndpointHit` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchEndpointHit`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'endpoint_id')
    self.endpoint_id = attributes[:'endpoint_id']
  end

  if attributes.key?(:'url')
    self.url = attributes[:'url']
  end

  if attributes.key?(:'resource_type')
    self.resource_type = attributes[:'resource_type']
  end

  if attributes.key?(:'primary_protocol')
    self.primary_protocol = attributes[:'primary_protocol']
  end

  if attributes.key?(:'call')
    self.call = attributes[:'call']
  end

  if attributes.key?(:'price')
    self.price = attributes[:'price']
  end

  if attributes.key?(:'payment')
    if (value = attributes[:'payment']).is_a?(Array)
      self.payment = value
    end
  end

  if attributes.key?(:'operator_type')
    self.operator_type = attributes[:'operator_type']
  end

  if attributes.key?(:'operated_by_id')
    self.operated_by_id = attributes[:'operated_by_id']
  end

  if attributes.key?(:'settled_via_facilitator_id')
    self.settled_via_facilitator_id = attributes[:'settled_via_facilitator_id']
  end

  if attributes.key?(:'settlements')
    self.settlements = attributes[:'settlements']
  end

  if attributes.key?(:'last_verified_at')
    self.last_verified_at = attributes[:'last_verified_at']
  end

  if attributes.key?(:'latency_p50_ms')
    self.latency_p50_ms = attributes[:'latency_p50_ms']
  end
end

Instance Attribute Details

#callObject

Returns the value of attribute call.



26
27
28
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 26

def call
  @call
end

#endpoint_idObject

Returns the value of attribute endpoint_id.



18
19
20
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 18

def endpoint_id
  @endpoint_id
end

#last_verified_atObject

When Weft last CONFIRMED this endpoint answers — the most recent conclusive probe. Null when never probed, or when the latest probe errored: an endpoint we last failed to reach has no current verification.



44
45
46
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 44

def last_verified_at
  @last_verified_at
end

#latency_p50_msObject

Median time-to-first-byte in ms across the endpoint's probe call set. First-byte latency, not full-response time. Null when unmeasured (never 0).



47
48
49
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 47

def latency_p50_ms
  @latency_p50_ms
end

#operated_by_idObject

Returns the value of attribute operated_by_id.



36
37
38
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 36

def operated_by_id
  @operated_by_id
end

#operator_typeObject

Who you are actually paying. first_party = operated by the provider that makes the capability; reseller = resold, so the price carries someone else's margin. Null until the platform resolves the operator.



34
35
36
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 34

def operator_type
  @operator_type
end

#paymentObject

The settlement routes this endpoint's own 402 challenge published — one entry per rail × network × asset × payee it accepts. Sibling of call: that block says how to shape the request, this says how to pay for it, so a caller can settle with its OWN x402/mpp SDK instead of guessing. A list because rails are irreducibly plural. Order is the provider's own preference order. Honest-empty when the pipeline observed no challenge.



31
32
33
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 31

def payment
  @payment
end

#priceObject

Returns the value of attribute price.



28
29
30
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 28

def price
  @price
end

#primary_protocolObject

Returns the value of attribute primary_protocol.



24
25
26
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 24

def primary_protocol
  @primary_protocol
end

#resource_typeObject

Returns the value of attribute resource_type.



22
23
24
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 22

def resource_type
  @resource_type
end

#settled_via_facilitator_idObject

Returns the value of attribute settled_via_facilitator_id.



38
39
40
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 38

def settled_via_facilitator_id
  @settled_via_facilitator_id
end

#settlementsObject

Count of payments observed settling against this endpoint by ANYONE (chain-indexed), not just by Weft — the reliability signal a caller can act on. Null when unknown.



41
42
43
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 41

def settlements
  @settlements
end

#urlObject

Returns the value of attribute url.



20
21
22
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 20

def url
  @url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



91
92
93
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 91

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



96
97
98
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 96

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 72

def self.attribute_map
  {
    :'endpoint_id' => :'endpoint_id',
    :'url' => :'url',
    :'resource_type' => :'resource_type',
    :'primary_protocol' => :'primary_protocol',
    :'call' => :'call',
    :'price' => :'price',
    :'payment' => :'payment',
    :'operator_type' => :'operator_type',
    :'operated_by_id' => :'operated_by_id',
    :'settled_via_facilitator_id' => :'settled_via_facilitator_id',
    :'settlements' => :'settlements',
    :'last_verified_at' => :'last_verified_at',
    :'latency_p50_ms' => :'latency_p50_ms'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 258

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



120
121
122
123
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 120

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 101

def self.openapi_types
  {
    :'endpoint_id' => :'String',
    :'url' => :'String',
    :'resource_type' => :'String',
    :'primary_protocol' => :'String',
    :'call' => :'SearchEndpointCall',
    :'price' => :'SearchEndpointPrice',
    :'payment' => :'Array<SearchPaymentOffer>',
    :'operator_type' => :'String',
    :'operated_by_id' => :'String',
    :'settled_via_facilitator_id' => :'String',
    :'settlements' => :'Integer',
    :'last_verified_at' => :'Time',
    :'latency_p50_ms' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 225

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      endpoint_id == o.endpoint_id &&
      url == o.url &&
      resource_type == o.resource_type &&
      primary_protocol == o.primary_protocol &&
      call == o.call &&
      price == o.price &&
      payment == o.payment &&
      operator_type == o.operator_type &&
      operated_by_id == o.operated_by_id &&
      settled_via_facilitator_id == o.settled_via_facilitator_id &&
      settlements == o.settlements &&
      last_verified_at == o.last_verified_at &&
      latency_p50_ms == o.latency_p50_ms
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


245
246
247
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 245

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



251
252
253
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 251

def hash
  [endpoint_id, url, resource_type, primary_protocol, call, price, payment, operator_type, operated_by_id, settled_via_facilitator_id, settlements, last_verified_at, latency_p50_ms].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



198
199
200
201
202
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 198

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 280

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



206
207
208
209
210
211
# File 'lib/weft/generated/models/search_endpoint_hit.rb', line 206

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  operator_type_validator = EnumAttributeValidator.new('String', ["first_party", "reseller"])
  return false unless operator_type_validator.valid?(@operator_type)
  true
end