Method: Moob::Pec#get_infos

Defined in:
lib/moob/pec.rb

#get_infos(keys) ⇒ Object



127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/moob/pec.rb', line 127

def get_infos keys
  infos = @session.post "data?get=#{keys.join(',')}", {}

  raise ResponseError.new infos unless infos.status == 200
  raise "The status isn't OK" unless infos.body =~ /<status>ok<\/status>/

  return Hash[keys.collect do |k|
    if infos.body =~ /<#{k}>(.*?)<\/#{k}>/
      [k, $1]
    else
      [k, nil]
    end
  end]
end