Class: BotMob::Authority

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(network, code) ⇒ 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

#ambassadorObject

Returns the value of attribute ambassador.



7
8
9
# File 'lib/bot_mob/authority.rb', line 7

def ambassador
  @ambassador
end

#networkObject

Returns the value of attribute network.



7
8
9
# File 'lib/bot_mob/authority.rb', line 7

def network
  @network
end

Instance Method Details

#processObject



13
14
15
16
17
18
19
# File 'lib/bot_mob/authority.rb', line 13

def process
  return unless ambassador.success?

  install = Install.create_with_ambassador(ambassador)
  # check for install's success
  wire.publish(external_id: install.external_id)
end