yandex_metric 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Rakefile +13 -2
- data/VERSION +1 -1
- data/lib/yandex_metric.rb +2 -2
- data/lib/yandex_metric_methods.rb +45 -45
- data/spec/yandex_metric_spec.rb +37 -0
- data/yandex_metric.gemspec +6 -2
- metadata +15 -3
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -41,8 +41,6 @@ Rcov::RcovTask.new do |test|
|
|
41
41
|
test.rcov_opts << '--exclude "gems/*"'
|
42
42
|
end
|
43
43
|
|
44
|
-
task :default => :test
|
45
|
-
|
46
44
|
require 'rdoc/task'
|
47
45
|
Rake::RDocTask.new do |rdoc|
|
48
46
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
@@ -52,3 +50,16 @@ Rake::RDocTask.new do |rdoc|
|
|
52
50
|
rdoc.rdoc_files.include('README*')
|
53
51
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
52
|
end
|
53
|
+
|
54
|
+
require 'rspec/core'
|
55
|
+
require 'rspec/core/rake_task'
|
56
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
57
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
58
|
+
end
|
59
|
+
|
60
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
61
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
62
|
+
spec.rcov = true
|
63
|
+
end
|
64
|
+
|
65
|
+
task :default => :spec
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1
|
1
|
+
0.1.1
|
data/lib/yandex_metric.rb
CHANGED
@@ -3,7 +3,7 @@ require 'net/http'
|
|
3
3
|
require 'cgi'
|
4
4
|
require 'json'
|
5
5
|
|
6
|
-
module
|
6
|
+
module Yandex
|
7
7
|
SSL_PORT = 443
|
8
8
|
TIMEOUT = 50
|
9
9
|
|
@@ -52,7 +52,7 @@ module YM
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
class
|
55
|
+
class Metric
|
56
56
|
OAUTH_HOST = 'oauth.yandex.ru'
|
57
57
|
OAUTH_PORT = SSL_PORT
|
58
58
|
OAUTH_PATH = '/token'
|
@@ -1,46 +1,46 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
1
|
+
module Yandex
|
2
|
+
Metric.api_method 'Список счетчиков','/counters','GET POST','-'
|
3
|
+
Metric.api_method 'Счетчик','/counter/{id}','GET PUT DELETE','id ― числовой идентификатор счетчика.'
|
4
|
+
Metric.api_method 'Список целей счетчика','/counter/{id}/goals','GET POST','-'
|
5
|
+
Metric.api_method 'Цель счетчика','/counter/{id}/goal/{goal_id}','GET PUT DELETE','goal_id ― числовой идентификатор цели.'
|
6
|
+
Metric.api_method 'Список фильтров счетчика','/counter/{id}/filters','GET POST','filter_id ― числовой идентификатор фильтра.'
|
7
|
+
Metric.api_method 'Фильтр счетчика','/counter/{id}/filter/{filter_id}','GET PUT DELETE','filter_id ― числовой идентификатор фильтра.'
|
8
|
+
Metric.api_method 'Список операций счетчика','/counter/{id}/operations','GET POST','-'
|
9
|
+
Metric.api_method 'Операция счетчика','/counter/{id}/operation/{operation_id}','GET PUT DELETE','operation_id ― числовой идентификатор операции.'
|
10
|
+
Metric.api_method 'Список гостевых доступов счетчика','/counter/{id}/grants','GET POST','-'
|
11
|
+
Metric.api_method 'Право доступа к счетчику','/counter/{id}/grant/{user_login}','GET PUT DELETE','user_login ― логин пользователя, которому выдан гостевой доступ. Для публичной статистики вместо логина пользователя указывается «0».'
|
12
|
+
Metric.api_method 'Список собственных представителей','/delegates','GET PUT POST','-'
|
13
|
+
Metric.api_method 'Представитель','/delegate/{user_login}','DELETE','user_login ― логин пользователя, которому выдан полный доступ.'
|
14
|
+
Metric.api_method 'Список аккаунтов (прав на представительство)','/accounts','GET PUT','-'
|
15
|
+
Metric.api_method 'Аккаунт','/account/{user_login}','DELETE','user_login ― логин владельца аккаунта.'
|
16
|
+
Metric.api_method 'Посещаемость','stat/traffic/summary','GET'
|
17
|
+
Metric.api_method 'Вовлечение','stat/traffic/deepness','GET'
|
18
|
+
Metric.api_method 'По времени суток','stat/traffic/hourly','GET'
|
19
|
+
Metric.api_method 'Нагрузка на сайт','stat/traffic/load','GET'
|
20
|
+
Metric.api_method 'Сводка','stat/sources/summary','GET'
|
21
|
+
Metric.api_method 'Сайты','stat/sources/sites','GET'
|
22
|
+
Metric.api_method 'Поисковые системы','stat/sources/search_engines','GET'
|
23
|
+
Metric.api_method 'Поисковые фразы','stat/sources/phrases','GET'
|
24
|
+
Metric.api_method 'Рекламные системы','stat/sources/marketing','GET'
|
25
|
+
Metric.api_method 'Директ ― сводка','stat/sources/direct/summary','GET'
|
26
|
+
Metric.api_method 'Директ ― площадки','stat/sources/direct/platforms','GET'
|
27
|
+
Metric.api_method 'Директ ― регионы','stat/sources/direct/regions','GET'
|
28
|
+
Metric.api_method 'Метки','stat/sources/tags','GET'
|
29
|
+
Metric.api_method 'Популярное содержание','stat/content/popular','GET'
|
30
|
+
Metric.api_method 'Страницы входа','stat/content/entrance','GET'
|
31
|
+
Metric.api_method 'Страницы выхода','stat/content/exit','GET'
|
32
|
+
Metric.api_method 'Заголовки страниц','stat/content/titles','GET'
|
33
|
+
Metric.api_method 'Параметры URL','stat/content/url_param','GET'
|
34
|
+
Metric.api_method 'Отчет по Странам мира','stat/geo','GET'
|
35
|
+
Metric.api_method 'Пол и возраст','stat/demography/age_gender','GET'
|
36
|
+
Metric.api_method 'Половозрастная структура','stat/demography/structure','GET'
|
37
|
+
Metric.api_method 'Браузеры','stat/tech/browsers','GET'
|
38
|
+
Metric.api_method 'Операционные системы','stat/tech/os','GET'
|
39
|
+
Metric.api_method 'Разрешения дисплеев','stat/tech/display','GET'
|
40
|
+
Metric.api_method 'Мобильные устройства','stat/tech/mobile','GET'
|
41
|
+
Metric.api_method 'Версии Flash','stat/tech/flash','GET'
|
42
|
+
Metric.api_method 'Версии Silverlight','stat/tech/silverlight','GET'
|
43
|
+
Metric.api_method 'Версии .NET','stat/tech/dotnet','GET'
|
44
|
+
Metric.api_method 'Наличие Java','stat/tech/java','GET'
|
45
|
+
Metric.api_method 'Наличие Cookies','stat/tech/cookies','GET'
|
46
46
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'yandex_metric'
|
2
|
+
|
3
|
+
describe Yandex::Metric do
|
4
|
+
before(:each) do
|
5
|
+
@it = Yandex::Metric.new({})
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#method_name' do
|
9
|
+
it 'should downcase http method name' do
|
10
|
+
Yandex::Metric.method_name('GET', '/t').should eql('get_t')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should replace {name} from path' do
|
14
|
+
Yandex::Metric.method_name('GET', '/t/{asdas}/f').should eql('get_t_f')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#api_method' do
|
19
|
+
it 'should create multiple methods for different http method' do
|
20
|
+
Yandex::Metric.api_method 'description', '/test', 'GET POST', 'param desc'
|
21
|
+
@it.should respond_to(:get_test)
|
22
|
+
@it.should respond_to(:post_test)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should replace {id} from method path' do
|
26
|
+
Yandex::Metric.api_method 'description', '/f/{id}/s', 'POST', 'param desc'
|
27
|
+
@it.should respond_to(:post_f_s)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should ignore first slash in path' do
|
31
|
+
Yandex::Metric.api_method 'description', 'f', 'POST', 'param desc'
|
32
|
+
@it.should respond_to(:post_f)
|
33
|
+
Yandex::Metric.api_method 'description', '/s', 'POST', 'param desc'
|
34
|
+
@it.should respond_to(:post_s)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/yandex_metric.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "yandex_metric"
|
8
|
-
s.version = "0.1"
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["bskaplou"]
|
12
|
-
s.date = "2011-11-
|
12
|
+
s.date = "2011-11-18"
|
13
13
|
s.description = "YandexMetric hides OAuth from user and converts Yandex Metric REST methods into ruby methods"
|
14
14
|
s.email = "bskaplou@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"VERSION",
|
26
26
|
"lib/yandex_metric.rb",
|
27
27
|
"lib/yandex_metric_methods.rb",
|
28
|
+
"spec/yandex_metric_spec.rb",
|
28
29
|
"test/helper.rb",
|
29
30
|
"test/test_yandex_metric.rb",
|
30
31
|
"yandex_metric.gemspec"
|
@@ -43,17 +44,20 @@ Gem::Specification.new do |s|
|
|
43
44
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
44
45
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
45
46
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
46
48
|
else
|
47
49
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
48
50
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
51
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
50
52
|
s.add_dependency(%q<rcov>, [">= 0"])
|
53
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
51
54
|
end
|
52
55
|
else
|
53
56
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
54
57
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
58
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
56
59
|
s.add_dependency(%q<rcov>, [">= 0"])
|
60
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: yandex_metric
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- bskaplou
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-18 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: shoulda
|
@@ -56,6 +56,17 @@ dependencies:
|
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
58
|
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rspec
|
61
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *id005
|
59
70
|
description: YandexMetric hides OAuth from user and converts Yandex Metric REST methods into ruby methods
|
60
71
|
email: bskaplou@gmail.com
|
61
72
|
executables: []
|
@@ -74,6 +85,7 @@ files:
|
|
74
85
|
- VERSION
|
75
86
|
- lib/yandex_metric.rb
|
76
87
|
- lib/yandex_metric_methods.rb
|
88
|
+
- spec/yandex_metric_spec.rb
|
77
89
|
- test/helper.rb
|
78
90
|
- test/test_yandex_metric.rb
|
79
91
|
- yandex_metric.gemspec
|
@@ -90,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
102
|
requirements:
|
91
103
|
- - ">="
|
92
104
|
- !ruby/object:Gem::Version
|
93
|
-
hash:
|
105
|
+
hash: -450707565
|
94
106
|
segments:
|
95
107
|
- 0
|
96
108
|
version: "0"
|