def as_app(key = client_id, secret = client_secret, &block)
      if key.to_s.empty? || secret.to_s.empty?
        raise ApplicationCredentialsRequired, "client_id and client_secret required"
      end
      app_client = self.dup
      app_client.client_id = app_client.client_secret = nil
      app_client.login    = key
      app_client.password = secret

      yield app_client if block_given?
    end
def as_app(key = client_id, secret = client_secret, &block)
      if key.to_s.empty? || secret.to_s.empty?
        raise ApplicationCredentialsRequired, "client_id and client_secret required"
      end
      app_client = self.dup
      app_client.client_id = app_client.client_secret = nil
      app_client.login    = key
      app_client.password = secret

      yield app_client if block_given?
    end
Duplicate client using client_id and client_secret as
 Basic Authentication credentials.
 @example
   Octokit.client_id = "foo"
   Octokit.client_secret = "bar"

   # GET https://api.github.com/?client_id=foo&client_secret=bar
   Octokit.get "/"

   Octokit.client.as_app do |client|
     # GET https://foo:bar@api.github.com/
     client.get "/"
   end