Class: Mitake::Message
- Inherits:
-
Object
- Object
- Mitake::Message
- Defined in:
- lib/mitake/message.rb
Overview
Create Sort Message
Instance Attribute Summary collapse
-
#body ⇒ String
The message body.
-
#duplicate ⇒ TrueClass|FalseClass
readonly
Is the message duplicate.
-
#expired_at ⇒ Time|NilClass
The valid time for this message.
-
#id ⇒ String
readonly
The message id.
-
#receipient ⇒ Mitake::Recipient
The message recipient.
-
#schedule_at ⇒ Time|NilClass
The schedule time to send message.
-
#source_id ⇒ String
The customize identity.
-
#status_code ⇒ Integer
readonly
The status code.
-
#webhook_url ⇒ String|NilClass
The response callback url.
Instance Method Summary collapse
-
#delivery ⇒ Object
private
Send message.
-
#duplicate? ⇒ TrueClass|FalseClass
Does message is duplicate.
-
#sent? ⇒ TrueClass|FalseClass
Does message is sent.
-
#status ⇒ String
Readable status code.
Methods included from Model
Methods included from API
Instance Attribute Details
#body ⇒ String
Returns the message body.
37 |
# File 'lib/mitake/message.rb', line 37 attribute :body, String |
#duplicate ⇒ TrueClass|FalseClass (readonly)
Returns is the message duplicate.
53 |
# File 'lib/mitake/message.rb', line 53 attribute :duplicate, Boolean, readonly: true |
#expired_at ⇒ Time|NilClass
Returns the valid time for this message.
45 |
# File 'lib/mitake/message.rb', line 45 attribute :expired_at, Time |
#id ⇒ String (readonly)
Returns the message id.
25 |
# File 'lib/mitake/message.rb', line 25 attribute :id, String, readonly: true |
#receipient ⇒ Mitake::Recipient
Returns the message recipient.
33 |
# File 'lib/mitake/message.rb', line 33 attribute :recipient, Recipient |
#schedule_at ⇒ Time|NilClass
Returns the schedule time to send message.
41 |
# File 'lib/mitake/message.rb', line 41 attribute :schedule_at, Time |
#source_id ⇒ String
Returns the customize identity.
29 |
# File 'lib/mitake/message.rb', line 29 attribute :source_id, String |
#status_code ⇒ Integer (readonly)
Returns the status code.
57 |
# File 'lib/mitake/message.rb', line 57 attribute :status_code, Integer, readonly: true |
#webhook_url ⇒ String|NilClass
Returns the response callback url.
49 |
# File 'lib/mitake/message.rb', line 49 attribute :webhook_url, String |
Instance Method Details
#delivery ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Send message
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/mitake/message.rb', line 63 def delivery return self if sent? self.class.execute(params) do |items| attrs = items&.first&.slice(*self.class.attribute_names) assign_attributes(attrs) end self end |
#duplicate? ⇒ TrueClass|FalseClass
Does message is duplicate
88 89 90 |
# File 'lib/mitake/message.rb', line 88 def duplicate? @duplicate == true end |
#sent? ⇒ TrueClass|FalseClass
Does message is sent
79 80 81 |
# File 'lib/mitake/message.rb', line 79 def sent? !@id.nil? end |
#status ⇒ String
Readable status code
97 98 99 |
# File 'lib/mitake/message.rb', line 97 def status Status::CODES[@status_code] end |