Class: BotMob::Authority
- Inherits:
-
Object
- Object
- BotMob::Authority
- Defined in:
- lib/bot_mob/authority.rb
Overview
## BotMob::Authority
The Authority class will process an access args and retrieve an access token from the specified network
Example Invocation:
BotMob::Authority.new(:slack, code: params)
Instance Attribute Summary collapse
-
#network ⇒ Object
readonly
Returns the value of attribute network.
Instance Method Summary collapse
-
#initialize(network, args = {}) ⇒ Authority
constructor
A new instance of Authority.
- #process(bot_class) ⇒ Object
Constructor Details
#initialize(network, args = {}) ⇒ Authority
Returns a new instance of Authority.
14 15 16 17 |
# File 'lib/bot_mob/authority.rb', line 14 def initialize(network, args = {}) @network = network @args = args end |
Instance Attribute Details
#network ⇒ Object (readonly)
Returns the value of attribute network.
12 13 14 |
# File 'lib/bot_mob/authority.rb', line 12 def network @network end |
Instance Method Details
#process(bot_class) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bot_mob/authority.rb', line 19 def process(bot_class) return unless ambassador.success? # wire.publish(network: :slack, external_id: 'foo', bot_class: 'MockBot', data: { token: ENV['IOBOT_TOKEN'] } ) wire.publish({ network: network, external_id: ambassador.external_id, bot_class: bot_class.to_s, data: ambassador.data || {} }) end |