analytics-ruby 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +5 -0
- data/analytics-ruby.gemspec +1 -1
- data/lib/analytics-ruby/json.rb +28 -0
- data/lib/analytics-ruby/request.rb +2 -2
- data/lib/analytics-ruby/version.rb +1 -1
- data/spec/module_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- metadata +14 -13
data/History.md
CHANGED
data/analytics-ruby.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.email = 'friends@segment.io'
|
15
15
|
spec.homepage = 'https://github.com/segmentio/analytics-ruby'
|
16
16
|
|
17
|
-
spec.add_dependency 'faraday', ['
|
17
|
+
spec.add_dependency 'faraday', ['>= 0.8', '< 0.10']
|
18
18
|
spec.add_dependency 'faraday_middleware', ['~> 0.9.0']
|
19
19
|
spec.add_dependency 'multi_json', ['~> 1.0']
|
20
20
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'multi_json'
|
2
|
+
|
3
|
+
module AnalyticsRuby
|
4
|
+
|
5
|
+
# JSON Wrapper module adapted from
|
6
|
+
# https://github.com/stripe/stripe-ruby/blob/master/lib/stripe/json.rb
|
7
|
+
#
|
8
|
+
# .dump was added in MultiJson 1.3
|
9
|
+
module JSON
|
10
|
+
if MultiJson.respond_to?(:dump)
|
11
|
+
def self.dump(*args)
|
12
|
+
MultiJson.dump(*args)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.load(*args)
|
16
|
+
MultiJson.load(*args)
|
17
|
+
end
|
18
|
+
else
|
19
|
+
def self.dump(*args)
|
20
|
+
MultiJson.encode(*args)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.load(*args)
|
24
|
+
MultiJson.decode(*args)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'analytics-ruby/defaults'
|
3
3
|
require 'analytics-ruby/response'
|
4
|
-
require '
|
4
|
+
require 'analytics-ruby/json'
|
5
5
|
require 'faraday'
|
6
6
|
require 'faraday_middleware'
|
7
7
|
|
@@ -35,7 +35,7 @@ module AnalyticsRuby
|
|
35
35
|
begin
|
36
36
|
res = @conn.post do |req|
|
37
37
|
req.url(@path)
|
38
|
-
req.body =
|
38
|
+
req.body = AnalyticsRuby::JSON::dump(secret: secret, batch: batch)
|
39
39
|
end
|
40
40
|
status = res.status
|
41
41
|
error = res.body["error"]
|
data/spec/module_spec.rb
CHANGED
@@ -23,6 +23,7 @@ describe Analytics do
|
|
23
23
|
|
24
24
|
it 'should not error with the required options' do
|
25
25
|
Analytics.track AnalyticsHelpers::Queued::TRACK
|
26
|
+
sleep(1)
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
@@ -34,6 +35,7 @@ describe Analytics do
|
|
34
35
|
|
35
36
|
it 'should not error with the required options' do
|
36
37
|
Analytics.identify AnalyticsHelpers::Queued::IDENTIFY
|
38
|
+
sleep(1)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analytics-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
|
-
requirement: &
|
16
|
+
requirement: &18295840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '0.8'
|
22
22
|
- - <
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: '0.10'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *18295840
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: faraday_middleware
|
30
|
-
requirement: &
|
30
|
+
requirement: &18294820 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: 0.9.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *18294820
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: multi_json
|
41
|
-
requirement: &
|
41
|
+
requirement: &18294180 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
version: '1.0'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *18294180
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: rake
|
52
|
-
requirement: &
|
52
|
+
requirement: &18293720 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ! '>='
|
@@ -57,10 +57,10 @@ dependencies:
|
|
57
57
|
version: '0'
|
58
58
|
type: :development
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *18293720
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec
|
63
|
-
requirement: &
|
63
|
+
requirement: &18308960 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ! '>='
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version: '0'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
|
-
version_requirements: *
|
71
|
+
version_requirements: *18308960
|
72
72
|
description: The Segment.io ruby analytics library
|
73
73
|
email: friends@segment.io
|
74
74
|
executables: []
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/analytics-ruby/consumer.rb
|
84
84
|
- lib/analytics-ruby/request.rb
|
85
85
|
- lib/analytics-ruby/version.rb
|
86
|
+
- lib/analytics-ruby/json.rb
|
86
87
|
- lib/analytics-ruby/client.rb
|
87
88
|
- History.md
|
88
89
|
- analytics-ruby.gemspec
|