def login(code = nil)
      @client = Google::APIClient.new
      @client.authorization.client_id     = c('client_id')
      @client.authorization.client_secret = c('client_secret')
      @client.authorization.scope         = @scope
      @client.authorization.redirect_uri  = c('redirect_uri')

      @api = @client.discovered_api(@name_api, @version_api)

      unless code
        return @client.authorization.authorization_uri.to_s
      end

      begin
        @client.authorization.code = code
        @client.authorization.fetch_access_token!
      rescue
        return false
      end

      return true
    end
def login(code = nil)
      @client = Google::APIClient.new
      @client.authorization.client_id     = c('client_id')
      @client.authorization.client_secret = c('client_secret')
      @client.authorization.scope         = @scope
      @client.authorization.redirect_uri  = c('redirect_uri')

      @api = @client.discovered_api(@name_api, @version_api)

      unless code
        return @client.authorization.authorization_uri.to_s
      end

      begin
        @client.authorization.code = code
        @client.authorization.fetch_access_token!
      rescue
        return false
      end

      return true
    end
Classic oauth 2 login

   login() -> return autorization url
   login(code) -> try login, return true false