analytical 1.5.0 → 1.6.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/VERSION +1 -1
- data/analytical.gemspec +4 -4
- data/lib/analytical/adwords.rb +1 -1
- data/lib/analytical/api.rb +3 -2
- data/lib/analytical/base.rb +2 -2
- data/lib/analytical/chartbeat.rb +1 -1
- data/lib/analytical/clicky.rb +1 -1
- data/lib/analytical/comscore.rb +1 -1
- data/lib/analytical/console.rb +1 -1
- data/lib/analytical/crazy_egg.rb +1 -1
- data/lib/analytical/google.rb +1 -1
- data/lib/analytical/hubspot.rb +1 -1
- data/lib/analytical/kiss_metrics.rb +1 -1
- data/lib/analytical/optimizely.rb +1 -1
- data/spec/analytical/api_spec.rb +4 -0
- data/spec/analytical/base_spec.rb +4 -4
- data/spec/analytical/chartbeat_spec.rb +6 -6
- data/spec/analytical/clicky_spec.rb +8 -8
- data/spec/analytical/comscore_spec.rb +6 -6
- data/spec/analytical/google_spec.rb +6 -6
- data/spec/analytical/kiss_metrics_spec.rb +8 -8
- data/spec/analytical/optimizely_spec.rb +6 -6
- metadata +13 -4
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1. | 
| 1 | 
            +
            1.6.0
         | 
    
        data/analytical.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{analytical}
         | 
| 8 | 
            -
              s.version = "1. | 
| 8 | 
            +
              s.version = "1.6.0"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Joshua Krall", "Nathan Phelps"]
         | 
