Class: Poke::API::Auth::GOOGLE

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/poke-api/auth/google.rb

Constant Summary collapse

GOOGLE_LOGIN_ANDROID_ID =
'9774d56d682e549c'
GOOGLE_LOGIN_SERVICE =
'audience:server:client_id:848232511240-7so421jotr' \
'2609rmqakceuu1luuq0ptb.apps.googleusercontent.com'
GOOGLE_LOGIN_APP =
'com.nianticlabs.pokemongo'
GOOGLE_LOGIN_CLIENT_SIG =
'321187995bc7cdc2b5fc91b11a96e2baa8602c62'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

formatter=, log_level=, #logger

Constructor Details

#initialize(username, password) ⇒ GOOGLE

Returns a new instance of GOOGLE.



16
17
18
19
20
# File 'lib/poke-api/auth/google.rb', line 16

def initialize(username, password)
  @username = username
  @password = password
  @provider = 'google'
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



8
9
10
# File 'lib/poke-api/auth/google.rb', line 8

def access_token
  @access_token
end

#providerObject (readonly)

Returns the value of attribute provider.



8
9
10
# File 'lib/poke-api/auth/google.rb', line 8

def provider
  @provider
end

Instance Method Details

#connectObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/poke-api/auth/google.rb', line 22

def connect
  logger.debug '[>] Fetching Google access token'

  token_request = perform_request('Token') do
    Gpsoauth::Auth.performMasterLogin(@username, @password, )
  end

  auth_request = perform_request('Auth') do
    Gpsoauth::Auth.performOAuth(@username, token_request['Token'], ,
                                , , )
  end

  @access_token = auth_request['Auth']
end