metrika 0.0.4 → 0.0.5
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/.travis.yml +4 -0
- data/Gemfile +6 -1
- data/Gemfile.lock +9 -1
- data/README.md +4 -0
- data/Rakefile +1 -8
- data/VERSION +1 -1
- data/lib/metrika.rb +1 -1
- data/lib/metrika/api/resources.rb +37 -0
- data/lib/metrika/api/statistics.rb +42 -303
- data/lib/metrika/client.rb +1 -4
- data/metrika.gemspec +9 -8
- data/spec/cases/metrika_spec.rb +28 -0
- data/spec/helper.rb +18 -0
- metadata +9 -8
- data/lib/metrika/api/goals.rb +0 -33
- data/test/helper.rb +0 -18
- data/test/test_metrika.rb +0 -7
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -4,6 +4,8 @@ GEM
|
|
4
4
|
activesupport (3.2.8)
|
5
5
|
i18n (~> 0.6)
|
6
6
|
multi_json (~> 1.0)
|
7
|
+
addressable (2.3.2)
|
8
|
+
crack (0.3.1)
|
7
9
|
faraday (0.8.4)
|
8
10
|
multipart-post (~> 1.1)
|
9
11
|
git (1.2.5)
|
@@ -35,15 +37,21 @@ GEM
|
|
35
37
|
shoulda-context (1.0.0)
|
36
38
|
shoulda-matchers (1.3.0)
|
37
39
|
activesupport (>= 3.0.0)
|
40
|
+
vcr (2.2.5)
|
41
|
+
webmock (1.8.10)
|
42
|
+
addressable (>= 2.2.7)
|
43
|
+
crack (>= 0.1.7)
|
38
44
|
yajl-ruby (1.1.0)
|
39
45
|
|
40
46
|
PLATFORMS
|
41
47
|
ruby
|
42
48
|
|
43
49
|
DEPENDENCIES
|
44
|
-
bundler (~> 1.1
|
50
|
+
bundler (~> 1.2.1)
|
45
51
|
jeweler (~> 1.8.4)
|
46
52
|
oauth2
|
47
53
|
rdoc (~> 3.12)
|
48
54
|
shoulda
|
55
|
+
vcr
|
56
|
+
webmock
|
49
57
|
yajl-ruby
|
data/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[](http://travis-ci.org/igor-alexandrov/metrika)
|
2
|
+
[](http://gemnasium.com/igor-alexandrov/metrika)
|
3
|
+
[](https://codeclimate.com/github/igor-alexandrov/metrika)
|
4
|
+
|
1
5
|
Metrika
|
2
6
|
=======
|
3
7
|
|
data/Rakefile
CHANGED
@@ -24,14 +24,7 @@ Jeweler::Tasks.new do |gem|
|
|
24
24
|
end
|
25
25
|
Jeweler::RubygemsDotOrgTasks.new
|
26
26
|
|
27
|
-
|
28
|
-
Rake::TestTask.new(:test) do |test|
|
29
|
-
test.libs << 'lib' << 'test'
|
30
|
-
test.pattern = 'test/**/test_*.rb'
|
31
|
-
test.verbose = true
|
32
|
-
end
|
33
|
-
|
34
|
-
task :default => :test
|
27
|
+
task :default => :install
|
35
28
|
|
36
29
|
require 'rdoc/task'
|
37
30
|
Rake::RDocTask.new do |rdoc|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/metrika.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Metrika
|
2
|
+
module Api
|
3
|
+
module Resources
|
4
|
+
%w( goal filter operation grant ).each do |resource|
|
5
|
+
resources = "#{resource}s"
|
6
|
+
|
7
|
+
define_method "get_counter_#{resources}" do | counter_id |
|
8
|
+
self.get(self.send("counter_#{resources}_path", counter_id))[resources]
|
9
|
+
end
|
10
|
+
|
11
|
+
define_method "create_counter_#{resource}" do | counter_id, params |
|
12
|
+
self.post(self.send("counter_#{resources}_path", counter_id), params)[resources]
|
13
|
+
end
|
14
|
+
|
15
|
+
define_method "counter_#{resources}_path" do | counter_id |
|
16
|
+
"/counter/#{counter_id}/#{resources}"
|
17
|
+
end
|
18
|
+
|
19
|
+
define_method "get_counter_#{resource}" do | counter_id, id |
|
20
|
+
self.get(self.send("counter_#{resource}_path", counter_id, id))[resource]
|
21
|
+
end
|
22
|
+
|
23
|
+
define_method "update_counter_#{resource}" do | counter_id, id, params |
|
24
|
+
self.put(self.send("counter_#{resource}_path", counter_id, id), params)[resource]
|
25
|
+
end
|
26
|
+
|
27
|
+
define_method "delete_counter_#{resource}" do | counter_id, id |
|
28
|
+
self.delete(self.send("counter_#{resource}_path", counter_id, id))[resource]
|
29
|
+
end
|
30
|
+
|
31
|
+
define_method "counter_#{resource}_path" do | counter_id, id |
|
32
|
+
"/counter/#{counter_id}/#{resource}/#{id}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,208 +1,43 @@
|
|
1
1
|
module Metrika
|
2
2
|
module Api
|
3
3
|
module Statistics
|
4
|
-
|
5
4
|
# Traffic
|
6
|
-
|
7
|
-
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
|
5
|
+
%w( summary deepness hourly load ).each do |report|
|
6
|
+
define_method "get_counter_stat_traffic_#{report}" do | id, params = {} |
|
7
|
+
params = self.format_params(params)
|
25
8
|
|
26
|
-
|
27
|
-
|
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
|
9
|
+
self.get(self.send("counter_stat_traffic_#{report}_path"), params.merge(:id => id))
|
10
|
+
end
|
35
11
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
self.get(self.counter_stat_traffic_load_path, params.merge(:id => id))
|
12
|
+
define_method "counter_stat_traffic_#{report}_path" do
|
13
|
+
"/stat/traffic/#{report}"
|
14
|
+
end
|
40
15
|
end
|
41
16
|
|
42
|
-
def counter_stat_traffic_load_path
|
43
|
-
"/stat/traffic/load"
|
44
|
-
end
|
45
|
-
|
46
17
|
# Sources
|
47
|
-
|
48
|
-
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
|
18
|
+
%w( summary sites search_engines phrases marketing direct_summary direct_platforms direct_regions tags ).each do |report|
|
19
|
+
define_method "get_counter_stat_sources_#{report}" do | id, params = {} |
|
20
|
+
params = self.format_params(params)
|
56
21
|
|
57
|
-
|
58
|
-
|
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
|
22
|
+
self.get(self.send("counter_stat_sources_#{report}_path"), params.merge(:id => id))
|
23
|
+
end
|
92
24
|
|
93
|
-
|
94
|
-
|
95
|
-
|
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"
|
25
|
+
define_method "counter_stat_sources_#{report}_path" do
|
26
|
+
"/stat/sources/#{report}"
|
27
|
+
end
|
135
28
|
end
|
136
29
|
|
137
30
|
# Content
|
138
|
-
|
139
|
-
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
|
31
|
+
%w( popular entrance exit titles url_param user_vars ecommerce ).each do |report|
|
32
|
+
define_method "get_counter_stat_content_#{report}" do | id, params = {} |
|
33
|
+
params = self.format_params(params)
|
187
34
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
self.get(self.counter_stat_content_user_vars_path, params.merge(:id => id))
|
192
|
-
end
|
35
|
+
self.get(self.send("counter_stat_content_#{report}_path"), params.merge(:id => id))
|
36
|
+
end
|
193
37
|
|
194
|
-
|
195
|
-
|
196
|
-
|
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"
|
38
|
+
define_method "counter_stat_content_#{report}_path" do
|
39
|
+
"/stat/content/#{report}"
|
40
|
+
end
|
206
41
|
end
|
207
42
|
|
208
43
|
# Geo
|
@@ -216,127 +51,31 @@ module Metrika
|
|
216
51
|
"/stat/geo"
|
217
52
|
end
|
218
53
|
|
219
|
-
# Demography
|
220
|
-
|
221
|
-
params =
|
54
|
+
# Demography
|
55
|
+
%w( age_gender structure ).each do |report|
|
56
|
+
define_method "get_counter_stat_demography_#{report}" do | id, params = {} |
|
57
|
+
params = self.format_params(params)
|
222
58
|
|
223
|
-
|
224
|
-
|
59
|
+
self.get(self.send("counter_stat_demography_#{report}_path"), params.merge(:id => id))
|
60
|
+
end
|
225
61
|
|
226
|
-
|
227
|
-
|
228
|
-
|
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"
|
62
|
+
define_method "counter_stat_demography_#{report}_path" do
|
63
|
+
"/stat/demography/#{report}"
|
64
|
+
end
|
238
65
|
end
|
239
66
|
|
240
67
|
# Tech
|
241
|
-
|
242
|
-
params =
|
68
|
+
%w( browsers os display mobile flash silverlight dotnet java cookies javascript ).each do |report|
|
69
|
+
define_method "get_counter_stat_tech_#{report}" do | id, params = {} |
|
70
|
+
params = self.format_params(params)
|
243
71
|
|
244
|
-
|
245
|
-
|
72
|
+
self.get(self.send("counter_stat_tech_#{report}_path"), params.merge(:id => id))
|
73
|
+
end
|
246
74
|
|
247
|
-
|
248
|
-
|
249
|
-
|
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
|
75
|
+
define_method "counter_stat_tech_#{report}_path" do
|
76
|
+
"/stat/tech/#{report}"
|
77
|
+
end
|
78
|
+
end
|
340
79
|
end
|
341
80
|
end
|
342
81
|
end
|
data/lib/metrika/client.rb
CHANGED
@@ -3,7 +3,7 @@ module Metrika
|
|
3
3
|
include Helpers
|
4
4
|
|
5
5
|
include Api::Counters
|
6
|
-
include Api::
|
6
|
+
include Api::Resources
|
7
7
|
include Api::Statistics
|
8
8
|
|
9
9
|
def initialize(application_id = Metrika.application_id, application_password = Metrika.application_password)
|
@@ -11,8 +11,5 @@ module Metrika
|
|
11
11
|
@application_password = application_password
|
12
12
|
end
|
13
13
|
|
14
|
-
protected
|
15
|
-
|
16
|
-
|
17
14
|
end
|
18
15
|
end
|
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.
|
8
|
+
s.version = "0.0.5"
|
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-
|
12
|
+
s.date = "2012-10-24"
|
13
13
|
s.email = "igor.alexandrov@gmail.com"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".document",
|
20
|
+
".travis.yml",
|
20
21
|
"Gemfile",
|
21
22
|
"Gemfile.lock",
|
22
23
|
"LICENSE.txt",
|
@@ -25,7 +26,7 @@ Gem::Specification.new do |s|
|
|
25
26
|
"VERSION",
|
26
27
|
"lib/metrika.rb",
|
27
28
|
"lib/metrika/api/counters.rb",
|
28
|
-
"lib/metrika/api/
|
29
|
+
"lib/metrika/api/resources.rb",
|
29
30
|
"lib/metrika/api/statistics.rb",
|
30
31
|
"lib/metrika/client.rb",
|
31
32
|
"lib/metrika/errors.rb",
|
@@ -34,8 +35,8 @@ Gem::Specification.new do |s|
|
|
34
35
|
"lib/metrika/helpers/authorization.rb",
|
35
36
|
"lib/metrika/helpers/request.rb",
|
36
37
|
"metrika.gemspec",
|
37
|
-
"
|
38
|
-
"
|
38
|
+
"spec/cases/metrika_spec.rb",
|
39
|
+
"spec/helper.rb"
|
39
40
|
]
|
40
41
|
s.homepage = "http://github.com/igor-alexandrov/metrika"
|
41
42
|
s.licenses = ["MIT"]
|
@@ -51,14 +52,14 @@ Gem::Specification.new do |s|
|
|
51
52
|
s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
|
52
53
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
53
54
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
54
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.1
|
55
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.2.1"])
|
55
56
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
56
57
|
else
|
57
58
|
s.add_dependency(%q<oauth2>, [">= 0"])
|
58
59
|
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
59
60
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
60
61
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
61
|
-
s.add_dependency(%q<bundler>, ["~> 1.1
|
62
|
+
s.add_dependency(%q<bundler>, ["~> 1.2.1"])
|
62
63
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
63
64
|
end
|
64
65
|
else
|
@@ -66,7 +67,7 @@ Gem::Specification.new do |s|
|
|
66
67
|
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
67
68
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
68
69
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
69
|
-
s.add_dependency(%q<bundler>, ["~> 1.1
|
70
|
+
s.add_dependency(%q<bundler>, ["~> 1.2.1"])
|
70
71
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
71
72
|
end
|
72
73
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Metrika do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
Metrika.application_id = nil
|
7
|
+
Metrika.application_password = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be able to set the consumer token and consumer secret" do
|
11
|
+
Metrika.application_id = 'consumer_token'
|
12
|
+
Metrika.application_password = 'consumer_secret'
|
13
|
+
|
14
|
+
Metrika.application_id.should == 'consumer_token'
|
15
|
+
Metrika.application_password.should == 'consumer_secret'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be able to set the consumer token and consumer secret via a configure block" do
|
19
|
+
Metrika.configure do |config|
|
20
|
+
config.application_id = 'consumer_token'
|
21
|
+
config.application_password = 'consumer_secret'
|
22
|
+
end
|
23
|
+
|
24
|
+
Metrika.application_id.should == 'consumer_token'
|
25
|
+
Metrika.application_password.should == 'consumer_secret'
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/spec/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
require 'metrika'
|
5
|
+
require 'rspec'
|
6
|
+
require 'webmock/rspec'
|
7
|
+
require 'vcr'
|
8
|
+
|
9
|
+
VCR.configure do |c|
|
10
|
+
c.cassette_library_dir = 'spec/fixtures/cassettes'
|
11
|
+
c.hook_into(:webmock)
|
12
|
+
c.ignore_localhost = true
|
13
|
+
c.default_cassette_options = { :record => :none }
|
14
|
+
end
|
15
|
+
|
16
|
+
RSpec.configure do |c|
|
17
|
+
c.extend VCR::RSpec::Macros
|
18
|
+
end
|
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.
|
4
|
+
version: 0.0.5
|
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-
|
12
|
+
date: 2012-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.1
|
85
|
+
version: 1.2.1
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.1
|
93
|
+
version: 1.2.1
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: jeweler
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +116,7 @@ extra_rdoc_files:
|
|
116
116
|
- README.md
|
117
117
|
files:
|
118
118
|
- .document
|
119
|
+
- .travis.yml
|
119
120
|
- Gemfile
|
120
121
|
- Gemfile.lock
|
121
122
|
- LICENSE.txt
|
@@ -124,7 +125,7 @@ files:
|
|
124
125
|
- VERSION
|
125
126
|
- lib/metrika.rb
|
126
127
|
- lib/metrika/api/counters.rb
|
127
|
-
- lib/metrika/api/
|
128
|
+
- lib/metrika/api/resources.rb
|
128
129
|
- lib/metrika/api/statistics.rb
|
129
130
|
- lib/metrika/client.rb
|
130
131
|
- lib/metrika/errors.rb
|
@@ -133,8 +134,8 @@ files:
|
|
133
134
|
- lib/metrika/helpers/authorization.rb
|
134
135
|
- lib/metrika/helpers/request.rb
|
135
136
|
- metrika.gemspec
|
136
|
-
-
|
137
|
-
-
|
137
|
+
- spec/cases/metrika_spec.rb
|
138
|
+
- spec/helper.rb
|
138
139
|
homepage: http://github.com/igor-alexandrov/metrika
|
139
140
|
licenses:
|
140
141
|
- MIT
|
@@ -150,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
151
|
version: '0'
|
151
152
|
segments:
|
152
153
|
- 0
|
153
|
-
hash:
|
154
|
+
hash: -4269113441857894452
|
154
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
156
|
none: false
|
156
157
|
requirements:
|
data/lib/metrika/api/goals.rb
DELETED
@@ -1,33 +0,0 @@
|
|
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
|
data/test/helper.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'test/unit'
|
11
|
-
require 'shoulda'
|
12
|
-
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
-
require 'metrika'
|
16
|
-
|
17
|
-
class Test::Unit::TestCase
|
18
|
-
end
|