lib/amee/session.rb in hookercookerman-amee-0.0.5 vs lib/amee/session.rb in hookercookerman-amee-0.0.6

- old
+ new

@@ -5,11 +5,11 @@ class UnAuthorized < StandardError; end class NotAuthenticated < StandardError; end class PermissionDenied < StandardError; end class NotFound < StandardError; end class UnknownError < StandardError; end - attr_accessor :auth_token, :cache + attr_accessor :auth_token, :cache, :service def self.create(username = nil, password = nil) username ||= Amee::Config[:username] password ||= Amee::Config[:password] raise ArgumentError unless !username.nil? && !password.nil? @@ -38,9 +38,10 @@ def authenticate! @auth_token = nil unless @auth_token = Amee::Service.auth_token(@username, @password, Amee::Config[:auth_path]) raise Amee::Session::UnAuthorized.new "Please provide your correct username and password. " end + service.auth_token = @auth_token end def authenticated? !@auth_token.nil? end \ No newline at end of file