Class: GoogleAuthClient
- Inherits:
-
Object
- Object
- GoogleAuthClient
- Defined in:
- lib/google_auth_client.rb
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(auth_token) ⇒ GoogleAuthClient
constructor
A new instance of GoogleAuthClient.
Constructor Details
#initialize(auth_token) ⇒ GoogleAuthClient
Returns a new instance of GoogleAuthClient.
3 4 5 |
# File 'lib/google_auth_client.rb', line 3 def initialize(auth_token) @auth_token = auth_token end |
Instance Method Details
#data ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/google_auth_client.rb', line 7 def data @user_info = HTTParty.get(url,:headers => header) if @user_info.body.present? body = JSON.parse(@user_info.body) if body["error"].present? error = body["error"]["errors"] {:code => body["error"]["code"] , :error => error} else {:code => 200, :data => body} end else {:code => 422 , :error => "Something went wrong"} end end |