Class: Sendly::TenDlcCampaign
- Inherits:
-
Object
- Object
- Sendly::TenDlcCampaign
- Defined in:
- lib/sendly/tendlc_resource.rb
Overview
A messaging campaign registered for carrier review. The status starts
"pending" and moves to "active" (numbers can be assigned) or
"failed" (see failure_reasons); the carrier network may later mark
it "suspended" or "expired".
Instance Attribute Summary collapse
-
#brand_id ⇒ Object
readonly
Returns the value of attribute brand_id.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#failure_reasons ⇒ Object
readonly
Returns the value of attribute failure_reasons.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#sample_messages ⇒ Object
readonly
Returns the value of attribute sample_messages.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#sub_use_cases ⇒ Object
readonly
Returns the value of attribute sub_use_cases.
-
#throughput ⇒ Object
readonly
Returns the value of attribute throughput.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#use_case ⇒ Object
readonly
Returns the value of attribute use_case.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(data) ⇒ TenDlcCampaign
constructor
A new instance of TenDlcCampaign.
- #pending? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ TenDlcCampaign
Returns a new instance of TenDlcCampaign.
97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/sendly/tendlc_resource.rb', line 97 def initialize(data) @id = data["id"] @brand_id = data["brandId"] || data["brand_id"] @use_case = data["useCase"] || data["use_case"] @sub_use_cases = data["subUseCases"] || data["sub_use_cases"] || [] @description = data["description"] @status = data["status"] @sample_messages = data["sampleMessages"] || data["sample_messages"] || [] @throughput = data["throughput"] ? TenDlcThroughput.new(data["throughput"]) : nil @failure_reasons = data["failureReasons"] || data["failure_reasons"] @created_at = data["createdAt"] || data["created_at"] @updated_at = data["updatedAt"] || data["updated_at"] end |
Instance Attribute Details
#brand_id ⇒ Object (readonly)
Returns the value of attribute brand_id.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def brand_id @brand_id end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def created_at @created_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def description @description end |
#failure_reasons ⇒ Object (readonly)
Returns the value of attribute failure_reasons.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def failure_reasons @failure_reasons end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def id @id end |
#sample_messages ⇒ Object (readonly)
Returns the value of attribute sample_messages.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def @sample_messages end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def status @status end |
#sub_use_cases ⇒ Object (readonly)
Returns the value of attribute sub_use_cases.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def sub_use_cases @sub_use_cases end |
#throughput ⇒ Object (readonly)
Returns the value of attribute throughput.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def throughput @throughput end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def updated_at @updated_at end |
#use_case ⇒ Object (readonly)
Returns the value of attribute use_case.
93 94 95 |
# File 'lib/sendly/tendlc_resource.rb', line 93 def use_case @use_case end |
Instance Method Details
#active? ⇒ Boolean
115 116 117 |
# File 'lib/sendly/tendlc_resource.rb', line 115 def active? status == "active" end |
#failed? ⇒ Boolean
119 120 121 |
# File 'lib/sendly/tendlc_resource.rb', line 119 def failed? status == "failed" end |
#pending? ⇒ Boolean
111 112 113 |
# File 'lib/sendly/tendlc_resource.rb', line 111 def pending? status == "pending" end |
#to_h ⇒ Object
123 124 125 126 127 128 129 130 131 |
# File 'lib/sendly/tendlc_resource.rb', line 123 def to_h { id: id, brand_id: brand_id, use_case: use_case, sub_use_cases: sub_use_cases, description: description, status: status, sample_messages: , throughput: throughput&.to_h, failure_reasons: failure_reasons, created_at: created_at, updated_at: updated_at }.compact end |