Class: Sendly::RcsAgent
- Inherits:
-
Object
- Object
- Sendly::RcsAgent
- Defined in:
- lib/sendly/rcs_resource.rb
Overview
An RCS agent registered for your workspace — the branded identity your
RCS messages come from. status moves "draft" → "submitted" →
"testing" (can send, but only to invited test devices) → "approved"
(can send to everyone); "suspended" agents cannot send. sendable is
true when the agent is fully provisioned and its status allows sending.
Constant Summary collapse
- STATUSES =
%w[draft submitted testing approved suspended].freeze
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sendable ⇒ Object
readonly
Returns the value of attribute sendable.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#use_case ⇒ Object
readonly
Returns the value of attribute use_case.
Instance Method Summary collapse
- #approved? ⇒ Boolean
-
#initialize(data) ⇒ RcsAgent
constructor
A new instance of RcsAgent.
- #sendable? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ RcsAgent
Returns a new instance of RcsAgent.
14 15 16 17 18 19 20 21 |
# File 'lib/sendly/rcs_resource.rb', line 14 def initialize(data) @id = data["id"] @name = data["name"] @status = data["status"] @use_case = data["useCase"] || data["use_case"] @sendable = data["sendable"] || false @created_at = data["createdAt"] || data["created_at"] end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/sendly/rcs_resource.rb', line 10 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/sendly/rcs_resource.rb', line 10 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/sendly/rcs_resource.rb', line 10 def name @name end |
#sendable ⇒ Object (readonly)
Returns the value of attribute sendable.
10 11 12 |
# File 'lib/sendly/rcs_resource.rb', line 10 def sendable @sendable end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/sendly/rcs_resource.rb', line 10 def status @status end |
#use_case ⇒ Object (readonly)
Returns the value of attribute use_case.
10 11 12 |
# File 'lib/sendly/rcs_resource.rb', line 10 def use_case @use_case end |
Instance Method Details
#approved? ⇒ Boolean
27 28 29 |
# File 'lib/sendly/rcs_resource.rb', line 27 def approved? status == "approved" end |
#sendable? ⇒ Boolean
23 24 25 |
# File 'lib/sendly/rcs_resource.rb', line 23 def sendable? sendable end |
#to_h ⇒ Object
31 32 33 34 35 36 |
# File 'lib/sendly/rcs_resource.rb', line 31 def to_h { id: id, name: name, status: status, use_case: use_case, sendable: sendable, created_at: created_at }.compact end |