lib/postrank-api/api.rb in postrank-api-0.1.1 vs lib/postrank-api/api.rb in postrank-api-0.1.2
- old
+ new
@@ -77,9 +77,26 @@
http = post("#{V2_API_BASE}/feed/engagement", req)
parse(http.response)
end
+ def domain_activity(domains, opts = {})
+ opts[:start_time] ||= '1 month ago'
+ opts[:end_time] ||= 'today'
+
+ req = {
+ :query => {
+ :appkey => @appkey,
+ :start_time => Chronic.parse(opts[:start_time]).to_i,
+ :end_time => Chronic.parse(opts[:end_time]).to_i
+ },
+ :body => build_body(domains, 'domain')
+ }
+
+ http = post("#{V2_API_BASE}/domain/activity", req)
+ parse(http.response)
+ end
+
def metrics(urls, opts = {})
reverse = {}
urls = [urls].flatten.map do |url|
md5 = (url =~ /\w{32}/) ? url : Digest::MD5.hexdigest(url)
reverse[md5] = url