Class: ADN::Recipes::BroadcastMessageBuilder
- Inherits:
-
Object
- Object
- ADN::Recipes::BroadcastMessageBuilder
- Defined in:
- lib/adn/recipes/broadcast_message_builder.rb
Instance Attribute Summary collapse
-
#attachment ⇒ Object
Returns the value of attribute attachment.
-
#channel_id ⇒ Object
Returns the value of attribute channel_id.
-
#headline ⇒ Object
Returns the value of attribute headline.
-
#parse_links ⇒ Object
Returns the value of attribute parse_links.
-
#parse_markdown_links ⇒ Object
Returns the value of attribute parse_markdown_links.
-
#photo ⇒ Object
Returns the value of attribute photo.
-
#read_more_link ⇒ Object
Returns the value of attribute read_more_link.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #annotations ⇒ Object
-
#initialize(params = {}) {|_self| ... } ⇒ BroadcastMessageBuilder
constructor
A new instance of BroadcastMessageBuilder.
- #message ⇒ Object
- #send ⇒ Object
Constructor Details
#initialize(params = {}) {|_self| ... } ⇒ BroadcastMessageBuilder
Returns a new instance of BroadcastMessageBuilder.
10 11 12 13 14 15 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 10 def initialize(params = {}) if params.respond_to? :each_pair params.each_pair { |k, v| send("#{k}=", v) if respond_to?("#{k}=") } end yield self if block_given? end |
Instance Attribute Details
#attachment ⇒ Object
Returns the value of attribute attachment.
6 7 8 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 6 def @attachment end |
#channel_id ⇒ Object
Returns the value of attribute channel_id.
6 7 8 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 6 def channel_id @channel_id end |
#headline ⇒ Object
Returns the value of attribute headline.
6 7 8 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 6 def headline @headline end |
#parse_links ⇒ Object
Returns the value of attribute parse_links.
6 7 8 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 6 def parse_links @parse_links end |
#parse_markdown_links ⇒ Object
Returns the value of attribute parse_markdown_links.
6 7 8 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 6 def parse_markdown_links @parse_markdown_links end |
#photo ⇒ Object
Returns the value of attribute photo.
6 7 8 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 6 def photo @photo end |
#read_more_link ⇒ Object
Returns the value of attribute read_more_link.
6 7 8 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 6 def read_more_link @read_more_link end |
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 6 def text @text end |
Instance Method Details
#annotations ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 17 def annotations annotations = [ { type: 'net.app.core.broadcast.message.metadata', value: { subject: self.headline } } ] if self.read_more_link annotations << { type: 'net.app.core.crosspost', value: { canonical_url: self.read_more_link } } end annotations end |
#message ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/adn/recipes/broadcast_message_builder.rb', line 39 def { annotations: self.annotations, text: self.text, machine_only: (not self.text), entities: { parse_links: (self.parse_links or self.parse_markdown_links), parse_markdown_links: !!self.parse_markdown_links } } end |