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 code and retrieve an access token from Slack
Instance Attribute Summary collapse
-
#ambassador ⇒ Object
readonly
Returns the value of attribute ambassador.
-
#network ⇒ Object
readonly
Returns the value of attribute network.
Instance Method Summary collapse
-
#initialize(network, code) ⇒ Authority
constructor
A new instance of Authority.
- #process(bot_class) ⇒ Object
Constructor Details
#initialize(network, code) ⇒ Authority
Returns a new instance of Authority.
9 10 11 |
# File 'lib/bot_mob/authority.rb', line 9 def initialize(network, code) @ambassador = BotMob::Ambassador.setup(network, code) end |
Instance Attribute Details
#ambassador ⇒ Object (readonly)
Returns the value of attribute ambassador.
7 8 9 |
# File 'lib/bot_mob/authority.rb', line 7 def ambassador @ambassador end |
#network ⇒ Object (readonly)
Returns the value of attribute network.
7 8 9 |
# File 'lib/bot_mob/authority.rb', line 7 def network @network end |
Instance Method Details
#process(bot_class) ⇒ Object
13 14 15 16 17 |
# File 'lib/bot_mob/authority.rb', line 13 def process(bot_class) return unless ambassador.success? wire.publish(ambassador.auth.merge(bot_class: bot_class.to_s)) end |