Class: Txbr::Campaign
- Inherits:
-
Object
- Object
- Txbr::Campaign
- Defined in:
- lib/txbr/campaign.rb
Constant Summary collapse
- ITEM_TYPE =
'campaign'.freeze
- TEMPLATE_KEYS =
%w(body subject preheader message alert).freeze
Instance Attribute Summary collapse
-
#campaign_id ⇒ Object
readonly
Returns the value of attribute campaign_id.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #each_resource(&block) ⇒ Object
-
#initialize(project, campaign_data) ⇒ Campaign
constructor
A new instance of Campaign.
- #metadata ⇒ Object
- #prerender_variables ⇒ Object
Constructor Details
#initialize(project, campaign_data) ⇒ Campaign
10 11 12 13 14 |
# File 'lib/txbr/campaign.rb', line 10 def initialize(project, campaign_data) @project = project @campaign_data = campaign_data @campaign_id = campaign_data['id'] end |
Instance Attribute Details
#campaign_id ⇒ Object (readonly)
Returns the value of attribute campaign_id.
8 9 10 |
# File 'lib/txbr/campaign.rb', line 8 def campaign_id @campaign_id end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
8 9 10 |
# File 'lib/txbr/campaign.rb', line 8 def project @project end |
Instance Method Details
#each_resource(&block) ⇒ Object
16 17 18 19 |
# File 'lib/txbr/campaign.rb', line 16 def each_resource(&block) return to_enum(__method__) unless block_given? template_group.each_resource(&block) end |
#metadata ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/txbr/campaign.rb', line 21 def ||= { item_type: ITEM_TYPE, campaign_name: campaign_name, campaign_id: campaign_id, last_edited: last_edited } rescue => e {} end |
#prerender_variables ⇒ Object
32 33 34 35 36 |
# File 'lib/txbr/campaign.rb', line 32 def prerender_variables @prerender_variables ||= { 'campaign.${api_id}' => campaign_id } end |