Class: SolidObjects::MessageReference

Inherits:
Object
  • Object
show all
Defined in:
lib/solid_objects/message_reference.rb,
sig/generated/lib/solid_objects/message_reference.rbs

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, request_id:, actor_type:, actor_id:, sequence:) ⇒ MessageReference

Returns a new instance of MessageReference.

RBS:

  • (id: Integer, request_id: String, actor_type: String, actor_id: String, sequence: Integer) -> void

Parameters:

  • id: (Integer)
  • request_id: (String)
  • actor_type: (String)
  • actor_id: (String)
  • sequence: (Integer)


27
28
29
30
31
32
33
34
# File 'lib/solid_objects/message_reference.rb', line 27

def initialize(id:, request_id:, actor_type:, actor_id:, sequence:)
  @id = id
  @request_id = request_id
  @actor_type = actor_type
  @actor_id = actor_id
  @sequence = sequence
  freeze
end

Instance Attribute Details

#actor_idObject (readonly)

RBS:

  • @id: Integer

  • @request_id: String

  • @actor_type: String

  • @actor_id: String

  • @sequence: Integer

Returns:

  • (Object)


24
25
26
# File 'lib/solid_objects/message_reference.rb', line 24

def actor_id
  @actor_id
end

#actor_typeObject (readonly)

RBS:

  • @id: Integer

  • @request_id: String

  • @actor_type: String

  • @actor_id: String

  • @sequence: Integer

Returns:

  • (Object)


24
25
26
# File 'lib/solid_objects/message_reference.rb', line 24

def actor_type
  @actor_type
end

#idObject (readonly)

RBS:

  • @id: Integer

  • @request_id: String

  • @actor_type: String

  • @actor_id: String

  • @sequence: Integer

Returns:

  • (Object)


24
25
26
# File 'lib/solid_objects/message_reference.rb', line 24

def id
  @id
end

#request_idObject (readonly)

RBS:

  • @id: Integer

  • @request_id: String

  • @actor_type: String

  • @actor_id: String

  • @sequence: Integer

Returns:

  • (Object)


24
25
26
# File 'lib/solid_objects/message_reference.rb', line 24

def request_id
  @request_id
end

#sequenceObject (readonly)

RBS:

  • @id: Integer

  • @request_id: String

  • @actor_type: String

  • @actor_id: String

  • @sequence: Integer

Returns:

  • (Object)


24
25
26
# File 'lib/solid_objects/message_reference.rb', line 24

def sequence
  @sequence
end

Class Method Details

.from_message(message) ⇒ MessageReference

RBS:

  • (Message) -> MessageReference

Parameters:

Returns:



7
8
9
10
11
12
13
14
15
# File 'lib/solid_objects/message_reference.rb', line 7

def from_message(message)
  new(
    id: message.id,
    request_id: message.request_id,
    actor_type: message.actor_type,
    actor_id: message.actor_id,
    sequence: message.sequence
  )
end

Instance Method Details

#resultObject

RBS:

  • () -> untyped

Returns:

  • (Object)


49
50
51
# File 'lib/solid_objects/message_reference.rb', line 49

def result
  Message.find(id).result
end

#statusString

RBS:

  • () -> String

Returns:

  • (String)


37
38
39
40
41
42
43
44
45
46
# File 'lib/solid_objects/message_reference.rb', line 37

def status
  message = Message.find(id)
  return "rejected" if message.rejected?
  return "completed" if message.completed?
  return "dead" if message.dead?
  return "claimed" if message.claimed?
  return "ready" if message.ready?

  "unknown"
end

#wait(timeout: 5.seconds, authorization_context: nil) ⇒ Object

RBS:

  • (?timeout: Numeric, ?authorization_context: untyped) -> untyped

Parameters:

  • timeout: (Numeric) (defaults to: 5.seconds)
  • authorization_context: (Object) (defaults to: nil)

Returns:

  • (Object)


54
55
56
57
58
59
60
# File 'lib/solid_objects/message_reference.rb', line 54

def wait(timeout: 5.seconds, authorization_context: nil)
  SolidObjects.client.wait(
    self,
    timeout:,
    authorization_context:
  )
end