Class: Gub::Github
- Inherits:
-
Object
- Object
- Gub::Github
- Defined in:
- lib/gub/clients/github.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Github
constructor
A new instance of Github.
- #method_missing(meth, *args, &block) ⇒ Object
- #url ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(opts) ⇒ Github
Returns a new instance of Github.
8 9 10 |
# File 'lib/gub/clients/github.rb', line 8 def initialize opts @connection = Octokit::Client.new(opts) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/gub/clients/github.rb', line 20 def method_missing meth, *args, &block Gub.log.debug "Running command #{meth} with arguments #{args}" @connection.send(meth, *args, &block) rescue Octokit::Unauthorized, Octokit::NotFound raise Gub::Unauthorized rescue Faraday::Error::ConnectionFailed raise Gub::Disconnected end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
6 7 8 |
# File 'lib/gub/clients/github.rb', line 6 def connection @connection end |
Instance Method Details
#url ⇒ Object
12 13 14 |
# File 'lib/gub/clients/github.rb', line 12 def url 'https://github.com/' end |
#user ⇒ Object
16 17 18 |
# File 'lib/gub/clients/github.rb', line 16 def user @connection.user end |