Class: Speedflow::Plugin::Flowdock::Client
- Inherits:
-
Object
- Object
- Speedflow::Plugin::Flowdock::Client
- Defined in:
- lib/speedflow/plugin/flowdock/client.rb
Overview
Flowdock client
Instance Attribute Summary collapse
-
#config ⇒ Speedflow::Plugin::Configuration
readonly
Plugin configuration.
-
#flowdock_client ⇒ Object
Public: Flowdock client.
-
#prompt ⇒ Speedflow::Plugin::Prompt
readonly
Plugin prompt.
Instance Method Summary collapse
-
#initialize(config, prompt) ⇒ Client
constructor
Initialize.
-
#notify(flow_id, message, tags) ⇒ Object
Public: Notify.
-
#safe ⇒ Object
Public: Safe process Flowdock action.
Constructor Details
#initialize(config, prompt) ⇒ Client
28 29 30 31 |
# File 'lib/speedflow/plugin/flowdock/client.rb', line 28 def initialize(config, prompt) @config = config @prompt = prompt end |
Instance Attribute Details
#config ⇒ Speedflow::Plugin::Configuration (readonly)
Returns Plugin configuration.
9 10 11 |
# File 'lib/speedflow/plugin/flowdock/client.rb', line 9 def config @config end |
#flowdock_client ⇒ Object
Public: Flowdock client.
Returns <::Flowdock::Client> instance.
61 62 63 64 |
# File 'lib/speedflow/plugin/flowdock/client.rb', line 61 def flowdock_client config = { api_token: @config.by_config('token') } @flowdock_client ||= ::Flowdock::Client.new(config) end |
#prompt ⇒ Speedflow::Plugin::Prompt (readonly)
Returns Plugin prompt.
12 13 14 |
# File 'lib/speedflow/plugin/flowdock/client.rb', line 12 def prompt @prompt end |
Instance Method Details
#notify(flow_id, message, tags) ⇒ Object
Public: Notify.
flow_id - Flow ID. message - String of message. tags - Array of tags / Just add “Speedflow” tags 8-).
Returns nothing.
40 41 42 43 44 45 46 |
# File 'lib/speedflow/plugin/flowdock/client.rb', line 40 def notify(flow_id, , ) safe do = ['Speedflow'].concat() flowdock_client.( flow: flow_id, content: , tags: ) end end |
#safe ⇒ Object
Public: Safe process Flowdock action.
Returns nothing.
51 52 53 54 55 56 |
# File 'lib/speedflow/plugin/flowdock/client.rb', line 51 def safe yield rescue ::Flowdock::ApiError => exception prompt.errors 'Flowdock', exception abort end |