km_resque 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ class KmResque
5
5
  @queue = :km
6
6
 
7
7
  def self.perform(identifier1, identifier2, timestamp)
8
- ApiClient.new.alias(identifier1, identifier2, timestamp)
8
+ ApiClient.new.alias(identifier1, identifier2, timestamp.to_i)
9
9
  end
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ class KmResque
5
5
  @queue = :km
6
6
 
7
7
  def self.perform(identifier, event_name, properties, timestamp)
8
- ApiClient.new.record(identifier, event_name, properties, timestamp)
8
+ ApiClient.new.record(identifier, event_name, properties, timestamp.to_i)
9
9
  end
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ class KmResque
5
5
  @queue = :km
6
6
 
7
7
  def self.perform(identifier, properties, timestamp)
8
- ApiClient.new.set(identifier, properties, timestamp)
8
+ ApiClient.new.set(identifier, properties, timestamp.to_i)
9
9
  end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  class KmResque
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -16,5 +16,13 @@ describe "KmResque::AliasJob" do
16
16
  expected_api_hit = "http://trk.kissmetrics.com/a?_d=1&_k=abc123&_n=identifier2&_p=identifier1&_t=#{timestamp}"
17
17
  WebMock.should have_requested(:get, expected_api_hit)
18
18
  end
19
+ it "should round off any decimal in timestamp" do
20
+ now = Time.now
21
+ timestamp_float = now.to_f
22
+ timeStamp_int = now.to_i
23
+ KmResque::AliasJob.perform("identifier1", "identifier2", timestamp_float)
24
+ expected_api_hit = "http://trk.kissmetrics.com/a?_d=1&_k=abc123&_n=identifier2&_p=identifier1&_t=#{timeStamp_int}"
25
+ WebMock.should have_requested(:get, expected_api_hit)
26
+ end
19
27
  end
20
28
  end
@@ -34,5 +34,13 @@ describe "KmResque::RecordJob" do
34
34
  KmResque::RecordJob.perform("identifier", "eventName", { :foo => 'bar', :baz => 'bay'}, timestamp)
35
35
  }.should raise_error(KmResque::Error)
36
36
  end
37
+ it "should round off any decimal in timestamp" do
38
+ now = Time.now
39
+ timestamp_float = now.to_f
40
+ timeStamp_int = now.to_i
41
+ KmResque::RecordJob.perform("identifier", "eventName", { :foo => 'bar', :baz => 'bay'}, timestamp_float)
42
+ expected_api_hit = "http://trk.kissmetrics.com/e?_d=1&_k=abc123&_n=eventName&_p=identifier&_t=#{timeStamp_int}&baz=bay&foo=bar"
43
+ WebMock.should have_requested(:get, expected_api_hit)
44
+ end
37
45
  end
38
46
  end
@@ -16,5 +16,13 @@ describe "KmResque::SetJob" do
16
16
  expected_api_hit = "http://trk.kissmetrics.com/s?_d=1&_k=abc123&_p=identifier&_t=#{timestamp}&baz=bay&foo=bar"
17
17
  WebMock.should have_requested(:get, expected_api_hit)
18
18
  end
19
+ it "should round off any decimal in timestamp" do
20
+ now = Time.now
21
+ timestamp_float = now.to_f
22
+ timeStamp_int = now.to_i
23
+ KmResque::SetJob.perform("identifier", { :foo => 'bar', :baz => 'bay'}, timestamp_float)
24
+ expected_api_hit = "http://trk.kissmetrics.com/s?_d=1&_k=abc123&_p=identifier&_t=#{timeStamp_int}&baz=bay&foo=bar"
25
+ WebMock.should have_requested(:get, expected_api_hit)
26
+ end
19
27
  end
20
28
  end
metadata CHANGED
@@ -1,60 +1,56 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: km_resque
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
4
5
  prerelease:
5
- version: 1.0.1
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
- date: 2012-09-25 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2012-09-27 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: resque
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2165638380 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
23
21
  version: 1.1.0
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: resque_spec
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2165638380
25
+ - !ruby/object:Gem::Dependency
26
+ name: resque_spec
27
+ requirement: &2165637700 !ruby/object:Gem::Requirement
30
28
  none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
35
33
  type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: webmock
39
34
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *2165637700
36
+ - !ruby/object:Gem::Dependency
37
+ name: webmock
38
+ requirement: &2165636620 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
46
44
  type: :development
47
- version_requirements: *id003
45
+ prerelease: false
46
+ version_requirements: *2165636620
48
47
  description: Interact with the KISSMetrics API via Resque
49
- email:
48
+ email:
50
49
  - luke@lukemelia.com
51
50
  executables: []
52
-
53
51
  extensions: []
54
-
55
52
  extra_rdoc_files: []
56
-
57
- files:
53
+ files:
58
54
  - .gitignore
59
55
  - .travis.yml
60
56
  - Gemfile
@@ -76,32 +72,29 @@ files:
76
72
  - spec/lib/km_resque_spec.rb
77
73
  homepage: https://github.com/lukemelia/km_resque
78
74
  licenses: []
79
-
80
75
  post_install_message:
81
76
  rdoc_options: []
82
-
83
- require_paths:
77
+ require_paths:
84
78
  - lib
85
- required_ruby_version: !ruby/object:Gem::Requirement
79
+ required_ruby_version: !ruby/object:Gem::Requirement
86
80
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: "0"
91
- required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
86
  none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: "0"
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
97
91
  requirements: []
98
-
99
92
  rubyforge_project:
100
93
  rubygems_version: 1.8.10
101
94
  signing_key:
102
95
  specification_version: 3
103
96
  summary: Interact with the KISSMetrics API via Resque
104
- test_files:
97
+ test_files:
105
98
  - spec/lib/km_resque/alias_job_spec.rb
106
99
  - spec/lib/km_resque/record_job_spec.rb
107
100
  - spec/lib/km_resque/resque_spec.rb