Class: Megam::GogsTokens
- Inherits:
-
Object
- Object
- Megam::GogsTokens
- Defined in:
- lib/megam/core/gogs_tokens.rb
Class Method Summary collapse
- .error(response) ⇒ Object
- .list(username, password) ⇒ Object
-
.to_hash(response) ⇒ Object
Transform the ruby obj -> to a Hash.
Instance Method Summary collapse
Class Method Details
.error(response) ⇒ Object
43 44 45 46 |
# File 'lib/megam/core/gogs_tokens.rb', line 43 def self.error(response) {:status => response.status, :body => ""} end |
.list(username, password) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/megam/core/gogs_tokens.rb', line 28 def self.list(username, password) megams = Megam::Gogs.new res = megams.get_tokens(username, password) hash = {} puts res puts res.status if res.status != 200 hash = self.error(res) else hash = self.to_hash(res) end hash end |
.to_hash(response) ⇒ Object
Transform the ruby obj -> to a Hash
20 21 22 23 24 |
# File 'lib/megam/core/gogs_tokens.rb', line 20 def self.to_hash(response) index_hash = response.body {:status => response.status, :body => index_hash } end |
Instance Method Details
#to_s ⇒ Object
48 49 50 |
# File 'lib/megam/core/gogs_tokens.rb', line 48 def to_s Megam::Stuff.styled_hash(to_hash) end |