Class: Whoa::Authentication
- Inherits:
-
Object
- Object
- Whoa::Authentication
- Defined in:
- lib/whoa/authentication.rb
Defined Under Namespace
Classes: AuthError
Constant Summary collapse
- Url =
'https://www.google.com/accounts/ClientLogin'
Instance Method Summary collapse
Instance Method Details
#auth_token ⇒ Object
24 25 26 |
# File 'lib/whoa/authentication.rb', line 24 def auth_token send_request.body.match(/^Auth=(.*)$/)[1] end |
#parameters ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/whoa/authentication.rb', line 7 def parameters { 'Email' => Whoa.email, 'Passwd' => Whoa.password, 'accountType' => 'GOOGLE', 'service' => 'analytics', 'source' => 'whoa-001' } end |
#send_request ⇒ Object
17 18 19 20 21 22 |
# File 'lib/whoa/authentication.rb', line 17 def send_request RestClient.post(Url, parameters) do |response| raise AuthError unless response.code == 200 response.return! end end |