Class: Hook0::Generated::RequestAttemptStatus

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

Overview

The RequestAttemptStatus the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, at: nil, full_processing_ms: nil, since: nil, until_: nil) ⇒ RequestAttemptStatus

Returns a new instance of RequestAttemptStatus.

Parameters:

  • type (String)

    carries type, one of RequestAttemptStatusType::VALUES: Status type discriminator. One of: waiting, pending, in_progress, successful, failed

  • at (Time, nil) (defaults to: nil)

    carries at: Timestamp when completed (present in successful, failed)

  • full_processing_ms (Integer, nil) (defaults to: nil)

    carries full_processing_ms: Total processing time in milliseconds (present in successful, failed)

  • since (Time, nil) (defaults to: nil)

    carries since: Timestamp when the status started (present in waiting, pending, in_progress)

  • until_ (Time, nil) (defaults to: nil)

    carries until: Timestamp until which waiting (only present in waiting status)



2439
2440
2441
2442
2443
2444
2445
2446
# File 'lib/hook0/generated/models.rb', line 2439

def initialize(type:, at: nil, full_processing_ms: nil, since: nil, until_: nil)
  @type = type
  @at = at
  @full_processing_ms = full_processing_ms
  @since = since
  @until_ = until_
  freeze
end

Instance Attribute Details

#atObject (readonly)

Returns the value of attribute at.



2425
2426
2427
# File 'lib/hook0/generated/models.rb', line 2425

def at
  @at
end

#full_processing_msObject (readonly)

Returns the value of attribute full_processing_ms.



2425
2426
2427
# File 'lib/hook0/generated/models.rb', line 2425

def full_processing_ms
  @full_processing_ms
end

#sinceObject (readonly)

Returns the value of attribute since.



2425
2426
2427
# File 'lib/hook0/generated/models.rb', line 2425

def since
  @since
end

#typeObject (readonly)

Returns the value of attribute type.



2425
2426
2427
# File 'lib/hook0/generated/models.rb', line 2425

def type
  @type
end

#until_Object (readonly)

Returns the value of attribute until_.



2425
2426
2427
# File 'lib/hook0/generated/models.rb', line 2425

def until_
  @until_
end

Class Method Details

.from_json(value) ⇒ RequestAttemptStatus

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
# File 'lib/hook0/generated/models.rb', line 2452

def self.from_json(value)
  fields = Runtime.as_fields(value, "RequestAttemptStatus")
  new(
    type: Runtime.read(fields, "type", Runtime.member_of(RequestAttemptStatusType)),
    at: Runtime.maybe(fields, "at", Runtime::DATE_TIME),
    full_processing_ms: Runtime.maybe(fields, "full_processing_ms", Runtime::INTEGER),
    since: Runtime.maybe(fields, "since", Runtime::DATE_TIME),
    until_: Runtime.maybe(fields, "until", Runtime::DATE_TIME)
  )
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)


2480
2481
2482
# File 'lib/hook0/generated/models.rb', line 2480

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

#hashInteger

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

Returns:

  • (Integer)


2488
2489
2490
# File 'lib/hook0/generated/models.rb', line 2488

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


2466
2467
2468
2469
2470
2471
2472
2473
2474
# File 'lib/hook0/generated/models.rb', line 2466

def to_h
  out = {}
  out["type"] = @type
  out["at"] = Runtime.moment(@at) unless @at.nil?
  out["full_processing_ms"] = @full_processing_ms unless @full_processing_ms.nil?
  out["since"] = Runtime.moment(@since) unless @since.nil?
  out["until"] = Runtime.moment(@until_) unless @until_.nil?
  out
end