Class: Megam::GogsRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/megam/core/gogs_repo.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.error(response) ⇒ Object



42
43
44
# File 'lib/megam/core/gogs_repo.rb', line 42

def self.error(response)
  {:status => response.status, :body => "" }
end

.list(token) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/megam/core/gogs_repo.rb', line 28

def self.list(token)
  
  puts "Wait! Will list repos!"
  megams = Megam::Gogs.new
  res = megams.get_repos(token)
  hash = {}
  if res.status != 200
    hash = self.error(res)
  else
    hash = self.to_hash(res)
  end
  hash
end

.to_hash(response) ⇒ Object



20
21
22
23
24
25
# File 'lib/megam/core/gogs_repo.rb', line 20

def self.to_hash(response)
  puts "Enters to_hash! phew! no error!"
  puts response.body
  index_hash = response.body
  {:status => response.status, :body => index_hash }
end

Instance Method Details

#to_sObject



46
47
48
# File 'lib/megam/core/gogs_repo.rb', line 46

def to_s
  Megam::Stuff.styled_hash(to_hash)
end