Class: Lh::Session

Inherits:
Object show all
Defined in:
lib/lh.rb

Class Method Summary collapse

Class Method Details

.establish(opts = {}) ⇒ Object



137
138
139
140
# File 'lib/lh.rb', line 137

def self.establish (opts = {})
  if opts.empty? then Lh::Session.establish_with_defaults
  else Lh::Session.establish_with_opts(opts) end
end

.establish_with_defaultsObject



148
149
150
# File 'lib/lh.rb', line 148

def self.establish_with_defaults
  Lh::Session.establish(Lh.load_opts)
end

.establish_with_opts(opts) ⇒ Object



142
143
144
145
146
# File 'lib/lh.rb', line 142

def self.establish_with_opts (opts)
  ::Lighthouse. = opts[:account]
  if opts[:token].present? then ::Lighthouse.token = opts[:token]
  else ::Lighthouse.authenticate(opts[:user], opts[:password]) end
end