Module: GitHub::Finders

Included in:
GitHub
Defined in:
lib/github/finders.rb

Instance Method Summary collapse

Instance Method Details

#branches(login, repository_name) ⇒ Object



33
34
35
# File 'lib/github/finders.rb', line 33

def branches(, repository_name)
  json("/repos/#{}/#{repository_name}/branches")
end

#commit(login, repository_name, commit_id) ⇒ Object



47
48
49
50
# File 'lib/github/finders.rb', line 47

def commit(, repository_name, commit_id)
  h = json("/repos/#{}/#{repository_name}/commits/#{commit_id}")
  Commit.from_hash(h, Repository.new(:owner => , :name => repository_name))
end

#commits(login, repository_name, branch = 'master') ⇒ Object



42
43
44
45
# File 'lib/github/finders.rb', line 42

def commits(, repository_name, branch = 'master')
  h = json("/repos/#{}/#{repository_name}/commits/#{branch}")
  Commit.commits_from_hashes(h, Repository.new(:owner => , :name => repository_name))
end

#followers(login) ⇒ Object



13
14
15
16
# File 'lib/github/finders.rb', line 13

def followers()
  l = json("/users/#{}/followers")
  User.users_from_logins(l)
end

#following(login) ⇒ Object



8
9
10
11
# File 'lib/github/finders.rb', line 8

def following()
  l = json("/users/#{}/following")
  User.users_from_logins(l)
end

#forks(login, repository_name) ⇒ Object



37
38
39
40
# File 'lib/github/finders.rb', line 37

def forks(, repository_name)
  j = json("/repos/#{}/#{repository_name}/forks")
  Repository.repositories_from_hashes(j)
end

#organization_public_members(organization_name) ⇒ Object



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

def organization_public_members(organization_name)
  h = json("/orgs/#{organization_name}/members")
  h.map {|u| User.from_hash(u) }
end

#organization_public_repositories(organization_name) ⇒ Object



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

def organization_public_repositories(organization_name)
  h = json("/orgs/#{organization_name}/repos")
  h.map {|r| Repository.from_hash(r) }
end

#repositories(login) ⇒ Object



18
19
20
21
# File 'lib/github/finders.rb', line 18

def repositories()
  j = json("/users/#{}/repos")
  Repository.repositories_from_hashes(j)
end

#repository(login, repository_name) ⇒ Object



28
29
30
31
# File 'lib/github/finders.rb', line 28

def repository(, repository_name)
  j = json("/repos/#{}/#{repository_name}")
  Repository.from_hash(j)
end

#user(login) ⇒ Object



3
4
5
6
# File 'lib/github/finders.rb', line 3

def user()
  j = json("/users/#{}")
  User.from_hash(j)
end

#user_organizations(login) ⇒ Object



52
53
54
55
# File 'lib/github/finders.rb', line 52

def user_organizations()
  h = json("/users/#{}/orgs")
  h.map {|o| Organization.from_hash(o) }
end

#watched(login) ⇒ Object



23
24
25
26
# File 'lib/github/finders.rb', line 23

def watched()
  j = json("/users/#{}/watched")
  Repository.repositories_from_hashes(j)
end