Method: GitHub::Repo.get

Defined in:
lib/github-api-client/repo.rb

.get(information, o_type = :user) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/github-api-client/repo.rb', line 20

def self.get(information, o_type = :user)
  #FIXME: permalink column must be present, comparing url's is surely not the most efficient way for the db
  conditions = {:name => information.split('/').last}
  if o_type == :user
    conditions.merge! :owner_id => GitHub::User.(information.split('/').first).id, :owner_type => 'GitHub::User'
  else
    conditions.merge! :owner_id => GitHub::Organization.(information.split('/').first).id, :owner_type => 'GitHub::Organization'
  end
  if r = GitHub::Repo.where(conditions).first
    r.get
  else
    r = GitHub::Repo.new(conditions).get
    p r.parent
    r
  end
end