Module: Pathtraq::PageCounter

Defined in:
lib/pathtraq.rb

Constant Summary collapse

URL =
"http://api.pathtraq.com/page_counter"
PARAMS =
[:m, :url]

Class Method Summary collapse

Class Method Details

.request(params) ⇒ Object



82
83
84
85
86
87
88
89
90
# File 'lib/pathtraq.rb', line 82

def self.request(params)
  params[:api] = "json"
  res = Request.new(URL, params).send
  if md = /count:\s*(\d+)/.match(res)
    md[1].to_i
  else
    raise Error.new(res, params)
  end
end