Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
amironenko committed Mar 15, 2016
1 parent 6a50a43 commit 5a05db4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
21 changes: 1 addition & 20 deletions lib/metrika/api/statistics.rb
Expand Up @@ -2,31 +2,12 @@ module Metrika
module Api
module Statistics

METRICS = {}

%W(#{''} PerDay PerHour PerMinute).each do |interval|
%w(visits pageviews).each do |metric|
METRICS["#{metric}#{interval}".to_sym] = "ym:s:#{metric}#{interval}"
end
end

%w(under18AgePercentage upTo24AgePercentage upTo34AgePercentage upTo44AgePercentage).each do |age_interval|
METRICS["age_#{age_interval}".to_sym] = "ym:s:#{age_interval}"
end

DIMENSIONS = { gender: "ym:s:gender", country: "ym:s:regionCountry", city: "ym:s:regionCity",
ip: "ys:s:ipAddress", device_type: "ym:s:deviceCategory", device_manufacturer: "ym:s:mobilePhone",
device_model: "ym:s:mobilePhoneModel", OS: "ym:s:operatingSystemRoot", browser: "ym:s:browser",
screen_size: "ym:s:windowClientArea", traffic_sources: "ym:s:<attribution>TrafficSource",
source_engine: "ym:s:<attribution>SourceEngine", advert_engine: "ym:s:<attribution>AdvEngine",
referal_site: "ym:s:<attribution>ReferalSource", social_network: "ym:s:<attribution>SocialNetwork",
referer: "ym:s:referer", interest: "ym:s:interest" }

def get_counter_stats(id, params = {})
params = self.format_params(params)
raise Metrika::Errors::GeneralError.new("Provide at least metric for query") if params[:metrics].nil?
self.get("/stat/v1/data", params.merge(id: id))
end

end
end
end
2 changes: 1 addition & 1 deletion lib/metrika/helpers.rb
Expand Up @@ -10,7 +10,7 @@ module Helpers
def format_params(params)
params[:date1] = self.format_date(params[:date1]) if params[:date1].present?
params[:date2] = self.format_date(params[:date2]) if params[:date2].present?

params
end

Expand Down

0 comments on commit 5a05db4

Please sign in to comment.