Class: GoogleAuthClient

Inherits:
Object
  • Object
show all
Defined in:
lib/google_auth_client.rb

Instance Method Summary collapse

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

#dataObject



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