PageRenderTime 29ms CodeModel.GetById 2ms app.highlight 25ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Analytics/GDataQueryAnalytics.m

http://macfuse.googlecode.com/
Objective C | 139 lines | 92 code | 30 blank | 17 comment | 1 complexity | 7ada2a3f35817be3cb6b7632c36160ee MD5 | raw file
  1/* Copyright (c) 2009 Google Inc.
  2 *
  3 * Licensed under the Apache License, Version 2.0 (the "License");
  4 * you may not use this file except in compliance with the License.
  5 * You may obtain a copy of the License at
  6 *
  7 *     http://www.apache.org/licenses/LICENSE-2.0
  8 *
  9 * Unless required by applicable law or agreed to in writing, software
 10 * distributed under the License is distributed on an "AS IS" BASIS,
 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12 * See the License for the specific language governing permissions and
 13 * limitations under the License.
 14 */
 15
 16//
 17//  GDataQueryAnalytics.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE
 21
 22#import "GDataQueryAnalytics.h"
 23
 24static NSString *const kDimensionsParamName = @"dimensions";
 25static NSString *const kMetricsParamName    = @"metrics";
 26static NSString *const kStartDateParamName  = @"start-date";
 27static NSString *const kEndDateParamName    = @"end-date";
 28static NSString *const kFiltersParamName    = @"filters";
 29static NSString *const kIDsParamName        = @"ids";
 30static NSString *const kSortParamName       = @"sort";
 31static NSString *const kSegmentParamName    = @"segment";
 32
 33@implementation GDataQueryAnalytics
 34
 35+ (GDataQueryAnalytics *)analyticsQueryWithFeedURL:(NSURL *)feedURL {
 36  return [self queryWithFeedURL:feedURL];
 37}
 38
 39+ (GDataQueryAnalytics *)analyticsDataQueryWithTableID:(NSString *)tableID
 40                                       startDateString:(NSString *)startDateStr
 41                                         endDateString:(NSString *)endDateStr {
 42
 43  NSString *const kDataURI = @"https://www.google.com/analytics/feeds/data";
 44
 45  NSURL *dataURL = [NSURL URLWithString:kDataURI];
 46
 47  GDataQueryAnalytics *query = [self analyticsQueryWithFeedURL:dataURL];
 48  [query setIDs:tableID];
 49  [query setStartDateString:startDateStr];
 50  [query setEndDateString:endDateStr];
 51  return query;
 52}
 53
 54#pragma mark -
 55
 56
 57- (void)setDimensions:(NSString *)str {
 58  [self addCustomParameterWithName:kDimensionsParamName
 59                             value:str];
 60}
 61
 62- (NSString *)dimensions {
 63  NSString *str = [self valueForParameterWithName:kDimensionsParamName];
 64  return str;
 65}
 66
 67- (void)setMetrics:(NSString *)str {
 68  [self addCustomParameterWithName:kMetricsParamName
 69                             value:str];
 70}
 71
 72- (NSString *)metrics {
 73  NSString *str = [self valueForParameterWithName:kMetricsParamName];
 74  return str;
 75}
 76
 77- (void)setStartDateString:(NSString *)str {
 78  [self addCustomParameterWithName:kStartDateParamName
 79                             value:str];
 80}
 81
 82- (NSString *)startDateString {
 83  NSString *str = [self valueForParameterWithName:kStartDateParamName];
 84  return str;
 85}
 86
 87- (void)setEndDateString:(NSString *)str {
 88  [self addCustomParameterWithName:kEndDateParamName
 89                             value:str];
 90}
 91
 92- (NSString *)endDateString {
 93  NSString *str = [self valueForParameterWithName:kEndDateParamName];
 94  return str;
 95}
 96
 97- (void)setFilters:(NSString *)str {
 98  [self addCustomParameterWithName:kFiltersParamName
 99                             value:str];
100}
101
102- (NSString *)filters {
103  NSString *str = [self valueForParameterWithName:kFiltersParamName];
104  return str;
105}
106
107- (void)setIDs:(NSString *)str {
108  [self addCustomParameterWithName:kIDsParamName
109                             value:str];
110}
111
112- (NSString *)IDs {
113  NSString *str = [self valueForParameterWithName:kIDsParamName];
114  return str;
115}
116
117- (void)setSort:(NSString *)str {
118  [self addCustomParameterWithName:kSortParamName
119                             value:str];
120}
121
122- (NSString *)sort {
123  NSString *str = [self valueForParameterWithName:kSortParamName];
124  return str;
125}
126
127- (void)setSegment:(NSString *)str {
128  [self addCustomParameterWithName:kSegmentParamName
129                             value:str];
130}
131
132- (NSString *)segment {
133  NSString *str = [self valueForParameterWithName:kSegmentParamName];
134  return str;
135}
136
137@end
138
139#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE