Class: Gub::Github

Inherits:
Object
  • Object
show all
Defined in:
lib/gub/clients/github.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#connectionObject

Returns the value of attribute connection.



6
7
8
# File 'lib/gub/clients/github.rb', line 6

def connection
  @connection
end

Instance Method Details

#urlObject



12
13
14
# File 'lib/gub/clients/github.rb', line 12

def url
  'https://github.com/'
end

#userObject



16
17
18
# File 'lib/gub/clients/github.rb', line 16

def user
  @connection.user
end