Class: Hubba::Github

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

Instance Method Summary collapse

Constructor Details

#initialize(cache_dir: './cache') ⇒ Github

Returns a new instance of Github.



30
31
32
33
34
35
# File 'lib/hubba/github.rb', line 30

def initialize( cache_dir: './cache' )
   @cache  = Cache.new( cache_dir )
   @client = Client.new
   
   @offline = false
end

Instance Method Details

#offline!Object

switch to offline - todo: find a “better” way - why? why not?



37
# File 'lib/hubba/github.rb', line 37

def offline!()  @offline = true;  end

#offline?Boolean

Returns:

  • (Boolean)


38
# File 'lib/hubba/github.rb', line 38

def offline?()  @offline; end

#org(name) ⇒ Object



63
64
65
# File 'lib/hubba/github.rb', line 63

def org( name )
  Resource.new( get "/orgs/#{name}" )
end

#org_repos(name) ⇒ Object



67
68
69
# File 'lib/hubba/github.rb', line 67

def org_repos( name )
  Repos.new( get "/orgs/#{name}/repos?per_page=100" )
end

#user(name) ⇒ Object



41
42
43
# File 'lib/hubba/github.rb', line 41

def user( name )
  Resource.new( get "/users/#{name}" )
end

#user_orgs(name) ⇒ Object

note: pagination

requests that return multiple items will be paginated to 30 items by default.
 You can specify further pages with the ?page parameter.

For some resources, you can also set a custom page size up to 100

with the ?per_page=100 parameter


58
59
60
# File 'lib/hubba/github.rb', line 58

def user_orgs( name )
  Orgs.new( get "/users/#{name}/orgs?per_page=100" )
end

#user_repos(name) ⇒ Object



46
47
48
# File 'lib/hubba/github.rb', line 46

def user_repos( name )
  Repos.new( get "/users/#{name}/repos" )   ## add ?per_page=100 - why? why not?
end