metrika 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --format doc
data/README.md CHANGED
@@ -4,15 +4,23 @@
4
4
 
5
5
  # Metrika
6
6
 
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.
7
+ Wrapper for [Yandex.Metrika (RU)](http://metrika.yandex.ru/) API. Gem provides easy-to-use methods to work with counters, goals, filters, operations, grants and statistics.
8
8
 
9
- Inspired by [Wynn Netherland's LinkedIn Gem](https://github.com/pengwynn/linkedin).
9
+ **What is Metrika?**
10
+
11
+ * [Russian](http://help.yandex.ru/metrika/)
12
+ * [English](http://help.yandex.com/metrika/)
10
13
 
11
- [API Documentation](http://api.yandex.ru/metrika/doc/ref/concepts/About.xml)
14
+ **API Documentation**
15
+
16
+ * [Russian](http://api.yandex.ru/metrika/doc/ref/concepts/About.xml)
17
+ * [English](http://api.yandex.com/metrika/doc/ref/concepts/About.xml)
18
+
19
+ Inspired by [Wynn Netherland's LinkedIn Gem](https://github.com/pengwynn/linkedin).
12
20
 
13
21
  ## Installation
14
22
 
15
- [sudo] gem install linkedin
23
+ [sudo] gem install metrika
16
24
 
17
25
  ## Usage – JSON API
18
26
 
@@ -127,7 +135,7 @@ All statistics reports support :date1 and :date2 parameters among other paramete
127
135
  client.get_counter_stat_demography_structure(counter_id, params)
128
136
 
129
137
  **Tech**
130
-
138
+
131
139
  client.get_counter_stat_tech_browsers(counter_id, params)
132
140
  client.get_counter_stat_tech_os(counter_id, params)
133
141
  client.get_counter_stat_tech_display(counter_id, params)
@@ -156,4 +164,4 @@ Under development…
156
164
 
157
165
  ## Copyright
158
166
 
159
- Copyright (c) 2009-11 [Igor Alexandrov](http://igor-alexandrov.github.com/). See LICENSE for details.
167
+ Copyright (c) 2012 [Igor Alexandrov](http://igor-alexandrov.github.com/). See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/metrika.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "metrika"
8
- s.version = "0.1.0"
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 = ["Igor Alexandrov"]
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  "README.md"
17
17
  ]
18
18
  s.files = [
19
- ".document",
19
+ ".rspec",
20
20
  ".travis.yml",
21
21
  "Gemfile",
22
22
  "Gemfile.lock",
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  "lib/metrika/helpers/authorization.rb",
36
36
  "lib/metrika/helpers/request.rb",
37
37
  "metrika.gemspec",
38
+ "spec/cases/metrika/authorization_spec.rb",
38
39
  "spec/cases/metrika_spec.rb",
39
40
  "spec/helper.rb"
40
41
  ]
@@ -0,0 +1,42 @@
1
+ require 'helper'
2
+
3
+ describe Metrika do
4
+
5
+ before(:all) do
6
+ Metrika.configure do |config|
7
+ config.application_id = APPLICATION_ID
8
+ config.application_password = APPLICATION_PASSWORD
9
+ end
10
+ end
11
+
12
+ context '#authorization_url' do
13
+ before(:each) do
14
+ @client = Metrika::Client.new
15
+ end
16
+
17
+ it 'should look like authorization url' do
18
+ @client.authorization_url.should match /\Ahttps:\/\/oauth.yandex.ru\/authorize.+#{APPLICATION_ID}\z/
19
+ end
20
+ end
21
+
22
+ context '#restore_token' do
23
+ before(:each) do
24
+ @client = Metrika::Client.new
25
+ end
26
+
27
+ it 'should not raise an error' do
28
+ lambda {
29
+ @client.restore_token(ACCESS_TOKEN)
30
+ }.should_not raise_error
31
+ end
32
+
33
+ it 'should return a token' do
34
+ @client.restore_token(ACCESS_TOKEN).should_not == nil
35
+ end
36
+
37
+ it 'should be an instance of OAuth2::AccessToken' do
38
+ @client.restore_token(ACCESS_TOKEN).should be_an_instance_of(OAuth2::AccessToken)
39
+ end
40
+
41
+ end
42
+ end
@@ -2,27 +2,28 @@ require 'helper'
2
2
 
3
3
  describe Metrika do
4
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'
5
+ context 'Configuration' do
6
+ before(:each) do
7
+ Metrika.application_id = nil
8
+ Metrika.application_password = nil
9
+ end
13
10
 
14
- Metrika.application_id.should == 'consumer_token'
15
- Metrika.application_password.should == 'consumer_secret'
16
- end
11
+ it "should be able to set the consumer token and consumer secret" do
12
+ Metrika.application_id = APPLICATION_ID
13
+ Metrika.application_password = APPLICATION_PASSWORD
17
14
 
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'
15
+ Metrika.application_id.should == APPLICATION_ID
16
+ Metrika.application_password.should == APPLICATION_PASSWORD
22
17
  end
23
18
 
24
- Metrika.application_id.should == 'consumer_token'
25
- Metrika.application_password.should == 'consumer_secret'
26
- end
19
+ it "should be able to set the consumer token and consumer secret via a configure block" do
20
+ Metrika.configure do |config|
21
+ config.application_id = APPLICATION_ID
22
+ config.application_password = APPLICATION_PASSWORD
23
+ end
27
24
 
25
+ Metrika.application_id.should == APPLICATION_ID
26
+ Metrika.application_password.should == APPLICATION_PASSWORD
27
+ end
28
+ end
28
29
  end
data/spec/helper.rb CHANGED
@@ -15,4 +15,10 @@ end
15
15
 
16
16
  RSpec.configure do |c|
17
17
  c.extend VCR::RSpec::Macros
18
- end
18
+ end
19
+
20
+ # You think that I am bit crazy to save all these here? No, it is just a development authorization from Yandex
21
+ APPLICATION_ID = '663576cbd55948a4ae45424fb508ef97'
22
+ APPLICATION_PASSWORD = 'fc2f76dc877e41a4a6cbe78d73faff85'
23
+
24
+ ACCESS_TOKEN = '926b254ca2f24869999a3d404a01f616'
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.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -115,7 +115,7 @@ extra_rdoc_files:
115
115
  - LICENSE
116
116
  - README.md
117
117
  files:
118
- - .document
118
+ - .rspec
119
119
  - .travis.yml
120
120
  - Gemfile
121
121
  - Gemfile.lock
@@ -134,6 +134,7 @@ files:
134
134
  - lib/metrika/helpers/authorization.rb
135
135
  - lib/metrika/helpers/request.rb
136
136
  - metrika.gemspec
137
+ - spec/cases/metrika/authorization_spec.rb
137
138
  - spec/cases/metrika_spec.rb
138
139
  - spec/helper.rb
139
140
  homepage: http://github.com/igor-alexandrov/metrika
@@ -151,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
152
  version: '0'
152
153
  segments:
153
154
  - 0
154
- hash: -1087403569314908613
155
+ hash: 1199521670938624461
155
156
  required_rubygems_version: !ruby/object:Gem::Requirement
156
157
  none: false
157
158
  requirements:
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt