Class: Reaper::Client
- Inherits:
-
Object
- Object
- Reaper::Client
- Includes:
- Singleton
- Defined in:
- lib/reaper/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#repo ⇒ Object
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #method_missing(meth, *args, &block) ⇒ Object
- #set_repo(repo) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 |
# File 'lib/reaper/client.rb', line 10 def initialize # Look for .netrc credentials first; if they don't exist then prompt # for login. # TODO @client = Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN']) @repo = nil # TODO: Add things other than Github. end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
24 25 26 27 28 |
# File 'lib/reaper/client.rb', line 24 def method_missing(meth, *args, &block) raise "Must provide a Github repository." unless @repo @client.send(meth, *([@repo] + args), &block) end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
8 9 10 |
# File 'lib/reaper/client.rb', line 8 def client @client end |
#repo ⇒ Object
Returns the value of attribute repo.
8 9 10 |
# File 'lib/reaper/client.rb', line 8 def repo @repo end |
Instance Method Details
#set_repo(repo) ⇒ Object
20 21 22 |
# File 'lib/reaper/client.rb', line 20 def set_repo(repo) @repo = repo end |