Module: Picasa::Authentication

Extended by:
Util
Defined in:
lib/picasa/authentication.rb

Overview

Module that offers methods to do the basic HTTP requests to authenticate an user with a google account.

Class Method Summary collapse

Methods included from Util

define_dependent_class_method, define_dependent_class_methods, define_static_dependent_class_method, extract_auth_token, raise_exception?

Class Method Details

.authenticate(user_id, password) ⇒ Object

Authenticate user and returns the authorization token if the operation succeeds other whise an exception is raised.



10
11
12
13
14
15
16
17
18
# File 'lib/picasa/authentication.rb', line 10

def self.authenticate user_id, password
  resp, body = Picasa::HTTP::Authentication.authenticate user_id, password
  
  if resp.code != '200' or resp.message != 'OK'
    raise Exception, "Could not authenticate user. Code: #{resp.code}. Message: #{resp.message}"
  end
  
  extract_auth_token body
end