Class: Chatbox::Draft
- Inherits:
-
Object
- Object
- Chatbox::Draft
- Includes:
- FakeMissingKeywords
- Defined in:
- lib/chatbox/draft.rb
Instance Method Summary collapse
- #deliver! ⇒ Object
-
#initialize(from: req(:from), to: req(:to), body: req(:body), store: req(:store), id_generator: -> { SecureRandom.uuid }) ⇒ Draft
constructor
A new instance of Draft.
Methods included from FakeMissingKeywords
Constructor Details
#initialize(from: req(:from), to: req(:to), body: req(:body), store: req(:store), id_generator: -> { SecureRandom.uuid }) ⇒ Draft
Returns a new instance of Draft.
8 9 10 11 12 13 14 |
# File 'lib/chatbox/draft.rb', line 8 def initialize(from: req(:from), to: req(:to), body: req(:body), store: req(:store), id_generator: -> { SecureRandom.uuid }) @from = from @to = to @body = body @store = store @id_generator = id_generator end |
Instance Method Details
#deliver! ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/chatbox/draft.rb', line 16 def deliver! store.( 'id' => id_generator.(), 'from_id' => from.chatbox_id, 'to_id' => to.chatbox_id, 'body' => body, ) end |