garb 0.2.9 → 0.3.0
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/lib/garb/authentication_request.rb +3 -2
- data/lib/garb/report_response.rb +2 -2
- data/lib/garb/version.rb +2 -2
- data/test/fixtures/report_feed.xml +1 -1
- data/test/test_helper.rb +5 -3
- data/test/unit/account_test.rb +1 -1
- data/test/unit/authentication_request_test.rb +2 -2
- data/test/unit/data_request_test.rb +1 -1
- data/test/unit/garb_test.rb +1 -1
- data/test/unit/oauth_session_test.rb +1 -1
- data/test/unit/operator_test.rb +4 -4
- data/test/unit/profile_test.rb +1 -1
- data/test/unit/report_parameter_test.rb +1 -1
- data/test/unit/report_response_test.rb +1 -1
- data/test/unit/report_test.rb +1 -1
- data/test/unit/resource_test.rb +1 -1
- data/test/unit/session_test.rb +1 -1
- data/test/unit/string_test.rb +1 -1
- data/test/unit/symbol_test.rb +1 -1
- metadata +2 -2
@@ -4,16 +4,17 @@ module Garb
|
|
4
4
|
|
5
5
|
URL = 'https://www.google.com/accounts/ClientLogin'
|
6
6
|
|
7
|
-
def initialize(email, password)
|
7
|
+
def initialize(email, password, opts={})
|
8
8
|
@email = email
|
9
9
|
@password = password
|
10
|
+
@account_type = opts.fetch(:account_type, 'HOSTED_OR_GOOGLE')
|
10
11
|
end
|
11
12
|
|
12
13
|
def parameters
|
13
14
|
{
|
14
15
|
'Email' => @email,
|
15
16
|
'Passwd' => @password,
|
16
|
-
'accountType' =>
|
17
|
+
'accountType' => @account_type,
|
17
18
|
'service' => 'analytics',
|
18
19
|
'source' => 'vigetLabs-garb-001'
|
19
20
|
}
|
data/lib/garb/report_response.rb
CHANGED
@@ -34,7 +34,7 @@ module Garb
|
|
34
34
|
include HappyMapper
|
35
35
|
|
36
36
|
tag 'metric'
|
37
|
-
namespace 'http://schemas.google.com/
|
37
|
+
namespace 'http://schemas.google.com/analytics/2009'
|
38
38
|
|
39
39
|
attribute :name, String
|
40
40
|
attribute :value, String
|
@@ -44,7 +44,7 @@ module Garb
|
|
44
44
|
include HappyMapper
|
45
45
|
|
46
46
|
tag 'dimension'
|
47
|
-
namespace 'http://schemas.google.com/
|
47
|
+
namespace 'http://schemas.google.com/analytics/2009'
|
48
48
|
|
49
49
|
attribute :name, String
|
50
50
|
attribute :value, String
|
data/lib/garb/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<feed xmlns='http://www.w3.org/2005/Atom'
|
3
3
|
xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
|
4
|
-
xmlns:dxp='http://schemas.google.com/
|
4
|
+
xmlns:dxp='http://schemas.google.com/analytics/2009'
|
5
5
|
xmlns:ga='http://schemas.google.com/analytics/2008'>
|
6
6
|
<id>http://www.google.com/analytics/feeds/data?ids=ga:983247&dimensions=ga:country,ga:city&metrics=ga:pageViews&start-date=2008-01-01&end-date=2008-01-02</id>
|
7
7
|
<updated>2008-01-02T15:59:59.999-08:00 </updated>
|
data/test/test_helper.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
$:.reject! { |e| e.include? 'TextMate' }
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
require '
|
4
|
+
require 'minitest/unit'
|
5
5
|
require 'shoulda'
|
6
6
|
require 'mocha'
|
7
7
|
|
8
8
|
require File.dirname(__FILE__) + '/../lib/garb'
|
9
9
|
|
10
|
-
class
|
10
|
+
class MiniTest::Unit::TestCase
|
11
11
|
|
12
12
|
def read_fixture(filename)
|
13
13
|
File.read(File.dirname(__FILE__) + "/fixtures/#{filename}")
|
14
14
|
end
|
15
15
|
|
16
|
-
end
|
16
|
+
end
|
17
|
+
|
18
|
+
MiniTest::Unit.autorun
|
data/test/unit/account_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', '/test_helper')
|
2
2
|
|
3
3
|
module Garb
|
4
|
-
class AccountTest <
|
4
|
+
class AccountTest < MiniTest::Unit::TestCase
|
5
5
|
context "The Account class" do
|
6
6
|
should "have an array of accounts with all profiles" do
|
7
7
|
p1 = stub(:account_id => '1111', :account_name => 'Blog 1')
|
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '..', '/test_helper')
|
|
3
3
|
CA_CERT_FILE = File.join(File.dirname(__FILE__), '..', '/cacert.pem')
|
4
4
|
|
5
5
|
module Garb
|
6
|
-
class AuthenticationRequestTest <
|
6
|
+
class AuthenticationRequestTest < MiniTest::Unit::TestCase
|
7
7
|
|
8
8
|
context "An instance of the AuthenticationRequest class" do
|
9
9
|
|
@@ -108,7 +108,7 @@ module Garb
|
|
108
108
|
|
109
109
|
Net::HTTP.stubs(:new).with('www.google.com', 443).returns(http)
|
110
110
|
|
111
|
-
|
111
|
+
assert_raises(Garb::AuthenticationRequest::AuthError) do
|
112
112
|
@request.send_request(OpenSSL::SSL::VERIFY_NONE)
|
113
113
|
end
|
114
114
|
end
|
data/test/unit/garb_test.rb
CHANGED
data/test/unit/operator_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', '/test_helper')
|
2
2
|
|
3
|
-
class OperatorTest <
|
3
|
+
class OperatorTest < MiniTest::Unit::TestCase
|
4
4
|
context "An instance of an Operator" do
|
5
5
|
should "lower camelize the target" do
|
6
6
|
assert_equal "ga:uniqueVisits=", Operator.new(:unique_visits, "=").to_ga
|
@@ -23,15 +23,15 @@ class OperatorTest < Test::Unit::TestCase
|
|
23
23
|
should "not be equal to another operator if target, operator, or prefix is different" do
|
24
24
|
op1 = Operator.new(:hello, "==")
|
25
25
|
op2 = Operator.new(:hello, "==", true)
|
26
|
-
|
26
|
+
refute_equal op1, op2
|
27
27
|
|
28
28
|
op1 = Operator.new(:hello1, "==")
|
29
29
|
op2 = Operator.new(:hello2, "==")
|
30
|
-
|
30
|
+
refute_equal op1, op2
|
31
31
|
|
32
32
|
op1 = Operator.new(:hello, "!=")
|
33
33
|
op2 = Operator.new(:hello, "==")
|
34
|
-
|
34
|
+
refute_equal op1, op2
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/test/unit/profile_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', '/test_helper')
|
2
2
|
|
3
3
|
module Garb
|
4
|
-
class ReportResponseTest <
|
4
|
+
class ReportResponseTest < MiniTest::Unit::TestCase
|
5
5
|
context "An instance of the ReportResponse class" do
|
6
6
|
setup do
|
7
7
|
@xml = File.read(File.join(File.dirname(__FILE__), '..', "/fixtures/report_feed.xml"))
|
data/test/unit/report_test.rb
CHANGED
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), '..', '/test_helper')
|
|
2
2
|
|
3
3
|
module Garb
|
4
4
|
# Also tests Garb::Resource, which is the basis for Garb::Report
|
5
|
-
class ReportTest <
|
5
|
+
class ReportTest < MiniTest::Unit::TestCase
|
6
6
|
context "An instance of the Report class" do
|
7
7
|
setup do
|
8
8
|
@now = Time.now
|
data/test/unit/resource_test.rb
CHANGED
@@ -5,7 +5,7 @@ class TestReport
|
|
5
5
|
end
|
6
6
|
|
7
7
|
# Most of the resource testing is done as a part of ReportTest
|
8
|
-
class ResourceTest <
|
8
|
+
class ResourceTest < MiniTest::Unit::TestCase
|
9
9
|
|
10
10
|
context "A class with Garb::Resource mixed in" do
|
11
11
|
should "get results from GA" do
|
data/test/unit/session_test.rb
CHANGED
data/test/unit/string_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', '/test_helper')
|
2
2
|
|
3
|
-
class StringTest <
|
3
|
+
class StringTest < MiniTest::Unit::TestCase
|
4
4
|
context "An instance of a String" do
|
5
5
|
should 'prefix a string with ga: for GA' do
|
6
6
|
assert_equal 'ga:bob', 'bob'.to_ga
|
data/test/unit/symbol_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-26 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|