Class: Vanity::Metric::GoogleAnalytics::Resource
- Inherits:
-
Object
- Object
- Vanity::Metric::GoogleAnalytics::Resource
- Defined in:
- lib/vanity/metric/google_analytics.rb
Overview
Instance Attribute Summary (collapse)
-
- (Object) profile
readonly
GA profile used for this report.
Instance Method Summary (collapse)
-
- (Resource) initialize(web_property_id, metric)
constructor
A new instance of Resource.
- - (Object) results(start_date, end_date)
Constructor Details
- (Resource) initialize(web_property_id, metric)
A new instance of Resource
65 66 67 68 69 70 71 |
# File 'lib/vanity/metric/google_analytics.rb', line 65 def initialize(web_property_id, metric) self.class.send :include, Garb::Resource @web_property_id = web_property_id metrics metric dimensions :date sort :date end |
Instance Attribute Details
- (Object) profile (readonly)
GA profile used for this report. Populated after calling results.
63 64 65 |
# File 'lib/vanity/metric/google_analytics.rb', line 63 def profile @profile end |
Instance Method Details
- (Object) results(start_date, end_date)
73 74 75 76 77 78 |
# File 'lib/vanity/metric/google_analytics.rb', line 73 def results(start_date, end_date) @profile = Garb::Profile.all.find { |p| p.web_property_id == @web_property_id } @start_date = start_date @end_date = end_date Garb::ReportResponse.new(send_request_for_body).results end |