metrika 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
File without changes
data/README.md CHANGED
@@ -2,47 +2,158 @@
2
2
  [![Dependency Status](https://gemnasium.com/igor-alexandrov/metrika.png)](http://gemnasium.com/igor-alexandrov/metrika)
3
3
  [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/igor-alexandrov/metrika)
4
4
 
5
- Metrika
6
- =======
5
+ # Metrika
7
6
 
8
- Wrapper for Yandex.Metrika API
7
+ Wrapper for [Yandex.Metrika](http://metrika.yandex.ru/) API. Gem provides easy-to-use methods to work with counters, goals, filters, operations, grants and statistics.
9
8
 
10
9
  Inspired by [Wynn Netherland's LinkedIn Gem](https://github.com/pengwynn/linkedin).
11
10
 
12
- # Info
11
+ [API Documentation](http://api.yandex.ru/metrika/doc/ref/concepts/About.xml)
13
12
 
14
- **Under heavy development!**
13
+ ## Installation
15
14
 
16
- # JSON API
15
+ [sudo] gem install linkedin
17
16
 
18
- c = Metrika::Client.new('your_app_id', 'your_app_password')
17
+ ## Usage JSON API
19
18
 
20
- # if you don't have token yet
21
- c.authorization_url
22
- c.authorize_token('authorization_code')
19
+ ### Authentication
23
20
 
24
- # if you alredy have token
25
- c.restore_token('token_code')
21
+ Yandex's API uses Oauth for authentication. Luckily, the Yandex gem hides most of the details from you.
26
22
 
27
- # counters
28
- c.get_counters
29
- c.creater_counter(params)
30
- c.get_counter(id)
31
- c.update_counter(id, params)
32
- c.delete_counter(id)
33
- c.check_counter(id)
23
+ If you have never used Metrika API or you want to change your authentication credentials or your authorization token expired, then you should create new one:
24
+
25
+ require 'rubygems'
26
+ require 'metrika'
34
27
 
35
- #goals
36
- c.get_counter_goals(counter_id)
37
- c.create_counter_goal(counter_id, params)
38
- c.create_counter_goal(counter_id, params)
39
- c.get_counter_goal(counter_id, id)
40
- c.update_counter_goal(counter_id, id, params)
41
- c.delete_counter_goal(counter_id, id)
28
+ # get your API credentials at https://oauth.yandex.ru/
29
+ client = Metrika::Client.new('your_app_id', 'your_app_password')
42
30
 
43
- #stats
44
- c.get_counter_stat_traffic_summary(1131265, :group => :month, :date1 => Date.parse('20110925'), :date2 => Date.today)
31
+ client.authorization_url
32
+ => "https://oauth.yandex.ru/authorize?response_type=code&client_id=<your_app_id>"
45
33
 
46
- # Object API
34
+ # follow the authrization url
35
+ # you will be redirected to the callback url, specified in your application settings
36
+ # user authorization code from params to get authorization token
37
+ client.authorize_token(params[:code])
47
38
 
48
- Later…
39
+ # if no error is raised then you are free to use any API method
40
+
41
+ If you want to restore previously used authrization token, it is done easily too:
42
+
43
+ require 'rubygems'
44
+ require 'metrika'
45
+
46
+ # get your API credentials at https://oauth.yandex.ru/
47
+ client = Metrika::Client.new('your_app_id', 'your_app_password')
48
+
49
+ client.restore_token('token_code')
50
+
51
+ ### Counters
52
+
53
+ client.get_counters
54
+ client.creater_counter(params)
55
+ client.get_counter(id)
56
+ client.update_counter(id, params)
57
+ client.delete_counter(id)
58
+ client.check_counter(id)
59
+
60
+ ### Goals, filters, operations, grants
61
+
62
+ client.get_counter_goals(counter_id)
63
+ client.create_counter_goal(counter_id, params)
64
+ client.get_counter_goal(counter_id, id)
65
+ client.update_counter_goal(counter_id, id, params)
66
+ client.delete_counter_goal(counter_id, id)
67
+
68
+ client.get_counter_filters(counter_id)
69
+ client.create_counter_filter(counter_id, params)
70
+ client.get_counter_filter(counter_id, id)
71
+ client.update_counter_filter(counter_id, id, params)
72
+ client.delete_counter_filter(counter_id, id)
73
+
74
+ client.get_counter_operations(counter_id)
75
+ client.create_counter_operation(counter_id, params)
76
+ client.get_counter_operation(counter_id, id)
77
+ client.update_counter_operation(counter_id, id, params)
78
+ client.delete_counter_operation(counter_id, id)
79
+
80
+ client.get_counter_grants(counter_id)
81
+ client.create_counter_grant(counter_id, params)
82
+ client.get_counter_grant(counter_id, id)
83
+ client.update_counter_grant(counter_id, id, params)
84
+ client.delete_counter_grant(counter_id, id)
85
+
86
+ ### Statistics
87
+
88
+ Statistics is the most wonderful part of Yandex.Metrika and it is fully available in Metrika gem.
89
+ All statistics reports support :date1 and :date2 parameters among other parameters.
90
+
91
+ **Traffic**
92
+
93
+ client.get_counter_stat_traffic_summary(counter_id, :group => :month, :date1 => Date.parse('20110925'), :date2 => Date.today)
94
+ client.get_counter_stat_traffic_deepness(counter_id, :date1 => Date.parse('20110925'), :date2 => Date.today)
95
+ client.get_counter_stat_traffic_hourly(counter_id, params)
96
+ client.get_counter_stat_traffic_load(counter_id, params)
97
+
98
+ **Sources**
99
+
100
+ client.get_counter_stat_sources_summary(counter_id, params)
101
+ client.get_counter_stat_sources_sites(counter_id, params)
102
+ client.get_counter_stat_sources_search_engines(counter_id, params)
103
+ client.get_counter_stat_sources_phrases(counter_id, params)
104
+ client.get_counter_stat_sources_marketing(counter_id, params)
105
+ client.get_counter_stat_sources_direct_summary(counter_id, params)
106
+ client.get_counter_stat_sources_direct_platforms(counter_id, params)
107
+ client.get_counter_stat_sources_direct_regions(counter_id, params)
108
+ client.get_counter_stat_sources_tags(counter_id, params)
109
+
110
+ **Content**
111
+
112
+ client.get_counter_stat_content_popular(counter_id, params)
113
+ client.get_counter_stat_content_entrance(counter_id, params)
114
+ client.get_counter_stat_content_exit(counter_id, params)
115
+ client.get_counter_stat_content_titles(counter_id, params)
116
+ client.get_counter_stat_content_url_param(counter_id, params)
117
+ client.get_counter_stat_content_user_vars(counter_id, params)
118
+ client.get_counter_stat_content_ecommerce(counter_id, params)
119
+
120
+ **Geo**
121
+
122
+ client.get_counter_stat_geo(counter_id, params)
123
+
124
+ **Demography**
125
+
126
+ client.get_counter_stat_demography_age_gender(counter_id, params)
127
+ client.get_counter_stat_demography_structure(counter_id, params)
128
+
129
+ **Tech**
130
+
131
+ client.get_counter_stat_tech_browsers(counter_id, params)
132
+ client.get_counter_stat_tech_os(counter_id, params)
133
+ client.get_counter_stat_tech_display(counter_id, params)
134
+ client.get_counter_stat_tech_mobile(counter_id, params)
135
+ client.get_counter_stat_tech_flash(counter_id, params)
136
+ client.get_counter_stat_tech_silverlight(counter_id, params)
137
+ client.get_counter_stat_tech_dotnet(counter_id, params)
138
+ client.get_counter_stat_tech_java(counter_id, params)
139
+ client.get_counter_stat_tech_cookies(counter_id, params)
140
+ client.get_counter_stat_tech_javascript(counter_id, params)
141
+
142
+ ## Usage – Object API
143
+
144
+ Under development…
145
+
146
+ ## Note on Patches / Pull Requests
147
+
148
+ * Fork the project.
149
+ * Make your feature addition or bug fix.
150
+ * Add tests for it. This is important so I don't break it in a
151
+ future version unintentionally.
152
+ * Commit, do not mess with rakefile, version, or history.
153
+ (if you want to have your own version, that is fine but
154
+ bump version in a commit by itself I can ignore when I pull)
155
+ * Send me a pull request. Bonus points for topic branches.
156
+
157
+ ## Copyright
158
+
159
+ Copyright (c) 2009-11 [Igor Alexandrov](http://igor-alexandrov.github.com/). See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.1.0
data/metrika.gemspec CHANGED
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "metrika"
8
- s.version = "0.0.5"
8
+ s.version = "0.1.0"
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-10-24"
12
+ s.date = "2012-10-25"
13
13
  s.email = "igor.alexandrov@gmail.com"
14
14
  s.extra_rdoc_files = [
15
- "LICENSE.txt",
15
+ "LICENSE",
16
16
  "README.md"
17
17
  ]
18
18
  s.files = [
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  ".travis.yml",
21
21
  "Gemfile",
22
22
  "Gemfile.lock",
23
- "LICENSE.txt",
23
+ "LICENSE",
24
24
  "README.md",
25
25
  "Rakefile",
26
26
  "VERSION",
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.5
4
+ version: 0.1.0
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-10-24 00:00:00.000000000 Z
12
+ date: 2012-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
@@ -112,14 +112,14 @@ email: igor.alexandrov@gmail.com
112
112
  executables: []
113
113
  extensions: []
114
114
  extra_rdoc_files:
115
- - LICENSE.txt
115
+ - LICENSE
116
116
  - README.md
117
117
  files:
118
118
  - .document
119
119
  - .travis.yml
120
120
  - Gemfile
121
121
  - Gemfile.lock
122
- - LICENSE.txt
122
+ - LICENSE
123
123
  - README.md
124
124
  - Rakefile
125
125
  - VERSION
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: -4269113441857894452
154
+ hash: -1087403569314908613
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  none: false
157
157
  requirements: