Module: Pathtraq::PageChart

Defined in:
lib/pathtraq.rb

Constant Summary collapse

URL =
"http://api.pathtraq.com/page_chart"
PARAMS =
[:url, :scale]

Class Method Summary collapse

Class Method Details

.request(params) ⇒ Object



97
98
99
100
101
102
103
104
105
# File 'lib/pathtraq.rb', line 97

def self.request(params)
  params[:api] = "json"
  res = Request.new(URL, params).send
  if md = /plots:\s*\[\s*([\d\s,]+)\s*\]/.match(res)
    return md[1].gsub!(" ", "").split(",").map{|s| s.to_i }
  else
    raise Error.new(res, params)
  end
end

.url(url, scale = :"24h") ⇒ Object



107
108
109
# File 'lib/pathtraq.rb', line 107

def self.url(url, scale=:"24h")
  request(:url => url, :scale => scale)
end