rugalytics 0.0.5 → 0.0.6

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/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.0.6. fixed report date parsing bug reported by masolino
2
+
1
3
  v0.0.5. report names are now methods that can be called on profile, load_report is deprecated
2
4
 
3
5
  v0.0.4. fix for HTML and URL changes at Google Analytics site
@@ -42,9 +42,17 @@ module Rugalytics
42
42
  def set_attributes lines
43
43
  @base_url = lines[1]
44
44
  @report_name = lines[2].chomp(',')
45
- dates = lines[3].split(',')
46
- @start_date = Date.parse(dates[0])
47
- @end_date = Date.parse(dates[1])
45
+ dates = lines[3].include?('","') ? lines[3].split('","') : lines[3].split(',')
46
+ @start_date = parse_date(dates[0])
47
+ @end_date = parse_date(dates[1])
48
+ end
49
+
50
+ def parse_date text
51
+ begin
52
+ Date.parse(text)
53
+ rescue Exception => e
54
+ raise "#{e}: #{text}"
55
+ end
48
56
  end
49
57
 
50
58
  def handle_graphs lines
data/lib/rugalytics.rb CHANGED
@@ -11,7 +11,7 @@ require 'yaml'
11
11
 
12
12
  # See README for usage documentation.
13
13
  module Rugalytics
14
- VERSION = "0.0.5"
14
+ VERSION = "0.0.6"
15
15
 
16
16
  FORMAT_PDF = '0' unless defined? FORMAT_PDF
17
17
  FORMAT_XML = '1' unless defined? FORMAT_XML
data/rugalytics.gemspec CHANGED
@@ -1,18 +1,18 @@
1
1
 
2
- # Gem::Specification for Rugalytics-0.0.5
2
+ # Gem::Specification for Rugalytics-0.0.6
3
3
  # Originally generated by Echoe
4
4
 
5
5
  --- !ruby/object:Gem::Specification
6
6
  name: rugalytics
7
7
  version: !ruby/object:Gem::Version
8
- version: 0.0.5
8
+ version: 0.0.6
9
9
  platform: ruby
10
10
  authors:
11
11
  - Rob McKinnon
12
12
  autorequire:
13
13
  bindir: bin
14
14
 
15
- date: 2008-08-03 00:00:00 +01:00
15
+ date: 2008-08-04 00:00:00 +01:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -7,7 +7,7 @@ describe Rugalytics::Report do
7
7
  describe "when setting report attributes" do
8
8
  before :all do
9
9
  csv = %Q|# ----------------------------------------
10
- theyworkforyou.co.nz
10
+ your_site.com
11
11
  Top Content,
12
12
  26 May 2008,31 May 2008
13
13
  # ----------------------------------------|
@@ -15,7 +15,7 @@ Top Content,
15
15
  end
16
16
 
17
17
  it "should set base url from second line of text" do
18
- @report.base_url.should == 'theyworkforyou.co.nz'
18
+ @report.base_url.should == 'your_site.com'
19
19
  end
20
20
 
21
21
  it "should set report name from third line of text" do
@@ -31,9 +31,38 @@ Top Content,
31
31
  end
32
32
  end
33
33
 
34
+ describe "when setting report dates" do
35
+ describe "with source date format 'Month Day, Year'" do
36
+ before :all do
37
+ csv = %Q|# ----------------------------------------
38
+ your_site.com
39
+ Top Content,
40
+ "July 28, 2008","August 4, 2008"
41
+ # ----------------------------------------|
42
+ @report = Rugalytics::Report.new(csv)
43
+ end
44
+ it "should set start date from fourth line of text" do
45
+ @report.start_date.should == Date.parse('28 July 2008')
46
+ end
47
+ it "should set end date from fourth line of text" do
48
+ @report.end_date.should == Date.parse('4 August 2008')
49
+ end
50
+ end
51
+ describe "with dates badly formatted" do
52
+ it 'should raise an exception' do
53
+ csv = %Q|# ----------------------------------------
54
+ your_site.com
55
+ Top Content,
56
+ random something
57
+ # ----------------------------------------|
58
+ lambda { Rugalytics::Report.new(csv) }.should raise_error(Exception, 'invalid date: random something')
59
+ end
60
+ end
61
+ end
62
+
34
63
  describe "when creating items from 'Table'" do
35
64
  before :all do
36
- @base_url = %Q|theyworkforyou.co.nz|
65
+ @base_url = %Q|your_site.com|
37
66
  @attributes = %Q|URL,Page Views,Unique Page Views,Time on Page,Bounce Rate,% Exit,$ Index|
38
67
  @values1 = %Q|/,189,157,54.94957983193277,0.4862385392189026,0.37037035822868347,0.0|
39
68
  @values2 = %Q|/bills,60,38,54.17307692307692,0.0,0.13333334028720856,0.0|
@@ -65,7 +94,7 @@ Top Content,
65
94
 
66
95
  describe "when creating items from '.*MiniTableTable'" do
67
96
  before :all do
68
- @base_url = %Q|theyworkforyou.co.nz|
97
+ @base_url = %Q|your_site.com|
69
98
  @browser_attributes = %Q|Browser,Visits,% visits|
70
99
  @browser_values = %Q|Firefox,1529,0.17185568809509277|
71
100
  @connection_speed_attributes = %Q|Connection Speed,Visits,% visits|
@@ -108,7 +137,7 @@ Visitors Overview,
108
137
  @start = %Q|26 May 2008|
109
138
  @end = %Q|31 May 2008|
110
139
  @csv = %Q|# ----------------------------------------
111
- theyworkforyou.co.nz
140
+ your_site.com
112
141
  Top Content,
113
142
  #{@start},#{@end}
114
143
  # ----------------------------------------
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugalytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob McKinnon
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-03 00:00:00 +01:00
12
+ date: 2008-08-04 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency