class Megam::ScmmRepo

Public Class Methods

error(response) click to toggle source
# File lib/megam/core/scmm/scmmrepo.rb, line 49
def self.error(response)
  {:status => response.code, :body => "", :some_msg => response.message }
end
list(username, password) click to toggle source

Load a account by email_p

# File lib/megam/core/scmm/scmmrepo.rb, line 36
def self.list(username, password)
  #acct = self.new(username, password)
  megams = Megam::Scmmanager.new
  res = megams.get_repos(username, password)
  hash = {}
  if res.code != "200"
     hash = self.error(res)
   else
     hash = self.to_hash(res)
  end      
  hash
end
to_hash(response) click to toggle source

Transform the ruby obj -> to a Hash

# File lib/megam/core/scmm/scmmrepo.rb, line 20
def self.to_hash(response)
  index_hash = []
  i = 0
  config = Nokogiri::XML(response.body)
  config.css("repositories repositories").map do |node|
    node.children.map {|n|
      if n.name == 'url'            
        index_hash << n.text.strip
      end
    }
  end
  {:status => response.code, :body => index_hash, :some_msg => response.message }
end

Public Instance Methods

to_s() click to toggle source
# File lib/megam/core/scmm/scmmrepo.rb, line 53
def to_s
  Megam::Stuff.styled_hash(to_hash)
end