km_resque 1.0.2 → 1.0.3
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/km_resque.rb +6 -6
- data/lib/km_resque/version.rb +1 -1
- data/spec/lib/km_resque/resque_spec.rb +32 -3
- metadata +50 -43
    
        data/lib/km_resque.rb
    CHANGED
    
    | @@ -12,13 +12,13 @@ class KmResque | |
| 12 12 | 
             
              def self.configuration
         | 
| 13 13 | 
             
                @configuration ||= Configuration.new
         | 
| 14 14 | 
             
              end
         | 
| 15 | 
            -
              def self.alias(identifier1, identifier2)
         | 
| 16 | 
            -
                ::Resque.enqueue(AliasJob, identifier1, identifier2,  | 
| 15 | 
            +
              def self.alias(identifier1, identifier2, timestamp=Time.now.to_i)
         | 
| 16 | 
            +
                ::Resque.enqueue(AliasJob, identifier1, identifier2, timestamp)
         | 
| 17 17 | 
             
              end
         | 
| 18 | 
            -
              def self.set(identifier, properties)
         | 
| 19 | 
            -
                ::Resque.enqueue(SetJob, identifier, properties,  | 
| 18 | 
            +
              def self.set(identifier, properties, timestamp=Time.now.to_i)
         | 
| 19 | 
            +
                ::Resque.enqueue(SetJob, identifier, properties, timestamp)
         | 
| 20 20 | 
             
              end
         | 
| 21 | 
            -
              def self.record(identifier, eventName, properties)
         | 
| 22 | 
            -
                ::Resque.enqueue(RecordJob, identifier, eventName, properties,  | 
| 21 | 
            +
              def self.record(identifier, eventName, properties, timestamp=Time.now.to_i)
         | 
| 22 | 
            +
                ::Resque.enqueue(RecordJob, identifier, eventName, properties, timestamp)
         | 
| 23 23 | 
             
              end
         | 
| 24 24 | 
             
            end
         | 
    
        data/lib/km_resque/version.rb
    CHANGED
    
    
| @@ -6,6 +6,7 @@ describe "KmResque" do | |
| 6 6 | 
             
              before(:each) do
         | 
| 7 7 | 
             
                ResqueSpec.reset!
         | 
| 8 8 | 
             
                Time.stub!(:now => Time.now)
         | 
| 9 | 
            +
                @prior_timestamp = Time.now.to_i-(60 * 60 * 24)
         | 
| 9 10 | 
             
                @timestamp = Time.now.to_i
         | 
| 10 11 | 
             
              end
         | 
| 11 12 | 
             
              describe "configuring" do
         | 
| @@ -17,7 +18,7 @@ describe "KmResque" do | |
| 17 18 | 
             
                end
         | 
| 18 19 | 
             
              end
         | 
| 19 20 | 
             
              describe "alias" do
         | 
| 20 | 
            -
                it "should queue an AliasJob" do
         | 
| 21 | 
            +
                it "should queue an AliasJob with current time" do
         | 
| 21 22 | 
             
                  KmResque.alias("identifier1", "identifier2")
         | 
| 22 23 | 
             
                  KmResque::AliasJob.should have_queued("identifier1",
         | 
| 23 24 | 
             
                                                          "identifier2",
         | 
| @@ -26,7 +27,7 @@ describe "KmResque" do | |
| 26 27 | 
             
                end
         | 
| 27 28 | 
             
              end
         | 
| 28 29 | 
             
              describe "set" do
         | 
| 29 | 
            -
                it "should queue  | 
| 30 | 
            +
                it "should queue a SetJob with current time" do
         | 
| 30 31 | 
             
                  KmResque.set("identifier", {:some_prop => 'some_val'})
         | 
| 31 32 | 
             
                  KmResque::SetJob.should have_queued("identifier",
         | 
| 32 33 | 
             
                                                        {:some_prop => 'some_val'},
         | 
| @@ -35,7 +36,7 @@ describe "KmResque" do | |
| 35 36 | 
             
                end
         | 
| 36 37 | 
             
              end
         | 
| 37 38 | 
             
              describe "record" do
         | 
| 38 | 
            -
                it "should queue  | 
| 39 | 
            +
                it "should queue a RecordJob with current time" do
         | 
| 39 40 | 
             
                  KmResque.record("identifier", "myEventName", {:some_prop => 'some_val'})
         | 
| 40 41 | 
             
                  KmResque::RecordJob.should have_queued("identifier",
         | 
| 41 42 | 
             
                                                           "myEventName",
         | 
| @@ -44,4 +45,32 @@ describe "KmResque" do | |
| 44 45 | 
             
                                                           ).in(:km)
         | 
| 45 46 | 
             
                end
         | 
| 46 47 | 
             
              end
         | 
| 48 | 
            +
              describe "alias" do
         | 
| 49 | 
            +
                it "should queue an AliasJob with arbitrary timestamp" do
         | 
| 50 | 
            +
                  KmResque.alias("identifier1", "identifier2", @prior_timestamp)
         | 
| 51 | 
            +
                  KmResque::AliasJob.should have_queued("identifier1",
         | 
| 52 | 
            +
                                                          "identifier2",
         | 
| 53 | 
            +
                                                          @prior_timestamp
         | 
| 54 | 
            +
                                                          ).in(:km)
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
              describe "set" do
         | 
| 58 | 
            +
                it "should queue a SetJob with arbitrary timestamp" do
         | 
| 59 | 
            +
                  KmResque.set("identifier", {:some_prop => 'some_val'}, @prior_timestamp)
         | 
| 60 | 
            +
                  KmResque::SetJob.should have_queued("identifier",
         | 
| 61 | 
            +
                                                        {:some_prop => 'some_val'},
         | 
| 62 | 
            +
                                                        @prior_timestamp
         | 
| 63 | 
            +
                                                        ).in(:km)
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
              end
         | 
| 66 | 
            +
              describe "record" do
         | 
| 67 | 
            +
                it "should queue a RecordJob with arbitrary timestamp" do
         | 
| 68 | 
            +
                  KmResque.record("identifier", "myEventName", {:some_prop => 'some_val'}, @prior_timestamp)
         | 
| 69 | 
            +
                  KmResque::RecordJob.should have_queued("identifier",
         | 
| 70 | 
            +
                                                           "myEventName",
         | 
| 71 | 
            +
                                                           {:some_prop => 'some_val'},
         | 
| 72 | 
            +
                                                           @prior_timestamp
         | 
| 73 | 
            +
                                                           ).in(:km)
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
              end
         | 
| 47 76 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,56 +1,60 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification
         | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: km_resque
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0.2
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 5 4 | 
             
              prerelease: 
         | 
| 5 | 
            +
              version: 1.0.3
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 | 
            -
            authors:
         | 
| 7 | 
            +
            authors: 
         | 
| 8 8 | 
             
            - Luke Melia
         | 
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 12 | 
            +
             | 
| 13 | 
            +
            date: 2012-09-27 00:00:00 Z
         | 
| 14 | 
            +
            dependencies: 
         | 
| 15 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 15 16 | 
             
              name: resque
         | 
| 16 | 
            -
               | 
| 17 | 
            +
              prerelease: false
         | 
| 18 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 17 19 | 
             
                none: false
         | 
| 18 | 
            -
                requirements:
         | 
| 19 | 
            -
                - -  | 
| 20 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 20 | 
            +
                requirements: 
         | 
| 21 | 
            +
                - - ">="
         | 
| 22 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 21 23 | 
             
                    version: 1.1.0
         | 
| 22 24 | 
             
              type: :runtime
         | 
| 23 | 
            -
               | 
| 24 | 
            -
             | 
| 25 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 25 | 
            +
              version_requirements: *id001
         | 
| 26 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 26 27 | 
             
              name: resque_spec
         | 
| 27 | 
            -
               | 
| 28 | 
            +
              prerelease: false
         | 
| 29 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 28 30 | 
             
                none: false
         | 
| 29 | 
            -
                requirements:
         | 
| 30 | 
            -
                - -  | 
| 31 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            -
                    version:  | 
| 31 | 
            +
                requirements: 
         | 
| 32 | 
            +
                - - ">="
         | 
| 33 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 34 | 
            +
                    version: "0"
         | 
| 33 35 | 
             
              type: :development
         | 
| 34 | 
            -
               | 
| 35 | 
            -
             | 
| 36 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 36 | 
            +
              version_requirements: *id002
         | 
| 37 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 37 38 | 
             
              name: webmock
         | 
| 38 | 
            -
               | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 39 41 | 
             
                none: false
         | 
| 40 | 
            -
                requirements:
         | 
| 41 | 
            -
                - -  | 
| 42 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 43 | 
            -
                    version:  | 
| 42 | 
            +
                requirements: 
         | 
| 43 | 
            +
                - - ">="
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 45 | 
            +
                    version: "0"
         | 
| 44 46 | 
             
              type: :development
         | 
| 45 | 
            -
               | 
| 46 | 
            -
              version_requirements: *2165636620
         | 
| 47 | 
            +
              version_requirements: *id003
         | 
| 47 48 | 
             
            description: Interact with the KISSMetrics API via Resque
         | 
| 48 | 
            -
            email:
         | 
| 49 | 
            +
            email: 
         | 
| 49 50 | 
             
            - luke@lukemelia.com
         | 
| 50 51 | 
             
            executables: []
         | 
| 52 | 
            +
             | 
| 51 53 | 
             
            extensions: []
         | 
| 54 | 
            +
             | 
| 52 55 | 
             
            extra_rdoc_files: []
         | 
| 53 | 
            -
             | 
| 56 | 
            +
             | 
| 57 | 
            +
            files: 
         | 
| 54 58 | 
             
            - .gitignore
         | 
| 55 59 | 
             
            - .travis.yml
         | 
| 56 60 | 
             
            - Gemfile
         | 
| @@ -72,29 +76,32 @@ files: | |
| 72 76 | 
             
            - spec/lib/km_resque_spec.rb
         | 
| 73 77 | 
             
            homepage: https://github.com/lukemelia/km_resque
         | 
| 74 78 | 
             
            licenses: []
         | 
| 79 | 
            +
             | 
| 75 80 | 
             
            post_install_message: 
         | 
| 76 81 | 
             
            rdoc_options: []
         | 
| 77 | 
            -
             | 
| 82 | 
            +
             | 
| 83 | 
            +
            require_paths: 
         | 
| 78 84 | 
             
            - lib
         | 
| 79 | 
            -
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 85 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 80 86 | 
             
              none: false
         | 
| 81 | 
            -
              requirements:
         | 
| 82 | 
            -
              - -  | 
| 83 | 
            -
                - !ruby/object:Gem::Version
         | 
| 84 | 
            -
                  version:  | 
| 85 | 
            -
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 87 | 
            +
              requirements: 
         | 
| 88 | 
            +
              - - ">="
         | 
| 89 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 90 | 
            +
                  version: "0"
         | 
| 91 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 86 92 | 
             
              none: false
         | 
| 87 | 
            -
              requirements:
         | 
| 88 | 
            -
              - -  | 
| 89 | 
            -
                - !ruby/object:Gem::Version
         | 
| 90 | 
            -
                  version:  | 
| 93 | 
            +
              requirements: 
         | 
| 94 | 
            +
              - - ">="
         | 
| 95 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 96 | 
            +
                  version: "0"
         | 
| 91 97 | 
             
            requirements: []
         | 
| 98 | 
            +
             | 
| 92 99 | 
             
            rubyforge_project: 
         | 
| 93 100 | 
             
            rubygems_version: 1.8.10
         | 
| 94 101 | 
             
            signing_key: 
         | 
| 95 102 | 
             
            specification_version: 3
         | 
| 96 103 | 
             
            summary: Interact with the KISSMetrics API via Resque
         | 
| 97 | 
            -
            test_files:
         | 
| 104 | 
            +
            test_files: 
         | 
| 98 105 | 
             
            - spec/lib/km_resque/alias_job_spec.rb
         | 
| 99 106 | 
             
            - spec/lib/km_resque/record_job_spec.rb
         | 
| 100 107 | 
             
            - spec/lib/km_resque/resque_spec.rb
         |