Class: Ask::GitHub::ClientProxy

Inherits:
BasicObject
Defined in:
lib/ask/github/client.rb

Overview

Proxies method calls to an Octokit::Client, converting authentication errors into Ask::Auth::InvalidCredential.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ClientProxy

Returns a new instance of ClientProxy.



45
46
47
# File 'lib/ask/github/client.rb', line 45

def initialize(client)
  @client = client
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



49
50
51
52
53
# File 'lib/ask/github/client.rb', line 49

def method_missing(name, ...)
  @client.public_send(name, ...)
rescue ::Octokit::Unauthorized
  ::Kernel.raise ::Ask::Auth::InvalidCredential, :github_token
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/ask/github/client.rb', line 55

def respond_to_missing?(name, include_private = false)
  @client.respond_to?(name, include_private) || super
end