class Grubber::Config
Attributes
credentials[RW]
lat[RW]
lng[RW]
store[RW]
Public Class Methods
load()
click to toggle source
# File lib/grubber/config.rb, line 19 def self.load new end
new(opts={})
click to toggle source
# File lib/grubber/config.rb, line 8 def initialize(opts={}) @store = Grubber::Store.load[:grubber] location = store[:location] @lat = location[:lat] @lng = location[:lng] @credentials = store[:credentials] self end
update_auth(ckey, csec, tkey, tsec)
click to toggle source
# File lib/grubber/config.rb, line 43 def self.update_auth(ckey, csec, tkey, tsec) [ckey, csec, tkey, tsec].each do |k| return nil if k.nil? || k == '' end Grubber::Store.update({ credentials: { consumer_key: ckey, consumer_secret: csec, token_key: tkey, token_secret: tsec } }) end
update_location()
click to toggle source
# File lib/grubber/config.rb, line 58 def self.update_location lat, lng = *Lost.current_position Grubber::Store.update({ location: { lat: lat, lng: lng } }) return [lat, lng] end
Public Instance Methods
coordinates()
click to toggle source
# File lib/grubber/config.rb, line 23 def coordinates [lat, lng] end
has_auth?()
click to toggle source
# File lib/grubber/config.rb, line 27 def has_auth? !self.credentials.nil? end