metrika 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/lib/metrika.rb CHANGED
@@ -3,7 +3,10 @@ METRIKA_PATH = File.dirname(__FILE__) + '/metrika/'
3
3
  require METRIKA_PATH + 'helpers'
4
4
  require METRIKA_PATH + 'ext'
5
5
 
6
- require METRIKA_PATH + 'api/methods'
6
+ require METRIKA_PATH + 'api/counters'
7
+ require METRIKA_PATH + 'api/goals'
8
+ require METRIKA_PATH + 'api/statistics'
9
+
7
10
  require METRIKA_PATH + 'client'
8
11
  require METRIKA_PATH + 'errors'
9
12
 
@@ -0,0 +1,41 @@
1
+ module Metrika
2
+ module Api
3
+ module Counters
4
+ def get_counters
5
+ self.get(self.counters_path)['counters']
6
+ end
7
+
8
+ def create_counter(params)
9
+ self.post(self.counters_path, params)['counter']
10
+ end
11
+
12
+ def counters_path
13
+ "/counters"
14
+ end
15
+
16
+ def get_counter(id)
17
+ self.get(self.counter_path(id))['counter']
18
+ end
19
+
20
+ def update_counter(id, params)
21
+ self.put(self.counter_path(id), params)['counter']
22
+ end
23
+
24
+ def delete_counter(id)
25
+ self.delete(self.counter_path(id))['counter']
26
+ end
27
+
28
+ def counter_path(id)
29
+ "/counter/#{id}"
30
+ end
31
+
32
+ def check_counter(id)
33
+ self.get(self.counter_check_path(id))['counter']
34
+ end
35
+
36
+ def counter_check_path(id)
37
+ "/counter/#{id}/check"
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,33 @@
1
+ module Metrika
2
+ module Api
3
+ module Goals
4
+ def get_counter_goals(counter_id)
5
+ self.get(self.counter_goals_path(counter_id))['goals']
6
+ end
7
+
8
+ def create_counter_goal(counter_id, params)
9
+ self.post(self.counter_goals_path(counter_id), params)['goals']
10
+ end
11
+
12
+ def counter_goals_path(counter_id)
13
+ "/counter/#{counter_id}/goals"
14
+ end
15
+
16
+ def get_counter_goal(counter_id, id)
17
+ self.get(self.counter_goal_path(counter_id, id))['goal']
18
+ end
19
+
20
+ def update_counter_goal(counter_id, id, params)
21
+ self.put(self.counter_goal_path(counter_id, id), params)['goal']
22
+ end
23
+
24
+ def delete_counter_goal(counter_id, id)
25
+ self.delete(self.counter_goal_path(counter_id, id))['goal']
26
+ end
27
+
28
+ def counter_goal_path(counter_id, id)
29
+ "/counter/#{counter_id}/goal/#{id}"
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,342 @@
1
+ module Metrika
2
+ module Api
3
+ module Statistics
4
+
5
+ # Traffic
6
+ def get_counter_stat_traffic_summary(id, params = {})
7
+ params = self.format_params(params)
8
+
9
+ self.get(self.counter_stat_traffic_summary_path, params.merge(:id => id))
10
+ end
11
+
12
+ def counter_stat_traffic_summary_path
13
+ "/stat/traffic/summary"
14
+ end
15
+
16
+ def get_counter_stat_traffic_deepness(id, params = {})
17
+ params = self.format_params(params)
18
+
19
+ self.get(self.counter_stat_traffic_deepness_path, params.merge(:id => id))
20
+ end
21
+
22
+ def counter_stat_traffic_deepness_path
23
+ "/stat/traffic/deepness"
24
+ end
25
+
26
+ def get_counter_stat_traffic_hourly(id, params = {})
27
+ params = self.format_params(params)
28
+
29
+ self.get(self.counter_stat_traffic_hourly_path, params.merge(:id => id))
30
+ end
31
+
32
+ def counter_stat_traffic_hourly_path
33
+ "/stat/traffic/hourly"
34
+ end
35
+
36
+ def get_counter_stat_traffic_load(id, params = {})
37
+ params = self.format_params(params)
38
+
39
+ self.get(self.counter_stat_traffic_load_path, params.merge(:id => id))
40
+ end
41
+
42
+ def counter_stat_traffic_load_path
43
+ "/stat/traffic/load"
44
+ end
45
+
46
+ # Sources
47
+ def get_counter_stat_sources_summary(id, params = {})
48
+ params = self.format_params(params)
49
+
50
+ self.get(self.counter_stat_sources_summary_path, params.merge(:id => id))
51
+ end
52
+
53
+ def counter_stat_sources_summary_path
54
+ "/stat/sources/summary"
55
+ end
56
+
57
+ def get_counter_stat_sources_sites(id, params = {})
58
+ params = self.format_params(params)
59
+
60
+ self.get(self.counter_stat_sources_sites_path, params.merge(:id => id))
61
+ end
62
+
63
+ def counter_stat_sources_sites_path
64
+ "/stat/sources/sites"
65
+ end
66
+
67
+ def get_counter_stat_sources_search_engines(id, params = {})
68
+ params = self.format_params(params)
69
+
70
+ self.get(self.counter_stat_sources_search_engines_path, params.merge(:id => id))
71
+ end
72
+
73
+ def counter_stat_sources_search_engines_path
74
+ "/stat/sources/search_engines"
75
+ end
76
+
77
+ def get_counter_stat_sources_phrases(id, params = {})
78
+ params = self.format_params(params)
79
+
80
+ self.get(self.counter_stat_sources_phrases_path, params.merge(:id => id))
81
+ end
82
+
83
+ def counter_stat_sources_phrases_path
84
+ "/stat/sources/phrases"
85
+ end
86
+
87
+ def get_counter_stat_sources_marketing(id, params = {})
88
+ params = self.format_params(params)
89
+
90
+ self.get(self.counter_stat_sources_marketing_path, params.merge(:id => id))
91
+ end
92
+
93
+ def counter_stat_sources_marketing_path
94
+ "/stat/sources/marketing"
95
+ end
96
+
97
+ def get_counter_stat_sources_direct_summary(id, params = {})
98
+ params = self.format_params(params)
99
+
100
+ self.get(self.counter_stat_sources_direct_summary_path, params.merge(:id => id))
101
+ end
102
+
103
+ def counter_stat_sources_direct_summary_path
104
+ "/stat/sources/direct/summary"
105
+ end
106
+
107
+ def get_counter_stat_sources_direct_platforms(id, params = {})
108
+ params = self.format_params(params)
109
+
110
+ self.get(self.counter_stat_sources_direct_platforms_path, params.merge(:id => id))
111
+ end
112
+
113
+ def counter_stat_sources_direct_platforms_path
114
+ "/stat/sources/direct/platforms"
115
+ end
116
+
117
+ def get_counter_stat_sources_direct_regions(id, params = {})
118
+ params = self.format_params(params)
119
+
120
+ self.get(self.counter_stat_sources_direct_regions_path, params.merge(:id => id))
121
+ end
122
+
123
+ def counter_stat_sources_direct_regions_path
124
+ "/stat/sources/direct/regions"
125
+ end
126
+
127
+ def get_counter_stat_sources_tags(id, params = {})
128
+ params = self.format_params(params)
129
+
130
+ self.get(self.counter_stat_sources_tags_path, params.merge(:id => id))
131
+ end
132
+
133
+ def counter_stat_sources_tags_path
134
+ "/stat/sources/tags"
135
+ end
136
+
137
+ # Content
138
+ def get_counter_stat_content_popular(id, params = {})
139
+ params = self.format_params(params)
140
+
141
+ self.get(self.counter_stat_content_popular_path, params.merge(:id => id))
142
+ end
143
+
144
+ def counter_stat_content_popular_path
145
+ "/stat/content/popular"
146
+ end
147
+
148
+ def get_counter_stat_content_entrance(id, params = {})
149
+ params = self.format_params(params)
150
+
151
+ self.get(self.counter_stat_content_entrance_path, params.merge(:id => id))
152
+ end
153
+
154
+ def counter_stat_content_entrance_path
155
+ "/stat/content/entrance"
156
+ end
157
+
158
+ def get_counter_stat_content_exit(id, params = {})
159
+ params = self.format_params(params)
160
+
161
+ self.get(self.counter_stat_content_exit_path, params.merge(:id => id))
162
+ end
163
+
164
+ def counter_stat_content_exit_path
165
+ "/stat/content/exit"
166
+ end
167
+
168
+ def get_counter_stat_content_titles(id, params = {})
169
+ params = self.format_params(params)
170
+
171
+ self.get(self.counter_stat_content_titles_path, params.merge(:id => id))
172
+ end
173
+
174
+ def counter_stat_content_titles_path
175
+ "/stat/content/titles"
176
+ end
177
+
178
+ def get_counter_stat_content_url_param(id, params = {})
179
+ params = self.format_params(params)
180
+
181
+ self.get(self.counter_stat_content_url_param_path, params.merge(:id => id))
182
+ end
183
+
184
+ def counter_stat_content_url_param_path
185
+ "/stat/content/url_param"
186
+ end
187
+
188
+ def get_counter_stat_content_user_vars(id, params = {})
189
+ params = self.format_params(params)
190
+
191
+ self.get(self.counter_stat_content_user_vars_path, params.merge(:id => id))
192
+ end
193
+
194
+ def counter_stat_content_user_vars_path
195
+ "/stat/content/user_vars"
196
+ end
197
+
198
+ def get_counter_stat_content_ecommerce(id, params = {})
199
+ params = self.format_params(params)
200
+
201
+ self.get(self.counter_stat_content_ecommerce_path, params.merge(:id => id))
202
+ end
203
+
204
+ def counter_stat_content_ecommerce_path
205
+ "/stat/content/ecommerce"
206
+ end
207
+
208
+ # Geo
209
+ def get_counter_stat_geo(id, params = {})
210
+ params = self.format_params(params)
211
+
212
+ self.get(self.counter_stat_geo_path, params.merge(:id => id))
213
+ end
214
+
215
+ def counter_stat_geo_path
216
+ "/stat/geo"
217
+ end
218
+
219
+ # Demography
220
+ def get_counter_stat_demography_age_gender(id, params = {})
221
+ params = self.format_params(params)
222
+
223
+ self.get(self.counter_stat_demography_age_gender_path, params.merge(:id => id))
224
+ end
225
+
226
+ def counter_stat_demography_age_gender_path
227
+ "/stat/demography/age_gender"
228
+ end
229
+
230
+ def get_counter_stat_demography_structure(id, params = {})
231
+ params = self.format_params(params)
232
+
233
+ self.get(self.counter_stat_demography_structure_path, params.merge(:id => id))
234
+ end
235
+
236
+ def counter_stat_demography_structure_path
237
+ "/stat/demography/structure"
238
+ end
239
+
240
+ # Tech
241
+ def get_counter_stat_tech_browsers(id, params = {})
242
+ params = self.format_params(params)
243
+
244
+ self.get(self.counter_stat_tech_browsers_path, params.merge(:id => id))
245
+ end
246
+
247
+ def counter_stat_tech_browsers_path
248
+ "/stat/tech/browsers"
249
+ end
250
+
251
+ def get_counter_stat_tech_os(id, params = {})
252
+ params = self.format_params(params)
253
+
254
+ self.get(self.counter_stat_tech_os_path, params.merge(:id => id))
255
+ end
256
+
257
+ def counter_stat_tech_os_path
258
+ "/stat/tech/os"
259
+ end
260
+
261
+ def get_counter_stat_tech_display(id, params = {})
262
+ params = self.format_params(params)
263
+
264
+ self.get(self.counter_stat_tech_display_path, params.merge(:id => id))
265
+ end
266
+
267
+ def counter_stat_tech_display_path
268
+ "/stat/tech/display"
269
+ end
270
+
271
+ def get_counter_stat_tech_mobile(id, params = {})
272
+ params = self.format_params(params)
273
+
274
+ self.get(self.counter_stat_tech_mobile_path, params.merge(:id => id))
275
+ end
276
+
277
+ def counter_stat_tech_mobile_path
278
+ "/stat/tech/mobile"
279
+ end
280
+
281
+ def get_counter_stat_tech_flash(id, params = {})
282
+ params = self.format_params(params)
283
+
284
+ self.get(self.counter_stat_tech_flash_path, params.merge(:id => id))
285
+ end
286
+
287
+ def counter_stat_tech_flash_path
288
+ "/stat/tech/flash"
289
+ end
290
+
291
+ def get_counter_stat_tech_silverlight(id, params = {})
292
+ params = self.format_params(params)
293
+
294
+ self.get(self.counter_stat_tech_silverlight_path, params.merge(:id => id))
295
+ end
296
+
297
+ def counter_stat_tech_silverlight_path
298
+ "/stat/tech/silverlight"
299
+ end
300
+
301
+ def get_counter_stat_tech_dotnet(id, params = {})
302
+ params = self.format_params(params)
303
+
304
+ self.get(self.counter_stat_tech_dotnet_path, params.merge(:id => id))
305
+ end
306
+
307
+ def counter_stat_tech_dotnet_path
308
+ "/stat/tech/dotnet"
309
+ end
310
+
311
+ def get_counter_stat_tech_java(id, params = {})
312
+ params = self.format_params(params)
313
+
314
+ self.get(self.counter_stat_tech_java_path, params.merge(:id => id))
315
+ end
316
+
317
+ def counter_stat_tech_java_path
318
+ "/stat/tech/java"
319
+ end
320
+
321
+ def get_counter_stat_tech_cookies(id, params = {})
322
+ params = self.format_params(params)
323
+
324
+ self.get(self.counter_stat_tech_cookies_path, params.merge(:id => id))
325
+ end
326
+
327
+ def counter_stat_tech_cookies_path
328
+ "/stat/tech/cookies"
329
+ end
330
+
331
+ def get_counter_stat_tech_javascript(id, params = {})
332
+ params = self.format_params(params)
333
+
334
+ self.get(self.counter_stat_tech_javascript_path, params.merge(:id => id))
335
+ end
336
+
337
+ def counter_stat_tech_javascript_path
338
+ "/stat/tech/javascript"
339
+ end
340
+ end
341
+ end
342
+ end
@@ -2,7 +2,9 @@ module Metrika
2
2
  class Client
