Class: Episodic::Platform::AnalyticsMethods
- Defined in:
- lib/episodic/platform/analytics_methods.rb
Overview
Class for making requests against the Episodic Platform Analytics API.
Class Method Summary collapse
-
.campaigns_daily_report(show_id, date_range, format) ⇒ Object
Generates a report for all campaigns in a specific show.
-
.episode_daily_report(show_id, episode_id, date_range, format) ⇒ Object
Generates a report for a specific episode in a show.
-
.episodes_summary_report(show_id, date_range, date_grouping, format) ⇒ Object
Generates a report for all episodes in a show.
-
.get_report(token) ⇒ Object
Fetches a previously generated report.
Methods inherited from Base
Class Method Details
.campaigns_daily_report(show_id, date_range, format) ⇒ Object
Generates a report for all campaigns in a specific show. The report will contain information such as the total views, complete views, downloads, click throughs, etc for each campaign in the show.
It is important to note that this method just generates the report and returns a token that can be used to get the report by calling Episodic::Platform::AnalyticsMethods.get_report
.
Parameters
- show_id<String>
-
The id of the show that contains your campaigns. To get a list of your
shows see <tt>Episodic::Platform::QueryMethods.show</tt>.
- date_range<String>
-
Specifies period of your report. The value of this parameter must be one
of 'today', 'last_seven', 'last_thirty'.
- format<String>
-
The format parameter is required and must be one of ‘csv’ or ‘xml’.
Returns
- Episodic::Platform::TokenResponse
-
This response object includes a token that can be used to
actually get the report by calling <tt>Episodic::Platform::AnalyticsMethods.get_report</tt>.
127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/episodic/platform/analytics_methods.rb', line 127 def campaigns_daily_report show_id, date_range, format params = { :show_id => show_id, :date_range => date_range, :format => format } response = connection.do_get(construct_url("analytics", "request_campaigns_daily_report"), params) # Convert to a hash return parse_token_response(response) end |
.episode_daily_report(show_id, episode_id, date_range, format) ⇒ Object
Generates a report for a specific episode in a show. The report will contain information such as the total views, complete views, downloads, etc for each episode in the show.
It is important to note that this method just generates the report and returns a token that can be used to get the report by calling Episodic::Platform::AnalyticsMethods.get_report
.
Parameters
- show_id<String>
-
The id of the show that contains your episodes. To get a list of your
shows see <tt>Episodic::Platform::QueryMethods.show</tt>.
- episode_id<String>
-
The id of the episodes to generate the report for. To get a list of your
episodes see <tt>Episodic::Platform::QueryMethods.episodes</tt>.
- date_range<String>
-
Specifies period of your report. The value of this parameter must be one
of 'today', 'last_seven', 'last_thirty'.
- format<String>
-
The format parameter is required and must be one of ‘csv’ or ‘xml’.
Returns
- Episodic::Platform::TokenResponse
-
This response object includes a token that can be used to
actually get the report by calling <tt>Episodic::Platform::AnalyticsMethods.get_report</tt>.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/episodic/platform/analytics_methods.rb', line 92 def episode_daily_report show_id, episode_id, date_range, format params = { :show_id => show_id, :date_range => date_range, :id => episode_id, :format => format } response = connection.do_get(construct_url("analytics", "request_episode_daily_report"), params) # Convert to a hash return parse_token_response(response) end |
.episodes_summary_report(show_id, date_range, date_grouping, format) ⇒ Object
Generates a report for all episodes in a show. The report will contain information such as the total views, complete views, downloads, etc for each episode in the show.
It is important to note that this method just generates the report and returns a token that can be used to get the report by calling Episodic::Platform::AnalyticsMethods.get_report
.
Parameters
- show_id<String>
-
The id of the show that contains your episodes. To get a list of your
shows see <tt>Episodic::Platform::QueryMethods.show</tt>.
- date_range<String>
-
Specifies period of your report. The value of this parameter must be one
of 'today', 'last_seven', 'last_thirty'.
- date_grouping<String>
-
Must be one of ‘daily’ or ‘aggregate’ to list the data by day or just a total
for the entire period respectively.
- format<String>
-
The format parameter is required and must be one of ‘csv’ or ‘xml’.
Returns
- Episodic::Platform::TokenResponse
-
This response object includes a token that can be used to
actually get the report by calling <tt>Episodic::Platform::AnalyticsMethods.get_report</tt>.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/episodic/platform/analytics_methods.rb', line 55 def episodes_summary_report show_id, date_range, date_grouping, format params = { :show_id => show_id, :date_range => date_range, :date_grouping => date_grouping, :format => format } response = connection.do_get(construct_url("analytics", "request_episodes_summary_report"), params) # Convert to a hash return parse_token_response(response) end |
.get_report(token) ⇒ Object
Fetches a previously generated report.
Parameters
- report_token<String>
-
This is the value returned from one of the report generation methods.
Returns
- String
-
The contents of the report.
23 24 25 26 27 28 29 30 31 |
# File 'lib/episodic/platform/analytics_methods.rb', line 23 def get_report token params = { :report_token => token, } response = connection.do_get(construct_url("analytics", "get_report"), params) return response.body end |