analytics-ruby 2.2.2 → 2.2.3.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3b230a879bb54d86002b9fb8dba7efd903820d1
4
- data.tar.gz: 85d46c68f93aab276ff7a31674150d7748f523ff
3
+ metadata.gz: b487a2b95a07ae396262ebf9af60f94b09152568
4
+ data.tar.gz: 577c4474658bfcc5a40baf1dc55abd9c918f3728
5
5
  SHA512:
6
- metadata.gz: 9f101f18d561f24f388085bce24f3c3f755e9eb14ea52f9963021645a52c5d99bf23989949bc18698f5ca23979c37c858c22b76403e8073613846ddfb7d6185c
7
- data.tar.gz: 6aedfbaa47c81a672b9df0972f875751c5ac96c1ebccf635a512765a4d14a88892e3f0509481c88be60ca72feba6a4f070fb4d770307f14d9675d87d60f0c753
6
+ metadata.gz: d6b249cff66b4b304ef19bab340abc9cbc83e5ff0b6007a885dd22409f60c415a11b33dba43a8a99b3032122b822270979dd16fc398afdebac152f8b67e1e66e
7
+ data.tar.gz: ae3a5effa3de14b3e291358d0ca0a66832fe56639c77c8c07d7b6ea5b2f00a5da1568bef10666f1e5c76659eeb99a04ec746be596b76ba5109a33e88b1856e5b
@@ -0,0 +1,43 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ analytics-ruby (2.2.2)
5
+ commander (~> 4.4)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ activesupport (3.2.22)
11
+ i18n (~> 0.6, >= 0.6.4)
12
+ multi_json (~> 1.0)
13
+ commander (4.4.3)
14
+ highline (~> 1.7.2)
15
+ diff-lcs (1.2.5)
16
+ highline (1.7.8)
17
+ i18n (0.7.0)
18
+ multi_json (1.11.2)
19
+ rake (10.4.2)
20
+ rspec (2.99.0)
21
+ rspec-core (~> 2.99.0)
22
+ rspec-expectations (~> 2.99.0)
23
+ rspec-mocks (~> 2.99.0)
24
+ rspec-core (2.99.2)
25
+ rspec-expectations (2.99.2)
26
+ diff-lcs (>= 1.1.3, < 2.0)
27
+ rspec-mocks (2.99.4)
28
+ thread_safe (0.3.5)
29
+ tzinfo (1.2.1)
30
+ thread_safe (~> 0.1)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ activesupport (>= 3.0.0, < 4.0.0)
37
+ analytics-ruby!
38
+ rake (~> 10.3)
39
+ rspec (~> 2.0)
40
+ tzinfo (= 1.2.1)
41
+
42
+ BUNDLED WITH
43
+ 1.15.4
data/History.md CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ 2.2.3.pre / 2017-09-14
3
+ ==================
4
+
5
+ * [Fix](https://github.com/segmentio/analytics-ruby/pull/120): Override `respond_to_missing` instead of `respond_to?` to facilitate mock the library in tests.
6
+
7
+
2
8
  2.2.2 / 2016-08-03
3
9
  ==================
4
10
 
data/README.md CHANGED
@@ -8,54 +8,47 @@ analytics-ruby is a ruby client for [Segment](https://segment.com)
8
8
  ## Install
9
9
 
10
10
  Into Gemfile from rubygems.org:
11
- ```
12
- gem 'analytics-ruby', :require => "segment"
11
+ ```ruby
12
+ gem 'analytics-ruby', require: "segment"
13
13
  ```
14
14
 
15
15
  Into environment gems from rubygems.org:
16
- ```
16
+ ```ruby
17
17
  gem install 'analytics-ruby'
18
18
  ```
19
19
 
20
20
  ## Usage
21
21
 
22
22
  Create an instance of the Analytics object:
23
+ ```ruby
24
+ analytics = Segment::Analytics.new(write_key: 'YOUR_WRITE_KEY')
23
25
  ```
24
- analytics = Segment::Analytics.new({
25
- write_key: 'YOUR_WRITE_KEY'
26
- })
26
+
27
+ Identify the user for the people section, see more [here](https://segment.com/docs/libraries/ruby/#identify).
28
+ ```ruby
29
+ analytics.identify(user_id: 42,
30
+ traits: {
31
+ email: 'name@example.com',
32
+ first_name: 'Foo',
33
+ last_name: 'Bar'
34
+ })
27
35
  ```
28
36
 
29
- Sample usage:
37
+ Alias an user, see more [here](https://segment.com/docs/libraries/ruby/#alias).
38
+ ```ruby
39
+ analytics.alias(user_id: 41)
30
40
  ```
31
- user = User.last
32
-
33
- # Identify the user for the people section
34
- analytics.identify(
35
- {
36
- user_id: user.id,
37
- traits: {
38
- email: user.email,
39
- first_name: user.first_name,
40
- last_name: user.last_name
41
- }
42
- }
43
- )
44
-
45
- # Track a user event
46
- analytics.track(
47
- {
48
- user_id: user.id,
49
- event: 'Created Account'
50
- }
51
- )
41
+
42
+ Track a user event, see more [here](https://segment.com/docs/libraries/ruby/#track).
43
+ ```ruby
44
+ analytics.track(user_id: 42, event: 'Created Account')
52
45
  ```
53
46
 
54
- Refer to the section below for documenation on individual available calls.
47
+ There are a few calls available, please check the documentation section.
55
48
 
56
49
  ## Documentation
57
50
 
58
- Documentation is available at [segment.com/libraries/ruby](https://segment.com/libraries/ruby)
51
+ Documentation is available at [segment.com/docs/sources/server/ruby](https://segment.com/docs/sources/server/ruby/)
59
52
 
60
53
  ## Testing
61
54
 
Binary file
Binary file
Binary file
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.add_dependency 'commander', '~> 4.4'
20
20
 
21
21
  spec.add_development_dependency 'rake', '~> 10.3'
22
- spec.add_development_dependency 'wrong', '~> 0.0'
23
22
  spec.add_development_dependency 'rspec', '~> 2.0'
24
23
  spec.add_development_dependency 'tzinfo', '1.2.1'
25
24
  spec.add_development_dependency 'activesupport', '>= 3.0.0', '<4.0.0'
@@ -22,7 +22,7 @@ module Segment
22
22
  end
23
23
  end
24
24
 
25
- def respond_to? method_name, include_private = false
25
+ def respond_to_missing?(method_name, include_private = false)
26
26
  @client.respond_to?(method_name) || super
27
27
  end
28
28
 
@@ -1,5 +1,5 @@
1
1
  module Segment
2
2
  class Analytics
3
- VERSION = '2.2.2'
3
+ VERSION = '2.2.3.pre'
4
4
  end
5
5
  end
@@ -101,6 +101,20 @@ module Segment
101
101
  end.to_not raise_error
102
102
  end
103
103
  end
104
+
105
+ describe '#respond_to?' do
106
+ it 'responds to all public instance methods of Segment::Analytics::Client' do
107
+ expect(analytics).to respond_to(*Segment::Analytics::Client.public_instance_methods(false))
108
+ end
109
+ end
110
+
111
+ describe '#method' do
112
+ Segment::Analytics::Client.public_instance_methods(false).each do |public_method|
113
+ it "returns a Method object with '#{public_method}' as argument" do
114
+ expect(analytics.method(public_method).class).to eq(Method)
115
+ end
116
+ end
117
+ end
104
118
  end
105
119
  end
106
120
  end
@@ -1,9 +1,6 @@
1
1
  require 'segment/analytics'
2
- require 'wrong'
3
2
  require 'active_support/time'
4
3
 
5
- include Wrong
6
-
7
4
  # Setting timezone for ActiveSupport::TimeWithZone to UTC
8
5
  Time.zone = 'UTC'
9
6
 
@@ -79,3 +76,27 @@ module Segment
79
76
  end
80
77
  end
81
78
  end
79
+
80
+ # usage:
81
+ # it "should return a result of 5" do
82
+ # eventually(options: {timeout: 1}) { long_running_thing.result.should eq(5) }
83
+ # end
84
+
85
+ module AsyncHelper
86
+ def eventually(options = {})
87
+ timeout = options[:timeout] || 2
88
+ interval = options[:interval] || 0.1
89
+ time_limit = Time.now + timeout
90
+ loop do
91
+ begin
92
+ yield
93
+ rescue => error
94
+ end
95
+ return if error.nil?
96
+ raise error if Time.now >= time_limit
97
+ sleep interval
98
+ end
99
+ end
100
+ end
101
+
102
+ include AsyncHelper
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Segment.io
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-04 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.3'
41
- - !ruby/object:Gem::Dependency
42
- name: wrong
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,13 +94,15 @@ extensions: []
108
94
  extra_rdoc_files: []
109
95
  files:
110
96
  - Gemfile
97
+ - Gemfile.lock
111
98
  - History.md
112
99
  - Makefile
113
100
  - README.md
114
101
  - RELEASING.md
115
102
  - Rakefile
116
- - analytics-ruby-2.2.0.gem
117
- - analytics-ruby-2.2.1.gem
103
+ - analytics-ruby-2.0.13.gem
104
+ - analytics-ruby-2.1.0.gem
105
+ - analytics-ruby-2.2.2.gem
118
106
  - analytics-ruby.gemspec
119
107
  - bin/analytics
120
108
  - lib/segment.rb
@@ -148,12 +136,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
136
  version: '0'
149
137
  required_rubygems_version: !ruby/object:Gem::Requirement
150
138
  requirements:
151
- - - ">="
139
+ - - ">"
152
140
  - !ruby/object:Gem::Version
153
- version: '0'
141
+ version: 1.3.1
154
142
  requirements: []
155
143
  rubyforge_project:
156
- rubygems_version: 2.2.2
144
+ rubygems_version: 2.6.13
157
145
  signing_key:
158
146
  specification_version: 4
159
147
  summary: Segment.io analytics library
Binary file
Binary file