Class: BotMob::Install

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/bot_mob/install.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_with_auth(auth) ⇒ Object



9
10
11
12
13
14
# File 'lib/bot_mob/install.rb', line 9

def self.create_with_auth(auth)
  registered_bot(auth).first_or_initialize.tap do |i|
    i.token = auth['token']
    i.save!
  end
end

.registered_bot(auth) ⇒ Object



5
6
7
# File 'lib/bot_mob/install.rb', line 5

def self.registered_bot(auth)
  where(bot_class: auth['bot_class'], external_id: auth['external_id'])
end

Instance Method Details

#authObject



16
17
18
# File 'lib/bot_mob/install.rb', line 16

def auth
  { external_id: external_id, token: token }
end