| 12 | 
            -
              s.date = %q{2010- | 
| 12 | 
            +
              s.date = %q{2010-09-10}
         | 
| 13 13 | 
             
              s.description = %q{Gem for managing multiple analytics services in your rails app.}
         | 
| 14 14 | 
             
              s.email = %q{josh@transfs.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -106,7 +106,7 @@ Gem::Specification.new do |s| | |
| 106 106 | 
             
              s.homepage = %q{http://github.com/jkrall/analytical}
         | 
| 107 107 | 
             
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| 108 108 | 
             
              s.require_paths = ["lib"]
         | 
| 109 | 
            -
              s.rubygems_version = %q{1.3. | 
| 109 | 
            +
              s.rubygems_version = %q{1.3.7}
         | 
| 110 110 | 
             
              s.summary = %q{Gem for managing multiple analytics services in your rails app.}
         | 
| 111 111 | 
             
              s.test_files = [
         | 
| 112 112 | 
             
                "spec/analytical/api_spec.rb",
         | 
| @@ -126,7 +126,7 @@ Gem::Specification.new do |s| | |
| 126 126 | 
             
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 127 127 | 
             
                s.specification_version = 3
         | 
| 128 128 |  | 
| 129 | 
            -
                if Gem::Version.new(Gem:: | 
| 129 | 
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 130 130 | 
             
                  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
         | 
| 131 131 | 
             
                  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
         | 
| 132 132 | 
             
                else
         | 
    
        data/lib/analytical/adwords.rb
    CHANGED
    
    
    
        data/lib/analytical/api.rb
    CHANGED
    
    | @@ -6,7 +6,8 @@ module Analytical | |
| 6 6 | 
             
                def initialize(options={})
         | 
| 7 7 | 
             
                  @options = options
         | 
| 8 8 | 
             
                  @modules = @options[:modules].inject(ActiveSupport::OrderedHash.new) do |h, m|
         | 
| 9 | 
            -
                     | 
| 9 | 
            +
                    module_options = @options.merge(@options[m] || {}).merge(:parent => self)
         | 
| 10 | 
            +
                    h[m] = "Analytical::#{m.to_s.camelize}::Api".constantize.new(module_options)
         | 
| 10 11 | 
             
                    h
         | 
| 11 12 | 
             
                  end
         | 
| 12 13 | 
             
                end
         | 
| @@ -58,7 +59,7 @@ module Analytical | |
| 58 59 | 
             
                end
         | 
| 59 60 |  | 
| 60 61 | 
             
                alias_method :head_javascript, :head_append_javascript
         | 
| 61 | 
            -
             | 
| 62 | 
            +
             | 
| 62 63 | 
             
                def body_prepend_javascript
         | 
| 63 64 | 
             
                  [init_javascript(:body_prepend), tracking_javascript(:body_prepend)].delete_if{|s| s.blank?}.join("\n")
         | 
| 64 65 | 
             
                end
         | 
    
        data/lib/analytical/base.rb
    CHANGED
    
    | @@ -4,9 +4,9 @@ module Analytical | |
| 4 4 | 
             
                  attr_reader :tracking_command_location, :parent, :options, :initialized
         | 
| 5 5 | 
             
                  attr_accessor :commands
         | 
| 6 6 |  | 
| 7 | 
            -
                  def initialize( | 
| 8 | 
            -
                    @parent = _parent
         | 
| 7 | 
            +
                  def initialize(_options={})
         | 
| 9 8 | 
             
                    @options = _options
         | 
| 9 | 
            +
                    @parent = @options[:parent]
         | 
| 10 10 | 
             
                    @tracking_command_location = :body_prepend
         | 
| 11 11 | 
             
                    @initialized = false
         | 
| 12 12 | 
             
                    @commands = []
         | 
    
        data/lib/analytical/chartbeat.rb
    CHANGED
    
    
    
        data/lib/analytical/clicky.rb
    CHANGED
    
    
    
        data/lib/analytical/comscore.rb
    CHANGED
    
    
    
        data/lib/analytical/console.rb
    CHANGED
    
    
    
        data/lib/analytical/crazy_egg.rb
    CHANGED
    
    
    
        data/lib/analytical/google.rb
    CHANGED
    
    
    
        data/lib/analytical/hubspot.rb
    CHANGED
    
    
    
        data/spec/analytical/api_spec.rb
    CHANGED
    
    | @@ -12,6 +12,10 @@ describe "Analytical::Api" do | |
| 12 12 | 
             
                    :google=>@google,
         | 
| 13 13 | 
             
                  }
         | 
| 14 14 | 
             
                end
         | 
| 15 | 
            +
                it 'should pass the ssl option on to the module constructor' do
         | 
| 16 | 
            +
                  Analytical::Console::Api.should_receive(:new).with(hash_including(:ssl=>true)).and_return(@console = mock('console'))
         | 
| 17 | 
            +
                  Analytical::Api.new :modules=>[:console], :ssl=>true
         | 
| 18 | 
            +
                end
         | 
| 15 19 | 
             
              end
         | 
| 16 20 |  | 
| 17 21 | 
             
              describe 'with modules' do
         | 
| @@ -8,7 +8,7 @@ describe Analytical::Base::Api do | |
| 8 8 |  | 
| 9 9 | 
             
              describe '#queue' do
         | 
| 10 10 | 
             
                before(:each) do
         | 
| 11 | 
            -
                  @api = BaseApiDummy.new(mock('parent'))
         | 
| 11 | 
            +
                  @api = BaseApiDummy.new(:parent=>mock('parent'))
         | 
| 12 12 | 
             
                  @api.commands = [:a, :b, :c]
         | 
| 13 13 | 
             
                end
         | 
| 14 14 | 
             
                describe 'with an identify command' do
         | 
| @@ -27,7 +27,7 @@ describe Analytical::Base::Api do | |
| 27 27 |  | 
| 28 28 | 
             
              describe '#process_queued_commands' do
         | 
| 29 29 | 
             
                before(:each) do
         | 
| 30 | 
            -
                  @api = BaseApiDummy.new(mock('parent'))
         | 
| 30 | 
            +
                  @api = BaseApiDummy.new(:parent=>mock('parent'))
         | 
| 31 31 | 
             
                  @api.commands = [[:a, 1, 2, 3], [:b, {:some=>:args}]]
         | 
| 32 32 | 
             
                  @api.stub!(:a).and_return('a')
         | 
| 33 33 | 
             
                  @api.stub!(:b).and_return('b')      
         | 
| @@ -48,7 +48,7 @@ describe Analytical::Base::Api do | |
| 48 48 |  | 
| 49 49 | 
             
              describe '#init_location?' do
         | 
| 50 50 | 
             
                before(:each) do
         | 
| 51 | 
            -
                  @api = BaseApiDummy.new(mock('parent'))
         | 
| 51 | 
            +
                  @api = BaseApiDummy.new(:parent=>mock('parent'))
         | 
| 52 52 | 
             
                  @api.instance_variable_set '@tracking_command_location', :my_location
         | 
| 53 53 | 
             
                end
         | 
| 54 54 | 
             
                describe 'when the command location matches the init location' do
         | 
| @@ -65,7 +65,7 @@ describe Analytical::Base::Api do | |
| 65 65 |  | 
| 66 66 | 
             
              describe '#init_location' do
         | 
| 67 67 | 
             
                before(:each) do
         | 
| 68 | 
            -
                  @api = BaseApiDummy.new(mock('parent'))
         | 
| 68 | 
            +
                  @api = BaseApiDummy.new(:parent=>mock('parent'))
         | 
| 69 69 | 
             
                end
         | 
| 70 70 | 
             
                it 'should check for the init_location' do
         | 
| 71 71 | 
             
                  @api.should_receive(:init_location?).with(:some_location).and_return(false)
         | 
| @@ -6,29 +6,29 @@ describe "Analytical::Chartbeat::Api" do | |
| 6 6 | 
             
              end
         | 
| 7 7 | 
             
              describe 'on initialize' do
         | 
| 8 8 | 
             
                it 'should set the command_location' do
         | 
| 9 | 
            -
                  a = Analytical::Chartbeat::Api.new  | 
| 9 | 
            +
                  a = Analytical::Chartbeat::Api.new :parent=>@parent, :key=>1234
         | 
| 10 10 | 
             
                  a.tracking_command_location.should == [:head_prepend, :body_append]
         | 
| 11 11 | 
             
                end
         | 
| 12 12 | 
             
                it 'should set the options' do
         | 
| 13 | 
            -
                  a = Analytical::Chartbeat::Api.new  | 
| 14 | 
            -
                  a.options.should == {:key=>12345, :domain => 'abcdef.com'}
         | 
| 13 | 
            +
                  a = Analytical::Chartbeat::Api.new :parent=>@parent, :key=>12345, :domain =>'abcdef.com'
         | 
| 14 | 
            +
                  a.options.should == {:key=>12345, :domain => 'abcdef.com', :parent=>@parent}
         | 
| 15 15 | 
             
                end
         | 
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
              describe '#track' do
         | 
| 18 18 | 
             
                it 'should return the tracking javascript' do
         | 
| 19 | 
            -
                  @api = Analytical::Chartbeat::Api.new  | 
| 19 | 
            +
                  @api = Analytical::Chartbeat::Api.new :parent=>@parent, :key=>12345
         | 
| 20 20 | 
             
                  @api.track.should == ''
         | 
| 21 21 | 
             
                end
         | 
| 22 22 | 
             
              end
         | 
| 23 23 | 
             
              describe '#identify' do
         | 
| 24 24 | 
             
                it 'should return an empty string' do
         | 
| 25 | 
            -
                  @api = Analytical::Chartbeat::Api.new  | 
| 25 | 
            +
                  @api = Analytical::Chartbeat::Api.new :parent=>@parent, :key=>12345
         | 
| 26 26 | 
             
                  @api.identify('nothing', {:matters=>'at all'}).should == ''
         | 
| 27 27 | 
             
                end
         | 
| 28 28 | 
             
              end
         | 
| 29 29 | 
             
              describe '#init_javascript' do
         | 
| 30 30 | 
             
                it 'should return the init javascript' do
         | 
| 31 | 
            -
                  @api = Analytical::Chartbeat::Api.new  | 
| 31 | 
            +
                  @api = Analytical::Chartbeat::Api.new :parent=>@parent, :key=>12345, :domain =>'abcdef.com'
         | 
| 32 32 | 
             
                  @api.init_javascript(:head_prepend).should =~ /_sf_startpt=\(new.Date\(\)\)\.getTime\(\);/
         | 
| 33 33 | 
             
                  @api.init_javascript(:head_append).should == ''
         | 
| 34 34 | 
             
                  @api.init_javascript(:body_prepend).should == ''
         | 
| @@ -6,29 +6,29 @@ describe "Analytical::Clicky::Api" do | |
| 6 6 | 
             
              end
         | 
| 7 7 | 
             
              describe 'on initialize' do
         | 
| 8 8 | 
             
                it 'should set the command_location' do
         | 
| 9 | 
            -
                  a = Analytical::Clicky::Api.new  | 
| 9 | 
            +
                  a = Analytical::Clicky::Api.new :parent=>@parent, :key=>'abc'
         | 
| 10 10 | 
             
                  a.tracking_command_location.should == :body_append
         | 
| 11 11 | 
             
                end
         | 
| 12 12 | 
             
                it 'should set the options' do
         | 
| 13 | 
            -
                  a = Analytical::Clicky::Api.new  | 
| 14 | 
            -
                  a.options.should == {:key=>'abc'}
         | 
| 13 | 
            +
                  a = Analytical::Clicky::Api.new :parent=>@parent, :key=>'abc'
         | 
| 14 | 
            +
                  a.options.should == {:key=>'abc', :parent=>@parent}
         | 
| 15 15 | 
             
                end
         | 
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
              describe '#track' do
         | 
| 18 18 | 
             
                it 'should return the tracking javascript' do
         | 
| 19 | 
            -
                  @api = Analytical::Clicky::Api.new  | 
| 19 | 
            +
                  @api = Analytical::Clicky::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 20 20 | 
             
                  @api.track('pagename', {:some=>'data'}).should == "clicky.log(\"pagename\");"
         | 
| 21 21 | 
             
                end
         | 
| 22 22 | 
             
              end
         | 
| 23 23 | 
             
              describe '#identify' do
         | 
| 24 24 | 
             
                it 'should return the init code string' do
         | 
| 25 | 
            -
                  @api = Analytical::Clicky::Api.new  | 
| 25 | 
            +
                  @api = Analytical::Clicky::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 26 26 | 
             
                  @api.identify('user id', {:a=>'b'}).should =~ /#{Regexp.escape({:id=>'user id', :a=>'b'}.to_json)}/
         | 
| 27 27 | 
             
                end
         | 
| 28 28 | 
             
              end
         | 
| 29 29 | 
             
              describe '#init_javascript' do
         | 
| 30 30 | 
             
                it 'should return the init javascript' do
         | 
| 31 | 
            -
                  @api = Analytical::Clicky::Api.new  | 
| 31 | 
            +
                  @api = Analytical::Clicky::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 32 32 | 
             
                  @api.init_javascript(:head_prepend).should == ''
         | 
| 33 33 | 
             
                  @api.init_javascript(:head_append).should == ''
         | 
| 34 34 | 
             
                  @api.init_javascript(:body_prepend).should == ''            
         | 
| @@ -37,12 +37,12 @@ describe "Analytical::Clicky::Api" do | |
| 37 37 | 
             
                end
         | 
| 38 38 | 
             
                describe 'for an ssl connection' do
         | 
| 39 39 | 
             
                  it 'should return the ssl init code' do
         | 
| 40 | 
            -
                    @api = Analytical::Clicky::Api.new  | 
| 40 | 
            +
                    @api = Analytical::Clicky::Api.new :parent=>@parent, :key=>'abcdef', :ssl=>true
         | 
| 41 41 | 
             
                    @api.init_javascript(:body_append).should =~ /https/
         | 
| 42 42 | 
             
                  end
         | 
| 43 43 | 
             
                end
         | 
| 44 44 | 
             
                describe 'with an identify command queued' do
         | 
| 45 | 
            -
                  @api = Analytical::Clicky::Api.new  | 
| 45 | 
            +
                  @api = Analytical::Clicky::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 46 46 | 
             
                  @api.queue :identify, 'user id', {:email=>'someone@test.com'}
         | 
| 47 47 | 
             
                  @api.init_javascript(:body_append).should =~ /"email":\w*"someone@test\.com"/
         | 
| 48 48 | 
             
                end
         | 
| @@ -6,31 +6,31 @@ describe "Analytical::Comscore::Api" do | |
| 6 6 | 
             
              end
         | 
| 7 7 | 
             
              describe 'on initialize' do
         | 
| 8 8 | 
             
                it 'should set the command_location' do
         | 
| 9 | 
            -
                  a = Analytical::Comscore::Api.new  | 
| 9 | 
            +
                  a = Analytical::Comscore::Api.new :parent=>@parent, :key=>123
         | 
| 10 10 | 
             
                  a.tracking_command_location.should == :head_append
         | 
| 11 11 | 
             
                end
         | 
| 12 12 | 
             
                it 'should set the options' do
         | 
| 13 | 
            -
                  a = Analytical::Comscore::Api.new  | 
| 14 | 
            -
                  a.options.should == {:key=>1234}
         | 
| 13 | 
            +
                  a = Analytical::Comscore::Api.new :parent=>@parent, :key=>1234
         | 
| 14 | 
            +
                  a.options.should == {:key=>1234, :parent=>@parent}
         | 
| 15 15 | 
             
                end
         | 
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
              describe '#track' do
         | 
| 18 18 | 
             
                it 'should return the tracking javascript' do
         | 
| 19 | 
            -
                  @api = Analytical::Comscore::Api.new  | 
| 19 | 
            +
                  @api = Analytical::Comscore::Api.new :parent=>@parent, :key=>123
         | 
| 20 20 | 
             
                  @api.track('pagename', {:some=>'data'}).should == ''
         | 
| 21 21 | 
             
                end
         | 
| 22 22 | 
             
              end
         | 
| 23 23 |  | 
| 24 24 | 
             
              describe '#identify' do
         | 
| 25 25 | 
             
                it 'should return an empty string' do
         | 
| 26 | 
            -
                  @api = Analytical::Comscore::Api.new  | 
| 26 | 
            +
                  @api = Analytical::Comscore::Api.new :parent=>@parent, :key=>123
         | 
| 27 27 | 
             
                  @api.identify('nothing', {:matters=>'at all'}).should == ''
         | 
| 28 28 | 
             
                end
         | 
| 29 29 | 
             
              end
         | 
| 30 30 |  | 
| 31 31 | 
             
              describe '#init_javascript' do
         | 
| 32 32 | 
             
                it 'should return the init javascript' do
         | 
| 33 | 
            -
                  @api = Analytical::Comscore::Api.new  | 
| 33 | 
            +
                  @api = Analytical::Comscore::Api.new :parent=>@parent, :key=>1234
         | 
| 34 34 | 
             
                  @api.init_javascript(:head_prepend).should == ''
         | 
| 35 35 | 
             
                  @api.init_javascript(:head_append).should =~ /scorecardresearch.com\/beacon.js/
         | 
| 36 36 | 
             
                  @api.init_javascript(:head_append).should =~ /1234/
         | 
| @@ -6,30 +6,30 @@ describe "Analytical::Google::Api" do | |
| 6 6 | 
             
              end
         | 
| 7 7 | 
             
              describe 'on initialize' do
         | 
| 8 8 | 
             
                it 'should set the command_location' do
         | 
| 9 | 
            -
                  a = Analytical::Google::Api.new  | 
| 9 | 
            +
                  a = Analytical::Google::Api.new :parent=>@parent, :key=>'abc'
         | 
| 10 10 | 
             
                  a.tracking_command_location.should == :head_append
         | 
| 11 11 | 
             
                end
         | 
| 12 12 | 
             
                it 'should set the options' do
         | 
| 13 | 
            -
                  a = Analytical::Google::Api.new  | 
| 14 | 
            -
                  a.options.should == {:key=>'abc'}
         | 
| 13 | 
            +
                  a = Analytical::Google::Api.new :parent=>@parent, :key=>'abc'
         | 
| 14 | 
            +
                  a.options.should == {:key=>'abc', :parent=>@parent}
         | 
| 15 15 | 
             
                end
         | 
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
              describe '#track' do
         | 
| 18 18 | 
             
                it 'should return the tracking javascript' do
         | 
| 19 | 
            -
                  @api = Analytical::Google::Api.new  | 
| 19 | 
            +
                  @api = Analytical::Google::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 20 20 | 
             
                  @api.track.should == "_gaq.push(['_trackPageview']);"
         | 
| 21 21 | 
             
                  @api.track('pagename', {:some=>'data'}).should ==  "_gaq.push(['_trackPageview', \"pagename\"]);"
         | 
| 22 22 | 
             
                end
         | 
| 23 23 | 
             
              end
         | 
| 24 24 | 
             
              describe '#identify' do
         | 
| 25 25 | 
             
                it 'should return an empty string' do
         | 
| 26 | 
            -
                  @api = Analytical::Google::Api.new  | 
| 26 | 
            +
                  @api = Analytical::Google::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 27 27 | 
             
                  @api.identify('nothing', {:matters=>'at all'}).should == ''
         | 
| 28 28 | 
             
                end
         | 
| 29 29 | 
             
              end
         | 
| 30 30 | 
             
              describe '#init_javascript' do
         | 
| 31 31 | 
             
                it 'should return the init javascript' do
         | 
| 32 | 
            -
                  @api = Analytical::Google::Api.new  | 
| 32 | 
            +
                  @api = Analytical::Google::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 33 33 | 
             
                  @api.init_javascript(:head_prepend).should == ''
         | 
| 34 34 | 
             
                  @api.init_javascript(:head_append).should =~ /abcdef/
         | 
| 35 35 | 
             
                  @api.init_javascript(:head_append).should =~ /google-analytics.com\/ga.js/
         | 
| @@ -6,41 +6,41 @@ describe "Analytical::KissMetrics::Api" do | |
| 6 6 | 
             
              end
         | 
| 7 7 | 
             
              describe 'on initialize' do
         | 
| 8 8 | 
             
                it 'should set the command_location' do
         | 
| 9 | 
            -
                  a = Analytical::KissMetrics::Api.new  | 
| 9 | 
            +
                  a = Analytical::KissMetrics::Api.new :parent=>@parent, :js_url_key=>'abc'
         | 
| 10 10 | 
             
                  a.tracking_command_location.should == :body_prepend
         | 
| 11 11 | 
             
                end
         | 
| 12 12 | 
             
                it 'should set the options' do
         | 
| 13 | 
            -
                  a = Analytical::KissMetrics::Api.new  | 
| 14 | 
            -
                  a.options.should == {:js_url_key=>'abc'}
         | 
| 13 | 
            +
                  a = Analytical::KissMetrics::Api.new :parent=>@parent, :js_url_key=>'abc'
         | 
| 14 | 
            +
                  a.options.should == {:js_url_key=>'abc', :parent=>@parent}
         | 
| 15 15 | 
             
                end
         | 
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
              describe '#track' do
         | 
| 18 18 | 
             
                it 'should return the tracking javascript' do
         | 
| 19 | 
            -
                  @api = Analytical::KissMetrics::Api.new  | 
| 19 | 
            +
                  @api = Analytical::KissMetrics::Api.new :parent=>@parent, :js_url_key=>'abcdef'
         | 
| 20 20 | 
             
                  @api.track('pagename', {:some=>'data'}).should == ''
         | 
| 21 21 | 
             
                end
         | 
| 22 22 | 
             
              end
         | 
| 23 23 | 
             
              describe '#identify' do
         | 
| 24 24 | 
             
                it 'should return a js string' do
         | 
| 25 | 
            -
                  @api = Analytical::KissMetrics::Api.new  | 
| 25 | 
            +
                  @api = Analytical::KissMetrics::Api.new :parent=>@parent, :js_url_key=>'abcdef'
         | 
| 26 26 | 
             
                  @api.identify('id', {:email=>'test@test.com'}).should == "_kmq.push([\"identify\", \"test@test.com\"]);"
         | 
| 27 27 | 
             
                end
         | 
| 28 28 | 
             
              end
         | 
| 29 29 | 
             
              describe '#event' do
         | 
| 30 30 | 
             
                it 'should return a js string' do
         | 
| 31 | 
            -
                  @api = Analytical::KissMetrics::Api.new  | 
| 31 | 
            +
                  @api = Analytical::KissMetrics::Api.new :parent=>@parent, :js_url_key=>'abcdef'
         | 
| 32 32 | 
             
                  @api.event('Big Deal', {:something=>'good'}).should == "_kmq.push([\"record\", \"Big Deal\", #{{:something=>'good'}.to_json}]);"
         | 
| 33 33 | 
             
                end
         | 
| 34 34 | 
             
              end
         | 
| 35 35 | 
             
              describe '#set' do
         | 
| 36 36 | 
             
                it 'should return a js string' do
         | 
| 37 | 
            -
                  @api = Analytical::KissMetrics::Api.new  | 
| 37 | 
            +
                  @api = Analytical::KissMetrics::Api.new :parent=>@parent, :js_url_key=>'abcdef'
         | 
| 38 38 | 
             
                  @api.set({:something=>'good', :b=>2}).should == "_kmq.push([\"set\", #{{:something=>'good', :b=>2}.to_json}]);"
         | 
| 39 39 | 
             
                end
         | 
| 40 40 | 
             
              end
         | 
| 41 41 | 
             
              describe '#init_javascript' do
         | 
| 42 42 | 
             
                it 'should return the init javascript' do
         | 
| 43 | 
            -
                  @api = Analytical::KissMetrics::Api.new  | 
| 43 | 
            +
                  @api = Analytical::KissMetrics::Api.new :parent=>@parent, :js_url_key=>'abcdef'
         | 
| 44 44 | 
             
                  @api.init_javascript(:head_prepend).should == ''
         | 
| 45 45 | 
             
                  @api.init_javascript(:head_append).should == ''
         | 
| 46 46 | 
             
                  @api.init_javascript(:body_prepend).should =~ /i\.kissmetrics\.com/
         | 
| @@ -6,31 +6,31 @@ describe "Analytical::Optimizely::Api" do | |
| 6 6 | 
             
              end
         | 
| 7 7 | 
             
              describe 'on initialize' do
         | 
| 8 8 | 
             
                it 'should set the command_location' do
         | 
| 9 | 
            -
                  a = Analytical::Optimizely::Api.new  | 
| 9 | 
            +
                  a = Analytical::Optimizely::Api.new :parent=>@parent, :key=>'abc'
         | 
| 10 10 | 
             
                  a.tracking_command_location.should == :head_prepend
         | 
| 11 11 | 
             
                end
         | 
| 12 12 | 
             
                it 'should set the options' do
         | 
| 13 | 
            -
                  a = Analytical::Optimizely::Api.new  | 
| 14 | 
            -
                  a.options.should == {:key=>'abc'}
         | 
| 13 | 
            +
                  a = Analytical::Optimizely::Api.new :parent=>@parent, :key=>'abc'
         | 
| 14 | 
            +
                  a.options.should == {:key=>'abc', :parent=>@parent}
         | 
| 15 15 | 
             
                end
         | 
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
              describe '#track' do
         | 
| 18 18 | 
             
                it 'should return the tracking javascript' do
         | 
| 19 | 
            -
                  @api = Analytical::Optimizely::Api.new  | 
| 19 | 
            +
                  @api = Analytical::Optimizely::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 20 20 | 
             
                  @api.track('pagename', {:some=>'data'}).should == ''
         | 
| 21 21 | 
             
                end
         | 
| 22 22 | 
             
              end
         | 
| 23 23 |  | 
| 24 24 | 
             
              describe '#identify' do
         | 
| 25 25 | 
             
                it 'should return an empty string' do
         | 
| 26 | 
            -
                  @api = Analytical::Optimizely::Api.new  | 
| 26 | 
            +
                  @api = Analytical::Optimizely::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 27 27 | 
             
                  @api.identify('nothing', {:matters=>'at all'}).should == ''
         | 
| 28 28 | 
             
                end
         | 
| 29 29 | 
             
              end
         | 
| 30 30 |  | 
| 31 31 | 
             
              describe '#init_javascript' do
         | 
| 32 32 | 
             
                it 'should return the init javascript' do
         | 
| 33 | 
            -
                  @api = Analytical::Optimizely::Api.new  | 
| 33 | 
            +
                  @api = Analytical::Optimizely::Api.new :parent=>@parent, :key=>'abcdef'
         | 
| 34 34 | 
             
                  @api.init_javascript(:head_prepend).should =~ /cdn\.optimizely.com\/js\/abcdef\.js/
         | 
| 35 35 | 
             
                  @api.init_javascript(:head_append).should == ''
         | 
| 36 36 | 
             
                  @api.init_javascript(:body_prepend).should == ''
         | 
    
        metadata
    CHANGED
    
    | @@ -1,12 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: analytical
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 15
         | 
| 4 5 | 
             
              prerelease: false
         | 
| 5 6 | 
             
              segments: 
         | 
| 6 7 | 
             
              - 1
         | 
| 7 | 
            -
              -  | 
| 8 | 
            +
              - 6
         | 
| 8 9 | 
             
              - 0
         | 
| 9 | 
            -
              version: 1. | 
| 10 | 
            +
              version: 1.6.0
         | 
| 10 11 | 
             
            platform: ruby
         | 
| 11 12 | 
             
            authors: 
         | 
| 12 13 | 
             
            - Joshua Krall
         | 
| @@ -15,16 +16,18 @@ autorequire: | |
| 15 16 | 
             
            bindir: bin
         | 
| 16 17 | 
             
            cert_chain: []
         | 
| 17 18 |  | 
| 18 | 
            -
            date: 2010- | 
| 19 | 
            +
            date: 2010-09-10 00:00:00 -05:00
         | 
| 19 20 | 
             
            default_executable: 
         | 
| 20 21 | 
             
            dependencies: 
         | 
| 21 22 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 22 23 | 
             
              name: rspec
         | 
| 23 24 | 
             
              prerelease: false
         | 
| 24 25 | 
             
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 26 | 
            +
                none: false
         | 
| 25 27 | 
             
                requirements: 
         | 
| 26 28 | 
             
                - - ">="
         | 
| 27 29 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 30 | 
            +
                    hash: 13
         | 
| 28 31 | 
             
                    segments: 
         | 
| 29 32 | 
             
                    - 1
         | 
| 30 33 | 
             
                    - 2
         | 
| @@ -36,9 +39,11 @@ dependencies: | |
| 36 39 | 
             
              name: activesupport
         | 
| 37 40 | 
             
              prerelease: false
         | 
| 38 41 | 
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 42 | 
            +
                none: false
         | 
| 39 43 | 
             
                requirements: 
         | 
| 40 44 | 
             
                - - ">="
         | 
| 41 45 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 46 | 
            +
                    hash: 3
         | 
| 42 47 | 
             
                    segments: 
         | 
| 43 48 | 
             
                    - 0
         | 
| 44 49 | 
             
                    version: "0"
         | 
| @@ -149,23 +154,27 @@ rdoc_options: | |
| 149 154 | 
             
            require_paths: 
         | 
| 150 155 | 
             
            - lib
         | 
| 151 156 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 157 | 
            +
              none: false
         | 
| 152 158 | 
             
              requirements: 
         | 
| 153 159 | 
             
              - - ">="
         | 
| 154 160 | 
             
                - !ruby/object:Gem::Version 
         | 
| 161 | 
            +
                  hash: 3
         | 
| 155 162 | 
             
                  segments: 
         | 
| 156 163 | 
             
                  - 0
         | 
| 157 164 | 
             
                  version: "0"
         | 
| 158 165 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 166 | 
            +
              none: false
         | 
| 159 167 | 
             
              requirements: 
         | 
| 160 168 | 
             
              - - ">="
         | 
| 161 169 | 
             
                - !ruby/object:Gem::Version 
         | 
| 170 | 
            +
                  hash: 3
         | 
| 162 171 | 
             
                  segments: 
         | 
| 163 172 | 
             
                  - 0
         | 
| 164 173 | 
             
                  version: "0"
         | 
| 165 174 | 
             
            requirements: []
         | 
| 166 175 |  | 
| 167 176 | 
             
            rubyforge_project: 
         | 
| 168 | 
            -
            rubygems_version: 1.3. | 
| 177 | 
            +
            rubygems_version: 1.3.7
         | 
| 169 178 | 
             
            signing_key: 
         | 
| 170 179 | 
             
            specification_version: 3
         | 
| 171 180 | 
             
            summary: Gem for managing multiple analytics services in your rails app.
         |