Class: Hook0::Generated::RequestAttemptEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/hook0/generated/models.rb

Overview

The RequestAttemptEvent the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_id:, event_type_name:) ⇒ RequestAttemptEvent

Returns a new instance of RequestAttemptEvent.

Parameters:

  • event_id (String)

    carries event_id.

  • event_type_name (String)

    carries event_type_name.



2378
2379
2380
2381
2382
# File 'lib/hook0/generated/models.rb', line 2378

def initialize(event_id:, event_type_name:)
  @event_id = event_id
  @event_type_name = event_type_name
  freeze
end

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



2373
2374
2375
# File 'lib/hook0/generated/models.rb', line 2373

def event_id
  @event_id
end

#event_type_nameObject (readonly)

Returns the value of attribute event_type_name.



2373
2374
2375
# File 'lib/hook0/generated/models.rb', line 2373

def event_type_name
  @event_type_name
end

Class Method Details

.from_json(value) ⇒ RequestAttemptEvent

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



2388
2389
2390
2391
2392
2393
2394
# File 'lib/hook0/generated/models.rb', line 2388

def self.from_json(value)
  fields = Runtime.as_fields(value, "RequestAttemptEvent")
  new(
    event_id: Runtime.read(fields, "event_id", Runtime::UUID),
    event_type_name: Runtime.read(fields, "event_type_name", Runtime::TEXT)
  )
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Whether that value carries the same members as this one.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


2410
2411
2412
# File 'lib/hook0/generated/models.rb', line 2410

def ==(other)
  other.is_a?(RequestAttemptEvent) && to_h == other.to_h
end

#hashInteger

A value two equal instances share, so that either may key a hash.

Returns:

  • (Integer)


2418
2419
2420
# File 'lib/hook0/generated/models.rb', line 2418

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


2399
2400
2401
2402
2403
2404
# File 'lib/hook0/generated/models.rb', line 2399

def to_h
  out = {}
  out["event_id"] = @event_id
  out["event_type_name"] = @event_type_name
  out
end