Class: Clearbit::Slack::Notifier
- Inherits:
-
Object
- Object
- Clearbit::Slack::Notifier
- Defined in:
- lib/clearbit/slack/notifier.rb
Instance Attribute Summary collapse
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#family_name ⇒ Object
readonly
Returns the value of attribute family_name.
-
#given_name ⇒ Object
readonly
Returns the value of attribute given_name.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#slack_channel ⇒ Object
readonly
Returns the value of attribute slack_channel.
-
#slack_icon ⇒ Object
readonly
Returns the value of attribute slack_icon.
-
#slack_url ⇒ Object
readonly
Returns the value of attribute slack_url.
Instance Method Summary collapse
- #attachments ⇒ Object
-
#initialize(attrs = {}, options = {}) ⇒ Notifier
constructor
A new instance of Notifier.
- #notifier ⇒ Object
- #ping ⇒ Object
Constructor Details
#initialize(attrs = {}, options = {}) ⇒ Notifier
Returns a new instance of Notifier.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/clearbit/slack/notifier.rb', line 8 def initialize(attrs = {}, = {}) = Slack.configuration.merge() @company = attrs[:company] @message = attrs[:message] @person = attrs[:person] @given_name = attrs[:given_name] @family_name = attrs[:family_name] @email = attrs[:email] @slack_url = [:slack_url] @slack_channel = [:slack_channel] @slack_icon = [:slack_icon] end |
Instance Attribute Details
#company ⇒ Object (readonly)
Returns the value of attribute company.
4 5 6 |
# File 'lib/clearbit/slack/notifier.rb', line 4 def company @company end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
4 5 6 |
# File 'lib/clearbit/slack/notifier.rb', line 4 def email @email end |
#family_name ⇒ Object (readonly)
Returns the value of attribute family_name.
4 5 6 |
# File 'lib/clearbit/slack/notifier.rb', line 4 def family_name @family_name end |
#given_name ⇒ Object (readonly)
Returns the value of attribute given_name.
4 5 6 |
# File 'lib/clearbit/slack/notifier.rb', line 4 def given_name @given_name end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/clearbit/slack/notifier.rb', line 4 def @message end |
#slack_channel ⇒ Object (readonly)
Returns the value of attribute slack_channel.
4 5 6 |
# File 'lib/clearbit/slack/notifier.rb', line 4 def slack_channel @slack_channel end |
#slack_icon ⇒ Object (readonly)
Returns the value of attribute slack_icon.
4 5 6 |
# File 'lib/clearbit/slack/notifier.rb', line 4 def slack_icon @slack_icon end |
#slack_url ⇒ Object (readonly)
Returns the value of attribute slack_url.
4 5 6 |
# File 'lib/clearbit/slack/notifier.rb', line 4 def slack_url @slack_url end |
Instance Method Details
#attachments ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/clearbit/slack/notifier.rb', line 34 def result = [] result << Attachments::Person.new(person).as_json if company result << Attachments::Company.new(company).as_json end result end |
#notifier ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/clearbit/slack/notifier.rb', line 26 def notifier ::Slack::Notifier.new( slack_url, channel: slack_channel, icon_url: slack_icon, ) end |
#ping ⇒ Object
22 23 24 |
# File 'lib/clearbit/slack/notifier.rb', line 22 def ping notifier.ping(.to_s, attachments: ) end |