Class: SpreeCmCommissioner::TelegramMessageFactory
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::TelegramMessageFactory
show all
- Defined in:
- app/factory/spree_cm_commissioner/telegram_message_factory.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TelegramMessageFactory.
5
6
7
8
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 5
def initialize(title:, subtitle: nil)
@title = title
@subtitle = subtitle
end
|
Instance Attribute Details
#subtitle ⇒ Object
Returns the value of attribute subtitle.
3
4
5
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 3
def subtitle
@subtitle
end
|
#title ⇒ Object
Returns the value of attribute title.
3
4
5
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 3
def title
@title
end
|
Instance Method Details
#body ⇒ Object
25
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 25
def body; end
|
#bold(text) ⇒ Object
28
29
30
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 28
def bold(text)
"<b>#{text}</b>"
end
|
26
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 26
def ; end
|
21
22
23
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 21
def
"<b>#{title}</b>"
end
|
#inline_code(text) ⇒ Object
36
37
38
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 36
def inline_code(text)
"<code>#{text}</code>"
end
|
#italic(text) ⇒ Object
32
33
34
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 32
def italic(text)
"<i>#{text}</i>"
end
|
#message ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 10
def message
text = []
text << .presence
text << subtitle.presence if subtitle.present?
text << body.presence
text << .presence
text.compact.join("\n\n")
end
|
#parse_mode ⇒ Object
40
41
42
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 40
def parse_mode
'HTML'
end
|
#pretty_date(date) ⇒ Object
44
45
46
47
48
|
# File 'app/factory/spree_cm_commissioner/telegram_message_factory.rb', line 44
def pretty_date(date)
return '' if date.blank?
date.to_date.strftime('%b %d, %Y')
end
|