Class: RSMP::Delivery

Inherits:
Data
  • Object
show all
Defined in:
lib/rsmp/delivery.rb

Overview

The disposition of a successfully submitted outbound message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, state:) ⇒ Delivery

Returns a new instance of Delivery.

Raises:

  • (ArgumentError)


4
5
6
7
8
# File 'lib/rsmp/delivery.rb', line 4

def initialize(message:, state:)
  raise ArgumentError, 'delivery state must be :sent or :buffered' unless i[sent buffered].include?(state)

  super
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



3
4
5
# File 'lib/rsmp/delivery.rb', line 3

def message
  @message
end

#stateObject (readonly)

Returns the value of attribute state

Returns:

  • (Object)

    the current value of state



3
4
5
# File 'lib/rsmp/delivery.rb', line 3

def state
  @state
end

Instance Method Details

#buffered?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/rsmp/delivery.rb', line 14

def buffered?
  state == :buffered
end

#sent?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rsmp/delivery.rb', line 10

def sent?
  state == :sent
end