3
3
  include Helpers
4
4
 
5
- include Api::Methods
5
+ include Api::Counters
6
+ include Api::Goals
7
+ include Api::Statistics
6
8
 
7
9
  def initialize(application_id = Metrika.application_id, application_password = Metrika.application_password)
8
10
  @application_id = application_id
data/metrika.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "metrika"
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Igor Alexandrov"]
12
- s.date = "2012-09-25"
12
+ s.date = "2012-09-26"
13
13
  s.email = "igor.alexandrov@gmail.com"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -24,7 +24,9 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "lib/metrika.rb",
27
- "lib/metrika/api/methods.rb",
27
+ "lib/metrika/api/counters.rb",
28
+ "lib/metrika/api/goals.rb",
29
+ "lib/metrika/api/statistics.rb",
28
30
  "lib/metrika/client.rb",
29
31
  "lib/metrika/errors.rb",
30
32
  "lib/metrika/ext.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metrika
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-25 00:00:00.000000000 Z
12
+ date: 2012-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
@@ -123,7 +123,9 @@ files:
123
123
  - Rakefile
124
124
  - VERSION
125
125
  - lib/metrika.rb
126
- - lib/metrika/api/methods.rb
126
+ - lib/metrika/api/counters.rb
127
+ - lib/metrika/api/goals.rb
128
+ - lib/metrika/api/statistics.rb
127
129
  - lib/metrika/client.rb
