legato 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/README.md +171 -0
- data/Rakefile +31 -0
- data/legato.gemspec +29 -0
- data/lib/legato/core_ext/array.rb +13 -0
- data/lib/legato/core_ext/string.rb +49 -0
- data/lib/legato/filter.rb +57 -0
- data/lib/legato/filter_set.rb +27 -0
- data/lib/legato/list_parameter.rb +29 -0
- data/lib/legato/management/account.rb +31 -0
- data/lib/legato/management/finder.rb +14 -0
- data/lib/legato/management/profile.rb +33 -0
- data/lib/legato/management/web_property.rb +28 -0
- data/lib/legato/model.rb +42 -0
- data/lib/legato/profile_methods.rb +16 -0
- data/lib/legato/query.rb +183 -0
- data/lib/legato/reports.rb +16 -0
- data/lib/legato/request.rb +21 -0
- data/lib/legato/response.rb +91 -0
- data/lib/legato/result_set.rb +21 -0
- data/lib/legato/user.rb +34 -0
- data/lib/legato/version.rb +3 -0
- data/lib/legato.rb +51 -0
- data/spec/cassettes/management/accounts.json +1 -0
- data/spec/cassettes/management/profiles.json +1 -0
- data/spec/cassettes/management/web_properties.json +1 -0
- data/spec/cassettes/model/basic.json +1 -0
- data/spec/fixtures/simple_response.json +1 -0
- data/spec/integration/management_spec.rb +34 -0
- data/spec/integration/model_spec.rb +20 -0
- data/spec/lib/legato/filter_spec.rb +49 -0
- data/spec/lib/legato/list_parameter_spec.rb +35 -0
- data/spec/lib/legato/management/account_spec.rb +39 -0
- data/spec/lib/legato/management/profile_spec.rb +45 -0
- data/spec/lib/legato/management/web_property_spec.rb +34 -0
- data/spec/lib/legato/model_spec.rb +77 -0
- data/spec/lib/legato/query_spec.rb +324 -0
- data/spec/lib/legato/response_spec.rb +15 -0
- data/spec/lib/legato/user_spec.rb +38 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/examples/management_finder.rb +18 -0
- data/spec/support/macros/oauth.rb +26 -0
- metadata +182 -0
data/lib/legato/query.rb
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
module Legato
|
|
2
|
+
class Query
|
|
3
|
+
include Enumerable
|
|
4
|
+
|
|
5
|
+
MONTH = 2592000
|
|
6
|
+
|
|
7
|
+
def define_filter(name, block)
|
|
8
|
+
(class << self; self; end).instance_eval do
|
|
9
|
+
define_method(name) {|*args| apply_filter(*args, block)}
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.define_filter_operators(*methods)
|
|
14
|
+
methods.each do |method|
|
|
15
|
+
class_eval <<-CODE
|
|
16
|
+
def #{method}(field, value)
|
|
17
|
+
Filter.new(field, :#{method}, value) # defaults to joining with AND
|
|
18
|
+
end
|
|
19
|
+
CODE
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
attr_reader :parent_klass
|
|
24
|
+
attr_accessor :profile, :start_date, :end_date
|
|
25
|
+
attr_accessor :order, :limit, :offset#, :segment # individual, overwritten
|
|
26
|
+
attr_accessor :filters # appended to, may add :segments later for dynamic segments
|
|
27
|
+
|
|
28
|
+
def initialize(klass)
|
|
29
|
+
@loaded = false
|
|
30
|
+
@parent_klass = klass
|
|
31
|
+
self.filters = FilterSet.new
|
|
32
|
+
self.start_date = Time.now - MONTH
|
|
33
|
+
self.end_date = Time.now
|
|
34
|
+
|
|
35
|
+
klass.filters.each do |name, block|
|
|
36
|
+
define_filter(name, block)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# may add later for dynamic segments
|
|
40
|
+
# klass.segment_definitions.each do |name, segment|
|
|
41
|
+
# self.class.define_segment(name, segment)
|
|
42
|
+
# end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def apply_filter(*args, block)
|
|
46
|
+
@profile = extract_profile(args)
|
|
47
|
+
|
|
48
|
+
join_character = Legato.and_join_character # filters are joined by AND
|
|
49
|
+
|
|
50
|
+
# # block returns one filter or an array of filters
|
|
51
|
+
Array.wrap(instance_exec(*args, &block)).each do |filter|
|
|
52
|
+
filter.join_character = join_character
|
|
53
|
+
self.filters << filter
|
|
54
|
+
|
|
55
|
+
join_character = Legato.or_join_character # arrays are joined by OR
|
|
56
|
+
end
|
|
57
|
+
self
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def apply_options(options)
|
|
61
|
+
if options.has_key?(:sort)
|
|
62
|
+
# warn
|
|
63
|
+
options[:order] = options.delete(:sort)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
apply_basic_options(options)
|
|
67
|
+
# apply_filter_options(options[:filters])
|
|
68
|
+
|
|
69
|
+
self
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def apply_basic_options(options)
|
|
73
|
+
[:order, :limit, :offset, :start_date, :end_date].each do |key| #:segment
|
|
74
|
+
self.send("#{key}=".to_sym, options[key]) if options.has_key?(key)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# def apply_filter_options(filter_options)
|
|
79
|
+
# join_character = Legato.and_join_character
|
|
80
|
+
#
|
|
81
|
+
# Array.wrap(filter_options).compact.each do |filter|
|
|
82
|
+
# filter.each do |key, value|
|
|
83
|
+
# self.filters << hash_to_filter(key, value, join_character)
|
|
84
|
+
# join_character = Legato.and_join_character # hashes are joined by AND
|
|
85
|
+
# end
|
|
86
|
+
# join_character = Legato.or_join_character # arrays are joined by OR
|
|
87
|
+
# end
|
|
88
|
+
# end
|
|
89
|
+
|
|
90
|
+
# def hash_to_filter(key, value, join_character)
|
|
91
|
+
# field, operator = key, :eql
|
|
92
|
+
# field, operator = key.target, key.operator if key.is_a?(SymbolOperatorMethods)
|
|
93
|
+
|
|
94
|
+
# Filter.new(field, operator, value, join_character)
|
|
95
|
+
# end
|
|
96
|
+
|
|
97
|
+
def extract_profile(args)
|
|
98
|
+
return args.shift if args.first.is_a?(Management::Profile)
|
|
99
|
+
return args.pop if args.last.is_a?(Management::Profile)
|
|
100
|
+
profile
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
define_filter_operators :eql, :not_eql, :gt, :gte, :lt, :lte, :matches,
|
|
104
|
+
:does_not_match, :contains, :does_not_contain, :substring, :not_substring
|
|
105
|
+
|
|
106
|
+
def loaded?
|
|
107
|
+
@loaded
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def load
|
|
111
|
+
@collection = request_for_query.collection
|
|
112
|
+
@loaded = true
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def collection
|
|
116
|
+
load unless loaded?
|
|
117
|
+
@collection
|
|
118
|
+
end
|
|
119
|
+
alias :to_a :collection
|
|
120
|
+
|
|
121
|
+
def each(&block)
|
|
122
|
+
collection.each(&block)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# if no filters, we use results to add profile
|
|
126
|
+
def results(profile=nil, options={})
|
|
127
|
+
self.profile = profile unless profile.nil?
|
|
128
|
+
apply_options(options)
|
|
129
|
+
self
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# def total_results
|
|
133
|
+
# collection.total_results
|
|
134
|
+
# end
|
|
135
|
+
|
|
136
|
+
# def sampled?
|
|
137
|
+
# collection.sampled?
|
|
138
|
+
# end
|
|
139
|
+
|
|
140
|
+
def metrics
|
|
141
|
+
parent_klass.metrics
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def dimensions
|
|
145
|
+
parent_klass.dimensions
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def order=(arr)
|
|
149
|
+
@order = Legato::ListParameter.new(:order, arr)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# def segment_id
|
|
153
|
+
# segment.nil? ? nil : "gaid::#{segment}"
|
|
154
|
+
# end
|
|
155
|
+
|
|
156
|
+
def profile_id
|
|
157
|
+
profile && Legato.to_ga_string(profile.id)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def to_params
|
|
161
|
+
params = {
|
|
162
|
+
'ids' => profile_id,
|
|
163
|
+
'start-date' => Legato.format_time(start_date),
|
|
164
|
+
'end-date' => Legato.format_time(end_date),
|
|
165
|
+
'max-results' => limit,
|
|
166
|
+
'start-index' => offset,
|
|
167
|
+
# 'segment' => segment_id,
|
|
168
|
+
'filters' => filters.to_params # defaults to AND filtering
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[metrics, dimensions, order].each do |list|
|
|
172
|
+
params.merge!(list.to_params) unless list.nil?
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
params.reject {|k,v| v.nil? || v.to_s.strip.length == 0}
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
private
|
|
179
|
+
def request_for_query
|
|
180
|
+
profile.user.request(self)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# module Legato
|
|
2
|
+
# module Reports
|
|
3
|
+
# def self.add_report_method(klass)
|
|
4
|
+
# # demodulize leaves potential to redefine
|
|
5
|
+
# # these methods given different namespaces
|
|
6
|
+
# method_name = klass.name.to_s.demodulize.underscore
|
|
7
|
+
# return unless method_name.length > 0
|
|
8
|
+
#
|
|
9
|
+
# class_eval <<-CODE
|
|
10
|
+
# def #{method_name}(opts = {}, &block)
|
|
11
|
+
# #{klass}.results(self, opts, &block)
|
|
12
|
+
# end
|
|
13
|
+
# CODE
|
|
14
|
+
# end
|
|
15
|
+
# end
|
|
16
|
+
# end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# module Legato
|
|
2
|
+
# class Request
|
|
3
|
+
# URL = "https://www.googleapis.com/analytics/v3/data/ga"
|
|
4
|
+
#
|
|
5
|
+
# def initialize(query)
|
|
6
|
+
# @query = query
|
|
7
|
+
# end
|
|
8
|
+
#
|
|
9
|
+
# def response
|
|
10
|
+
# @response ||= Response.new(parsed_response)
|
|
11
|
+
# end
|
|
12
|
+
#
|
|
13
|
+
# def parsed_response
|
|
14
|
+
# JSON.parse(raw_response)
|
|
15
|
+
# end
|
|
16
|
+
#
|
|
17
|
+
# def raw_response
|
|
18
|
+
# @query.profile.user.get(URL, :params => @query.to_params)
|
|
19
|
+
# end
|
|
20
|
+
# end
|
|
21
|
+
# end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
module Legato
|
|
2
|
+
class Response
|
|
3
|
+
def initialize(raw_response, instance_klass = OpenStruct)
|
|
4
|
+
@raw_response = raw_response
|
|
5
|
+
@instance_klass = instance_klass
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def data
|
|
9
|
+
@data ||= JSON.parse(@raw_response.body)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def collection
|
|
13
|
+
raw_attributes.map {|attributes| @instance_klass.new(attributes)}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
def headers
|
|
18
|
+
data['columnHeaders']
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def fields
|
|
22
|
+
headers.map {|header| Legato.from_ga_string(header['name'])}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def rows
|
|
26
|
+
data['rows']
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def raw_attributes
|
|
30
|
+
rows.map {|row| Hash[fields.zip(row)]}
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# module Legato
|
|
36
|
+
# class Response
|
|
37
|
+
# KEYS = ['dxp$metric', 'dxp$dimension']
|
|
38
|
+
#
|
|
39
|
+
# # we could take the request, and be lazy about loading here, #refactoring
|
|
40
|
+
# def initialize(response_body, instance_klass = OpenStruct)
|
|
41
|
+
# @data = response_body
|
|
42
|
+
# @instance_klass = instance_klass
|
|
43
|
+
# end
|
|
44
|
+
#
|
|
45
|
+
# def results
|
|
46
|
+
# if @results.nil?
|
|
47
|
+
# @results = ResultSet.new(parse)
|
|
48
|
+
# @results.total_results = parse_total_results
|
|
49
|
+
# @results.sampled = parse_sampled_flag
|
|
50
|
+
# end
|
|
51
|
+
#
|
|
52
|
+
# @results
|
|
53
|
+
# end
|
|
54
|
+
#
|
|
55
|
+
# def sampled?
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
# private
|
|
59
|
+
# def parse
|
|
60
|
+
# entries.map do |entry|
|
|
61
|
+
# @instance_klass.new(Hash[
|
|
62
|
+
# values_for(entry).map {|v| [Garb.from_ga(v['name']), v['value']]}
|
|
63
|
+
# ])
|
|
64
|
+
# end
|
|
65
|
+
# end
|
|
66
|
+
#
|
|
67
|
+
# def entries
|
|
68
|
+
# feed? ? [parsed_data['feed']['entry']].flatten.compact : []
|
|
69
|
+
# end
|
|
70
|
+
#
|
|
71
|
+
# def parse_total_results
|
|
72
|
+
# feed? ? parsed_data['feed']['openSearch:totalResults'].to_i : 0
|
|
73
|
+
# end
|
|
74
|
+
#
|
|
75
|
+
# def parse_sampled_flag
|
|
76
|
+
# feed? ? (parsed_data['feed']['dxp$containsSampledData'] == 'true') : false
|
|
77
|
+
# end
|
|
78
|
+
#
|
|
79
|
+
# def parsed_data
|
|
80
|
+
# @parsed_data ||= JSON.parse(@data)
|
|
81
|
+
# end
|
|
82
|
+
#
|
|
83
|
+
# def feed?
|
|
84
|
+
# !parsed_data['feed'].nil?
|
|
85
|
+
# end
|
|
86
|
+
#
|
|
87
|
+
# def values_for(entry)
|
|
88
|
+
# KEYS.map {|k| entry[k]}.flatten.compact
|
|
89
|
+
# end
|
|
90
|
+
# end
|
|
91
|
+
# end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# module Legato
|
|
2
|
+
# class ResultSet
|
|
3
|
+
# include Enumerable
|
|
4
|
+
#
|
|
5
|
+
# attr_accessor :total_results, :sampled
|
|
6
|
+
#
|
|
7
|
+
# alias :sampled? :sampled
|
|
8
|
+
#
|
|
9
|
+
# def initialize(results)
|
|
10
|
+
# @results = results
|
|
11
|
+
# end
|
|
12
|
+
#
|
|
13
|
+
# def each(&block)
|
|
14
|
+
# @results.each(&block)
|
|
15
|
+
# end
|
|
16
|
+
#
|
|
17
|
+
# def to_a
|
|
18
|
+
# @results
|
|
19
|
+
# end
|
|
20
|
+
# end
|
|
21
|
+
# end
|
data/lib/legato/user.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Legato
|
|
2
|
+
class User
|
|
3
|
+
attr_accessor :access_token
|
|
4
|
+
|
|
5
|
+
def initialize(token)
|
|
6
|
+
self.access_token = token
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
URL = "https://www.googleapis.com/analytics/v3/data/ga"
|
|
10
|
+
|
|
11
|
+
def request(query)
|
|
12
|
+
begin
|
|
13
|
+
Response.new(access_token.get(URL, :params => query.to_params))
|
|
14
|
+
rescue => e
|
|
15
|
+
p e.code
|
|
16
|
+
raise e
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Management
|
|
21
|
+
def accounts
|
|
22
|
+
Management::Account.all(self)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def web_properties
|
|
26
|
+
Management::WebProperty.all(self)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def profiles
|
|
30
|
+
Management::Profile.all(self)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
data/lib/legato.rb
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require "legato/version"
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'oauth2'
|
|
5
|
+
require 'cgi'
|
|
6
|
+
require 'ostruct'
|
|
7
|
+
|
|
8
|
+
unless Object.const_defined?("ActiveSupport")
|
|
9
|
+
require "legato/core_ext/string"
|
|
10
|
+
require "legato/core_ext/array"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module Legato
|
|
14
|
+
module Management
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.to_ga_string(str)
|
|
18
|
+
"#{$1}ga:#{$2}" if str.to_s.camelize(:lower) =~ /^(-)?(.*)$/
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.from_ga_string(str)
|
|
22
|
+
str.gsub("ga:", '')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.format_time(t)
|
|
26
|
+
t.strftime('%Y-%m-%d')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.and_join_character
|
|
30
|
+
';'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.or_join_character
|
|
34
|
+
','
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
require 'legato/user'
|
|
39
|
+
require 'legato/profile_methods'
|
|
40
|
+
|
|
41
|
+
require 'legato/management/finder'
|
|
42
|
+
require 'legato/management/account'
|
|
43
|
+
require 'legato/management/web_property'
|
|
44
|
+
require 'legato/management/profile'
|
|
45
|
+
|
|
46
|
+
require 'legato/list_parameter'
|
|
47
|
+
require 'legato/response'
|
|
48
|
+
require 'legato/filter'
|
|
49
|
+
require 'legato/filter_set'
|
|
50
|
+
require 'legato/query'
|
|
51
|
+
require 'legato/model'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://www.googleapis.com/analytics/v3/management/accounts","body":"","headers":{"Authorization":["Bearer ya29.AHES6ZSw3j6NfON_gJdtG6bHrU4bh3gPsRd945judH-Umg"]}},"response":{"status":{"code":200,"message":null},"headers":{"expires":["Mon, 12 Dec 2011 01:50:57 GMT"],"date":["Mon, 12 Dec 2011 01:50:57 GMT"],"cache-control":["private, max-age=0, must-revalidate, no-transform"],"etag":["\"0EbX2LGJDld9q3PnatPaRNNGQuE/UNg6FqWjVerwqN5evPh2D46-vAo\""],"content-type":["application/json; charset=UTF-8"],"x-content-type-options":["nosniff"],"x-frame-options":["SAMEORIGIN"],"x-xss-protection":["1; mode=block"],"server":["GSE"],"connection":["close"]},"body":"{\"kind\":\"analytics#accounts\",\"username\":\"tpitale@gmail.com\",\"totalResults\":6,\"startIndex\":1,\"itemsPerPage\":1000,\"items\":[{\"id\":\"1189765\",\"kind\":\"analytics#account\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765\",\"name\":\"ICS\",\"created\":\"2007-01-14T09:44:38.000Z\",\"updated\":\"2011-07-26T17:33:04.015Z\",\"childLink\":{\"type\":\"analytics#webproperties\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties\"}},{\"id\":\"3879168\",\"kind\":\"analytics#account\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168\",\"name\":\"Personal\",\"created\":\"2008-03-15T00:03:57.000Z\",\"updated\":\"2010-03-02T16:36:02.884Z\",\"childLink\":{\"type\":\"analytics#webproperties\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties\"}},{\"id\":\"7471517\",\"kind\":\"analytics#account\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/7471517\",\"name\":\"FeedStitch\",\"created\":\"2009-02-13T22:39:47.000Z\",\"updated\":\"2011-07-19T22:04:19.264Z\",\"childLink\":{\"type\":\"analytics#webproperties\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/7471517/webproperties\"}},{\"id\":\"11360836\",\"kind\":\"analytics#account\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/11360836\",\"name\":\"niteflirt.com\",\"created\":\"2009-10-30T18:29:52.000Z\",\"updated\":\"2011-10-12T22:54:42.534Z\",\"childLink\":{\"type\":\"analytics#webproperties\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/11360836/webproperties\"}},{\"id\":\"11917142\",\"kind\":\"analytics#account\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/11917142\",\"name\":\"datamapper.org\",\"created\":\"2009-12-04T15:16:04.000Z\",\"updated\":\"2011-07-13T22:48:52.824Z\",\"childLink\":{\"type\":\"analytics#webproperties\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/11917142/webproperties\"}},{\"id\":\"17306519\",\"kind\":\"analytics#account\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/17306519\",\"name\":\"VG3c\",\"created\":\"2010-07-06T01:00:00.252Z\",\"updated\":\"2011-07-07T21:46:26.727Z\",\"childLink\":{\"type\":\"analytics#webproperties\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/17306519/webproperties\"}}]}","http_version":null},"recorded_at":"Mon, 12 Dec 2011 01:51:13 GMT"}],"recorded_with":"VCR 2.0.0.beta2"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles","body":"","headers":{"Authorization":["Bearer ya29.AHES6ZSw3j6NfON_gJdtG6bHrU4bh3gPsRd945judH-Umg"]}},"response":{"status":{"code":200,"message":null},"headers":{"expires":["Mon, 12 Dec 2011 01:50:58 GMT"],"date":["Mon, 12 Dec 2011 01:50:58 GMT"],"cache-control":["private, max-age=0, must-revalidate, no-transform"],"etag":["\"0EbX2LGJDld9q3PnatPaRNNGQuE/b64HzQHPH7LaksA_n9YpboKT6LI\""],"content-type":["application/json; charset=UTF-8"],"x-content-type-options":["nosniff"],"x-frame-options":["SAMEORIGIN"],"x-xss-protection":["1; mode=block"],"server":["GSE"],"connection":["close"]},"body":"{\"kind\":\"analytics#profiles\",\"username\":\"tpitale@gmail.com\",\"totalResults\":12,\"startIndex\":1,\"itemsPerPage\":1000,\"items\":[{\"id\":\"4506212\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-4/profiles/4506212\",\"accountId\":\"1189765\",\"webPropertyId\":\"UA-1189765-4\",\"internalWebPropertyId\":\"4382400\",\"name\":\"winepos.com\",\"currency\":\"USD\",\"timezone\":\"America/New_York\",\"created\":\"2007-08-15T20:52:48.000Z\",\"updated\":\"2011-09-26T20:19:47.239Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-4\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-4/profiles/4506212/goals\"}},{\"id\":\"25452496\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-4/profiles/25452496\",\"accountId\":\"1189765\",\"webPropertyId\":\"UA-1189765-4\",\"internalWebPropertyId\":\"4382400\",\"name\":\"Viget - PPC - Full Keywords\",\"currency\":\"USD\",\"timezone\":\"America/New_York\",\"created\":\"2010-01-19T16:58:03.000Z\",\"updated\":\"2011-09-26T20:19:47.304Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-4\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-4/profiles/25452496/goals\"}},{\"id\":\"14477724\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-6/profiles/14477724\",\"accountId\":\"1189765\",\"webPropertyId\":\"UA-1189765-6\",\"internalWebPropertyId\":\"13754386\",\"name\":\"support.winepos.com\",\"currency\":\"USD\",\"timezone\":\"America/New_York\",\"created\":\"2009-01-26T08:07:43.000Z\",\"updated\":\"2010-12-06T03:49:52.760Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-6\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-6/profiles/14477724/goals\"}},{\"id\":\"15248675\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-7/profiles/15248675\",\"accountId\":\"1189765\",\"webPropertyId\":\"UA-1189765-7\",\"internalWebPropertyId\":\"14461610\",\"name\":\"docketapp.com\",\"currency\":\"USD\",\"timezone\":\"America/New_York\",\"siteSearchQueryParameters\":\"q\",\"created\":\"2009-02-20T06:09:03.000Z\",\"updated\":\"2011-09-26T20:19:47.315Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-7\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-7/profiles/15248675/goals\"}},{\"id\":\"19421498\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-8/profiles/19421498\",\"accountId\":\"1189765\",\"webPropertyId\":\"UA-1189765-8\",\"internalWebPropertyId\":\"21308442\",\"name\":\"wineistasty.com\",\"currency\":\"USD\",\"timezone\":\"America/New_York\",\"siteSearchQueryParameters\":\"q\",\"created\":\"2009-07-06T15:44:17.000Z\",\"updated\":\"2011-09-26T20:19:47.227Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-8\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-8/profiles/19421498/goals\"}},{\"id\":\"7720327\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-1/profiles/7720327\",\"accountId\":\"3879168\",\"webPropertyId\":\"UA-3879168-1\",\"internalWebPropertyId\":\"7432935\",\"name\":\"t.pitale.com\",\"currency\":\"USD\",\"timezone\":\"America/New_York\",\"created\":\"2008-03-15T00:03:57.000Z\",\"updated\":\"2010-09-28T04:03:42.319Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-1\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-1/profiles/7720327/goals\"}},{\"id\":\"37972320\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-10/profiles/37972320\",\"accountId\":\"3879168\",\"webPropertyId\":\"UA-3879168-10\",\"internalWebPropertyId\":\"38375108\",\"name\":\"spotcardapp.com\",\"currency\":\"USD\",\"timezone\":\"America/Los_Angeles\",\"created\":\"2010-10-17T23:16:40.554Z\",\"updated\":\"2010-10-29T19:11:27.320Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-10\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-10/profiles/37972320/goals\"}},{\"id\":\"38185730\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-11/profiles/38185730\",\"accountId\":\"3879168\",\"webPropertyId\":\"UA-3879168-11\",\"internalWebPropertyId\":\"38569868\",\"name\":\"finaleapp.com\",\"currency\":\"USD\",\"timezone\":\"America/Los_Angeles\",\"created\":\"2010-10-23T02:04:43.481Z\",\"updated\":\"2010-10-24T04:07:42.155Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-11\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-11/profiles/38185730/goals\"}},{\"id\":\"10464199\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-3/profiles/10464199\",\"accountId\":\"3879168\",\"webPropertyId\":\"UA-3879168-3\",\"internalWebPropertyId\":\"10020447\",\"name\":\"focusapp.com\",\"currency\":\"USD\",\"timezone\":\"America/New_York\",\"created\":\"2008-08-04T16:02:27.000Z\",\"updated\":\"2010-09-28T04:03:42.312Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-3\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-3/profiles/10464199/goals\"}},{\"id\":\"15062304\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/7471517/webproperties/UA-7471517-1/profiles/15062304\",\"accountId\":\"7471517\",\"webPropertyId\":\"UA-7471517-1\",\"internalWebPropertyId\":\"14290287\",\"name\":\"feedstitch.com\",\"currency\":\"USD\",\"timezone\":\"America/New_York\",\"created\":\"2009-02-13T22:39:47.000Z\",\"updated\":\"2011-10-04T19:45:15.181Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/7471517/webproperties/UA-7471517-1\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/7471517/webproperties/UA-7471517-1/profiles/15062304/goals\"}},{\"id\":\"24123052\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/11917142/webproperties/UA-11917142-1/profiles/24123052\",\"accountId\":\"11917142\",\"webPropertyId\":\"UA-11917142-1\",\"internalWebPropertyId\":\"25585435\",\"name\":\"datamapper.org\",\"currency\":\"USD\",\"timezone\":\"America/Vancouver\",\"created\":\"2009-12-04T15:16:05.000Z\",\"updated\":\"2011-07-03T14:25:49.395Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/11917142/webproperties/UA-11917142-1\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/11917142/webproperties/UA-11917142-1/profiles/24123052/goals\"}},{\"id\":\"34402746\",\"kind\":\"analytics#profile\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/17306519/webproperties/UA-17306519-1/profiles/34402746\",\"accountId\":\"17306519\",\"webPropertyId\":\"UA-17306519-1\",\"internalWebPropertyId\":\"35071373\",\"name\":\"vg3c.com\",\"currency\":\"USD\",\"timezone\":\"America/Los_Angeles\",\"created\":\"2010-07-06T01:00:00.390Z\",\"updated\":\"2010-07-06T08:28:37.881Z\",\"parentLink\":{\"type\":\"analytics#webproperty\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/17306519/webproperties/UA-17306519-1\"},\"childLink\":{\"type\":\"analytics#goals\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/17306519/webproperties/UA-17306519-1/profiles/34402746/goals\"}}]}","http_version":null},"recorded_at":"Mon, 12 Dec 2011 01:51:14 GMT"}],"recorded_with":"VCR 2.0.0.beta2"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties","body":"","headers":{"Authorization":["Bearer ya29.AHES6ZSw3j6NfON_gJdtG6bHrU4bh3gPsRd945judH-Umg"]}},"response":{"status":{"code":200,"message":null},"headers":{"expires":["Mon, 12 Dec 2011 01:50:58 GMT"],"date":["Mon, 12 Dec 2011 01:50:58 GMT"],"cache-control":["private, max-age=0, must-revalidate, no-transform"],"etag":["\"0EbX2LGJDld9q3PnatPaRNNGQuE/S5ErJ7IbSKINt7rcrab8XkGZd64\""],"content-type":["application/json; charset=UTF-8"],"x-content-type-options":["nosniff"],"x-frame-options":["SAMEORIGIN"],"x-xss-protection":["1; mode=block"],"server":["GSE"],"connection":["close"]},"body":"{\"kind\":\"analytics#webproperties\",\"username\":\"tpitale@gmail.com\",\"totalResults\":11,\"startIndex\":1,\"itemsPerPage\":1000,\"items\":[{\"id\":\"UA-1189765-4\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-4\",\"accountId\":\"1189765\",\"internalWebPropertyId\":\"4382400\",\"name\":\"http://www.ics-nj.com\",\"websiteUrl\":\"http://www.ics-nj.com\",\"created\":\"2007-08-15T20:52:48.000Z\",\"updated\":\"2010-03-02T16:09:09.095Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-4/profiles\"}},{\"id\":\"UA-1189765-6\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-6\",\"accountId\":\"1189765\",\"internalWebPropertyId\":\"13754386\",\"name\":\"http://support.winepos.com\",\"websiteUrl\":\"http://support.winepos.com\",\"created\":\"2009-01-26T08:07:43.000Z\",\"updated\":\"2010-03-02T16:09:09.094Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-6/profiles\"}},{\"id\":\"UA-1189765-7\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-7\",\"accountId\":\"1189765\",\"internalWebPropertyId\":\"14461610\",\"name\":\"http://docketapp.com\",\"websiteUrl\":\"http://docketapp.com\",\"created\":\"2009-02-20T06:09:03.000Z\",\"updated\":\"2010-03-02T16:09:09.094Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-7/profiles\"}},{\"id\":\"UA-1189765-8\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-8\",\"accountId\":\"1189765\",\"internalWebPropertyId\":\"21308442\",\"name\":\"http://wineistasty.com\",\"websiteUrl\":\"http://wineistasty.com\",\"created\":\"2009-07-06T15:44:17.000Z\",\"updated\":\"2010-03-02T16:09:09.092Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/1189765/webproperties/UA-1189765-8/profiles\"}},{\"id\":\"UA-3879168-1\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-1\",\"accountId\":\"3879168\",\"internalWebPropertyId\":\"7432935\",\"name\":\"http://t.pitale.com\",\"websiteUrl\":\"http://t.pitale.com\",\"created\":\"2008-03-15T00:03:57.000Z\",\"updated\":\"2010-03-02T16:36:02.883Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-1/profiles\"}},{\"id\":\"UA-3879168-10\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-10\",\"accountId\":\"3879168\",\"internalWebPropertyId\":\"38375108\",\"name\":\"http://spotcardapp.com\",\"websiteUrl\":\"http://spotcardapp.com\",\"created\":\"2010-10-17T23:16:40.547Z\",\"updated\":\"2010-10-17T23:16:40.552Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-10/profiles\"}},{\"id\":\"UA-3879168-11\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-11\",\"accountId\":\"3879168\",\"internalWebPropertyId\":\"38569868\",\"name\":\"http://finaleapp.com\",\"websiteUrl\":\"http://finaleapp.com\",\"created\":\"2010-10-23T02:04:43.475Z\",\"updated\":\"2010-10-23T02:04:43.477Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-11/profiles\"}},{\"id\":\"UA-3879168-3\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-3\",\"accountId\":\"3879168\",\"internalWebPropertyId\":\"10020447\",\"name\":\"http://focusapp.com\",\"websiteUrl\":\"http://focusapp.com\",\"created\":\"2008-08-04T16:02:27.000Z\",\"updated\":\"2010-03-02T16:36:02.883Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/3879168/webproperties/UA-3879168-3/profiles\"}},{\"id\":\"UA-7471517-1\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/7471517/webproperties/UA-7471517-1\",\"accountId\":\"7471517\",\"internalWebPropertyId\":\"14290287\",\"name\":\"http://feedstitch.com\",\"websiteUrl\":\"http://feedstitch.com\",\"created\":\"2009-02-13T22:39:47.000Z\",\"updated\":\"2010-03-02T17:17:20.401Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/7471517\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/7471517/webproperties/UA-7471517-1/profiles\"}},{\"id\":\"UA-11917142-1\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/11917142/webproperties/UA-11917142-1\",\"accountId\":\"11917142\",\"internalWebPropertyId\":\"25585435\",\"name\":\"http://datamapper.org\",\"websiteUrl\":\"http://datamapper.org\",\"created\":\"2009-12-04T15:16:05.000Z\",\"updated\":\"2010-03-02T18:03:58.576Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/11917142\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/11917142/webproperties/UA-11917142-1/profiles\"}},{\"id\":\"UA-17306519-1\",\"kind\":\"analytics#webproperty\",\"selfLink\":\"https://www.googleapis.com/analytics/v3/management/accounts/17306519/webproperties/UA-17306519-1\",\"accountId\":\"17306519\",\"internalWebPropertyId\":\"35071373\",\"name\":\"http://vg3c.com\",\"websiteUrl\":\"http://vg3c.com\",\"created\":\"2010-07-06T01:00:00.386Z\",\"updated\":\"2010-07-06T01:00:00.386Z\",\"parentLink\":{\"type\":\"analytics#account\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/17306519\"},\"childLink\":{\"type\":\"analytics#profiles\",\"href\":\"https://www.googleapis.com/analytics/v3/management/accounts/17306519/webproperties/UA-17306519-1/profiles\"}}]}","http_version":null},"recorded_at":"Mon, 12 Dec 2011 01:51:14 GMT"}],"recorded_with":"VCR 2.0.0.beta2"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A4506212&dimensions=ga%3AoperatingSystem&metrics=ga%3Apageviews%2Cga%3Aexits&start-date=2011-11-25&end-date=2011-12-25","body":"","headers":{"Authorization":["Bearer ya29.AHES6ZREobGegWLc3tyxuuQAkKF7lg071UgpTeLe_4jTcV35uW8"]}},"response":{"status":{"code":200,"message":null},"headers":{"expires":["Sun, 25 Dec 2011 17:10:39 GMT"],"date":["Sun, 25 Dec 2011 17:10:39 GMT"],"cache-control":["private, max-age=0, must-revalidate, no-transform"],"etag":["\"0EbX2LGJDld9q3PnatPaRNNGQuE/BN2gqmtHuRze0Z-7OmYT8n75tHA\""],"content-type":["application/json; charset=UTF-8"],"x-content-type-options":["nosniff"],"x-frame-options":["SAMEORIGIN"],"x-xss-protection":["1; mode=block"],"server":["GSE"],"connection":["close"]},"body":"{\"kind\":\"analytics#gaData\",\"id\":\"https://www.googleapis.com/analytics/v3/data/ga?ids=ga:4506212&dimensions=ga:operatingSystem&metrics=ga:pageviews,ga:exits&start-date=2011-11-25&end-date=2011-12-25&start-index=1&max-results=1000\",\"query\":{\"start-date\":\"2011-11-25\",\"end-date\":\"2011-12-25\",\"ids\":\"ga:4506212\",\"dimensions\":\"ga:operatingSystem\",\"metrics\":[\"ga:pageviews\",\"ga:exits\"],\"start-index\":1,\"max-results\":1000},\"itemsPerPage\":1000,\"totalResults\":10,\"selfLink\":\"https://www.googleapis.com/analytics/v3/data/ga?ids=ga:4506212&dimensions=ga:operatingSystem&metrics=ga:pageviews,ga:exits&start-date=2011-11-25&end-date=2011-12-25&start-index=1&max-results=1000\",\"profileInfo\":{\"profileId\":\"4506212\",\"accountId\":\"1189765\",\"webPropertyId\":\"UA-1189765-4\",\"internalWebPropertyId\":\"4382400\",\"profileName\":\"winepos.com\",\"tableId\":\"ga:4506212\"},\"containsSampledData\":false,\"columnHeaders\":[{\"name\":\"ga:operatingSystem\",\"columnType\":\"DIMENSION\",\"dataType\":\"STRING\"},{\"name\":\"ga:pageviews\",\"columnType\":\"METRIC\",\"dataType\":\"INTEGER\"},{\"name\":\"ga:exits\",\"columnType\":\"METRIC\",\"dataType\":\"INTEGER\"}],\"totalsForAllResults\":{\"ga:pageviews\":\"3560\",\"ga:exits\":\"1714\"},\"rows\":[[\"(not set)\",\"15\",\"11\"],[\"Android\",\"79\",\"71\"],[\"BlackBerry\",\"3\",\"2\"],[\"Linux\",\"10\",\"7\"],[\"Macintosh\",\"412\",\"169\"],[\"Windows\",\"2896\",\"1382\"],[\"Windows Phone\",\"1\",\"1\"],[\"iPad\",\"100\",\"49\"],[\"iPhone\",\"43\",\"21\"],[\"iPod\",\"1\",\"1\"]]}","http_version":null},"recorded_at":"Sun, 25 Dec 2011 17:10:58 GMT"},{"request":{"method":"get","uri":"https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A4506212&dimensions=ga%3AoperatingSystem&metrics=ga%3Apageviews%2Cga%3Aexits&start-date=2011-11-26&end-date=2011-12-26","body":"","headers":{"Authorization":["Bearer ya29.AHES6ZREobGegWLc3tyxuuQAkKF7lg071UgpTeLe_4jTcV35uW8"]}},"response":{"status":{"code":401,"message":null},"headers":{"www-authenticate":["AuthSub realm=\"https://www.google.com/accounts/AuthSubRequest\" allowed-scopes=\"https://www.googleapis.com/auth/analytics.readonly\""],"content-type":["application/json; charset=UTF-8"],"date":["Mon, 26 Dec 2011 17:09:58 GMT"],"expires":["Mon, 26 Dec 2011 17:09:58 GMT"],"cache-control":["private, max-age=0"],"x-content-type-options":["nosniff"],"x-frame-options":["SAMEORIGIN"],"x-xss-protection":["1; mode=block"],"server":["GSE"],"connection":["close"]},"body":"{\"error\":{\"errors\":[{\"domain\":\"global\",\"reason\":\"authError\",\"message\":\"Invalid Credentials\",\"locationType\":\"header\",\"location\":\"Authorization\"}],\"code\":401,\"message\":\"Invalid Credentials\"}}","http_version":null},"recorded_at":"Mon, 26 Dec 2011 17:10:19 GMT"}],"recorded_with":"VCR 2.0.0.beta2"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"analytics#gaData","id":"https://www.googleapis.com/analytics/v3/data/ga?ids=ga:4506212&dimensions=ga:browser&metrics=ga:pageviews&start-date=2011-12-12&end-date=2012-01-11&start-index=1&max-results=1000","query":{"start-date":"2011-12-12","end-date":"2012-01-11","ids":"ga:4506212","dimensions":"ga:browser","metrics":["ga:pageviews"],"start-index":1,"max-results":1000},"itemsPerPage":1000,"totalResults":13,"selfLink":"https://www.googleapis.com/analytics/v3/data/ga?ids=ga:4506212&dimensions=ga:browser&metrics=ga:pageviews&start-date=2011-12-12&end-date=2012-01-11&start-index=1&max-results=1000","profileInfo":{"profileId":"4506212","accountId":"1189765","webPropertyId":"UA-1189765-4","internalWebPropertyId":"4382400","profileName":"winepos.com","tableId":"ga:4506212"},"containsSampledData":false,"columnHeaders":[{"name":"ga:browser","columnType":"DIMENSION","dataType":"STRING"},{"name":"ga:pageviews","columnType":"METRIC","dataType":"INTEGER"}],"totalsForAllResults":{"ga:pageviews":"3710"},"rows":[["Android Browser","93"],["BlackBerry8530","1"],["Chrome","557"],["Firefox","860"],["IE with Chrome Frame","7"],["Internet Explorer","1698"],["Mozilla","18"],["Mozilla Compatible Agent","8"],["Netscape","1"],["Opera","10"],["Opera 9.4","5"],["RockMelt","2"],["Safari","450"]]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Management" do
|
|
4
|
+
before :each do
|
|
5
|
+
@user = Legato::User.new(access_token)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
context "Management::Account" do
|
|
9
|
+
use_vcr_cassette 'management/accounts'
|
|
10
|
+
|
|
11
|
+
it 'has accounts' do
|
|
12
|
+
accounts = Legato::Management::Account.all(@user)
|
|
13
|
+
accounts.map(&:id).should == ["1189765", "3879168", "7471517", "11360836", "11917142", "17306519"]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
context "Management::WebProperty" do
|
|
18
|
+
use_vcr_cassette 'management/web_properties'
|
|
19
|
+
|
|
20
|
+
it 'has web properties' do
|
|
21
|
+
web_properties = Legato::Management::WebProperty.all(@user)
|
|
22
|
+
web_properties.map(&:id).include?("UA-1189765-4").should == true
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context "Management::Profile" do
|
|
27
|
+
use_vcr_cassette 'management/profiles'
|
|
28
|
+
|
|
29
|
+
it 'has profiles' do
|
|
30
|
+
profiles = Legato::Management::Profile.all(@user)
|
|
31
|
+
profiles.map(&:id).include?("4506212").should == true
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
class ModelTest
|
|
4
|
+
extend Legato::Model
|
|
5
|
+
|
|
6
|
+
metrics :pageviews, :exits
|
|
7
|
+
dimensions :operating_system
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe 'Legato::Model' do
|
|
11
|
+
context "A class extended with Legato::Model" do
|
|
12
|
+
use_vcr_cassette 'model/basic'
|
|
13
|
+
|
|
14
|
+
it 'returns results for the metrics and dimensions' do
|
|
15
|
+
user = Legato::User.new(access_token)
|
|
16
|
+
profile = Legato::Management::Profile.new({'id' => 4506212, 'name' => 'Some Site'}, user)
|
|
17
|
+
ModelTest.results(profile).should_not be_nil
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Legato::Filter do
|
|
4
|
+
context "a Filter instance" do
|
|
5
|
+
before :each do
|
|
6
|
+
@filter = Legato::Filter.new(:exits, :lt, 1000)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'has a field' do
|
|
10
|
+
@filter.field.should == :exits
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'has a google field' do
|
|
14
|
+
Legato.stubs(:to_ga_string).returns("ga:exits")
|
|
15
|
+
@filter.google_field.should == "ga:exits"
|
|
16
|
+
Legato.should have_received(:to_ga_string)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'has an operator' do
|
|
20
|
+
@filter.operator.should == :lt
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'has a google operator' do
|
|
24
|
+
@filter.google_operator.should == "<"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'has a value' do
|
|
28
|
+
@filter.value.should == 1000
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'has a default join character' do
|
|
32
|
+
@filter.join_character.should == ';'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'represents itself as a parameter' do
|
|
36
|
+
@filter.to_param.should == "ga:exits<1000"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'joins with another filter' do
|
|
40
|
+
filter2 = Legato::Filter.new(:pageviews, :gt, 1000, ',')
|
|
41
|
+
|
|
42
|
+
filter2.join_with(@filter.to_param).should == "ga:exits<1000,ga:pageviews>1000"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'returns to_param if joining with nil' do
|
|
46
|
+
@filter.join_with(nil).should == @filter.to_param
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|