Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adds response class and stub response json.

  • Loading branch information...
commit 1f6752c7e869027d2b8b8452501064fcfec76496 1 parent 9ecf4be
@gtrogers gtrogers authored
View
14 lib/response/weekly_transaction_response.rb
@@ -0,0 +1,14 @@
+require_relative "weekly_response"
+require_relative "extract_weekly_dates"
+
+module GoogleAnalytics
+ class WeeklyTransactionResponse < BaseResponse
+ include ExtractWeeklyDates
+
+ def initialize(response_hash, config_class)
+ @messages = []
+ end
+
+
+ end
+end
View
45 spec/fixtures/weekly_transaction_response.json
@@ -0,0 +1,45 @@
+{
+ "kind":"analytics#gaData", "id":"https://www.googleapis.com/analytics/v3/data/ga?ids=ga:61976178&dimensions=ga:week,ga:eventCategory,ga:eventLabel&metrics=ga:totalEvents&filters=ga:eventCategory%3D%3DMS_transaction&start-date=2012-12-30&end-date=2013-01-05", "query":{
+ "start-date":"2012-12-30",
+ "end-date":"2013-01-05",
+ "ids":"ga:61976178",
+ "dimensions":"ga:week,ga:eventCategory,ga:eventLabel",
+ "metrics":["ga:totalEvents"],
+ "filters":"ga:eventCategory==MS_transaction",
+ "start-index":1,
+ "max-results":1000
+},
+ "itemsPerPage":1000, "totalResults":2, "selfLink":"https://www.googleapis.com/analytics/v3/data/ga?ids=ga:61976178&dimensions=ga:week,ga:eventCategory,ga:eventLabel&metrics=ga:totalEvents&filters=ga:eventCategory%3D%3DMS_transaction&start-date=2012-12-30&end-date=2013-01-05", "profileInfo":{
+ "profileId":"61976178",
+ "accountId":"33336744",
+ "webPropertyId":"UA-33336744-1",
+ "internalWebPropertyId":"60590321",
+ "profileName":"exit_tracking",
+ "tableId":"ga:61976178"
+}, "containsSampledData":false, "columnHeaders":[
+ {
+ "name":"ga:week",
+ "columnType":"DIMENSION",
+ "dataType":"STRING"
+ },
+ {
+ "name":"ga:eventCategory",
+ "columnType":"DIMENSION",
+ "dataType":"STRING"
+ },
+ {
+ "name":"ga:eventLabel",
+ "columnType":"DIMENSION",
+ "dataType":"STRING"
+ },
+ {
+ "name":"ga:totalEvents",
+ "columnType":"METRIC",
+ "dataType":"INTEGER"
+ }
+], "totalsForAllResults":{
+ "ga:totalEvents":"1431421"
+}, "rows":[
+ ["01", "MS_transaction", "Success", "1061180"],
+ ["53", "MS_transaction", "Success", "370241"]
+]}
View
13 spec/unit/response/weekly_transaction_response_spec.rb
@@ -1,7 +1,16 @@
require_relative "../../spec_helper"
-describe "weekly entry/success reponse" do
+describe "weekly entry/success response" do
- it "should have an array of messages"
+ describe "when on a year boundary" do
+ before(:each) do
+ response_as_hash = load_json("weekly_transaction_response.json")
+ @response = WeeklyTransactionResponse.new(response_as_hash, GoogleAnalytics::Config::WeeklyEntrySuccess)
+ end
+
+ it "should have an array of messages" do
+ @response.messages.should be_an(Array)
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.