128
130
  - lib/metrika/errors.rb
129
131
  - lib/metrika/ext.rb
@@ -148,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
150
  version: '0'
149
151
  segments:
150
152
  - 0
151
- hash: -3176208076306458523
153
+ hash: 4316303954739533584
152
154
  required_rubygems_version: !ruby/object:Gem::Requirement
153
155
  none: false
154
156
  requirements:
@@ -1,83 +0,0 @@
1
- module Metrika
2
- module Api
3
- module Methods
4
-
5
- # Counters
6
- def get_counters
7
- self.get(self.counters_path)['counters']
8
- end
9
-
10
- def create_counter(params)
11
- self.post(self.counters_path, params)['counter']
12
- end
13
-
14
- def counters_path
15
- "/counters"
16
- end
17
-
18
- def get_counter(id)
19
- self.get(self.counter_path(id))['counter']
20
- end
21
-
22
- def update_counter(id, params)
23
- self.put(self.counter_path(id), params)['counter']
24
- end
25
-
26
- def delete_counter(id)
27
- self.delete(self.counter_path(id))['counter']
28
- end
29
-
30
- def counter_path(id)
31
- "/counter/#{id}"
32
- end
33
-
34
- def check_counter(id)
35
- self.get(self.counter_check_path(id))['counter']
36
- end
37
-
38
- def counter_check_path(id)
39
- "/counter/#{id}/check"
40
- end
41
-
42
- # Counter goals
43
- def get_counter_goals(counter_id)
44
- self.get(self.counter_goals_path(counter_id))['goals']
45
- end
46
-
47
- def create_counter_goal(counter_id, params)
48
- self.post(self.counter_goals_path(counter_id), params)['goals']
49
- end
50
-
51
- def counter_goals_path(counter_id)
52
- "/counter/#{counter_id}/goals"
53
- end
54
-
55
- def get_counter_goal(counter_id, id)
56
- self.get(self.counter_goal_path(counter_id, id))['goal']
57
- end
58
-
59
- def update_counter_goal(counter_id, id, params)
60
- self.put(self.counter_goal_path(counter_id, id), params)['goal']
61
- end
62
-
63
- def delete_counter_goal(counter_id, id)
64
- self.delete(self.counter_goal_path(counter_id, id))['goal']
65
- end
66
-
67
- def counter_goal_path(counter_id, id)
68
- "/counter/#{counter_id}/goal/#{id}"
69
- end
70
-
71
- # Statistics
72
- def get_counter_stat_traffic_summary(id, params = {})
73
- params = self.format_params(params)
74
-
75
- self.get(self.counter_stat_traffic_summary_path, params.merge(:id => id))
76
- end
77
-
78
- def counter_stat_traffic_summary_path
79
- "/stat/traffic/summary"
80
- end
81
- end
82
- end
83
- end