simple_segment 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +22 -0
- data/.rubocop.yml +7 -1
- data/CHANGELOG.md +9 -3
- data/README.md +2 -2
- data/lib/simple_segment/client.rb +5 -0
- data/lib/simple_segment/logging.rb +1 -1
- data/lib/simple_segment/operations/operation.rb +2 -1
- data/lib/simple_segment/utils.rb +3 -5
- data/lib/simple_segment/version.rb +1 -1
- data/simple_segment.gemspec +4 -1
- metadata +8 -7
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17b61bb188d391c3349423f42c56444313a7ed154945149ecda2d1317d070a15
|
4
|
+
data.tar.gz: 499d33dbd054da57d6bf33bf277638a93d238dee88d7d1989626ce96f35dcbef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 209c042c0b36bbe411cbb76e57ae072c6cde1de5906dff3bdcff597dd83148f92154d052acec4225b23e1c40c64f5be3129d4a21db62aff1709520725e45edc6
|
7
|
+
data.tar.gz: 120b864ff8d2ba8a68082a6b8d4bcc68f75cd490ae083f463ef2e8bc0c02efc52f4f926642a1cf5cc0067db7ba885220ab7e7a66c578daff5a9499385fa81826
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby-version: [2.6, 2.7, 3.0]
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler-cache: true
|
21
|
+
- name: Run tests
|
22
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
|
1
4
|
Metrics/BlockLength:
|
2
5
|
Exclude:
|
3
6
|
- '**/*_spec.rb'
|
4
7
|
|
5
|
-
|
8
|
+
Layout/LineLength:
|
6
9
|
Max: 100
|
7
10
|
IgnoreCopDirectives: true
|
8
11
|
Exclude:
|
@@ -10,3 +13,6 @@ Metrics/LineLength:
|
|
10
13
|
|
11
14
|
Style/Documentation:
|
12
15
|
Enabled: false
|
16
|
+
|
17
|
+
Gemspec/RequiredRubyVersion:
|
18
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.3.0] - 2021-11-27
|
10
|
+
|
11
|
+
### Added
|
12
|
+
- Add support for message_id override https://github.com/whatthewhat/simple_segment/pull/34 by [@theblang][]
|
13
|
+
|
9
14
|
## [1.2.0] - 2020-07-29
|
10
15
|
|
11
16
|
### Changed
|
@@ -14,13 +19,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
14
19
|
## [1.1.0] - 2020-04-11
|
15
20
|
|
16
21
|
### Added
|
17
|
-
- Added support for http_proxy and https_proxy environment variables https://github.com/whatthewhat/simple_segment/pull/26 by @saks
|
22
|
+
- Added support for http_proxy and https_proxy environment variables https://github.com/whatthewhat/simple_segment/pull/26 by [@saks][]
|
18
23
|
- Added Ruby 2.7 to travis.yml
|
19
24
|
|
20
25
|
## [1.0.0] - 2019-12-12
|
21
26
|
|
22
27
|
### Added
|
23
|
-
- Allow passing custom Net::HTTP options (e.g. timeout) https://github.com/whatthewhat/simple_segment/pull/23 by @barodeur
|
28
|
+
- Allow passing custom Net::HTTP options (e.g. timeout) https://github.com/whatthewhat/simple_segment/pull/23 by [@barodeur][]
|
24
29
|
|
25
30
|
### Changed
|
26
31
|
- The gem is no longer tested with Ruby versions below 2.4
|
@@ -30,7 +35,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
30
35
|
### Changed
|
31
36
|
- Date properties are now automatically converted to ISO 8601 to be consistent with the official client https://github.com/whatthewhat/simple_segment/pull/19 by @juanramoncg
|
32
37
|
|
33
|
-
[Unreleased]: https://github.com/whatthewhat/simple_segment/compare/v1.
|
38
|
+
[Unreleased]: https://github.com/whatthewhat/simple_segment/compare/v1.3.0...HEAD
|
39
|
+
[1.3.0]: https://github.com/whatthewhat/simple_segment/compare/v1.2.0...v1.3.0
|
34
40
|
[1.2.0]: https://github.com/whatthewhat/simple_segment/compare/v1.1.0...v1.2.0
|
35
41
|
[1.1.0]: https://github.com/whatthewhat/simple_segment/compare/v1.0.0...v1.1.0
|
36
42
|
[1.0.0]: https://github.com/whatthewhat/simple_segment/compare/v0.3.0...v1.0.0
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# SimpleSegment
|
2
2
|
|
3
|
-
|
3
|
+
![Build Status](https://github.com/whatthewhat/simple_segment/actions/workflows/ci.yml/badge.svg?branch=master)
|
4
4
|
|
5
|
-
A simple synchronous Ruby API client for [segment.io](segment.io).
|
5
|
+
A simple synchronous Ruby API client for [segment.io](https://segment.io).
|
6
6
|
|
7
7
|
SimpleSegment allows for manual control of when and how the events are sent to Segment. This can be useful if you want to leverage an existing queueing system like Sidekiq or Resque for sending events or need to send events synchronously. If this is not the case you will be better off using the [official segment gem](https://github.com/segmentio/analytics-ruby) that handles queuing for you.
|
8
8
|
|
@@ -22,6 +22,7 @@ module SimpleSegment
|
|
22
22
|
# @option :context [Hash]
|
23
23
|
# @option :integrations [Hash]
|
24
24
|
# @option :timestamp [#iso8601] (Time.now)
|
25
|
+
# @option :message_id
|
25
26
|
def identify(options)
|
26
27
|
Operations::Identify.new(self, symbolize_keys(options)).call
|
27
28
|
end
|
@@ -34,6 +35,7 @@ module SimpleSegment
|
|
34
35
|
# @option :context [Hash]
|
35
36
|
# @option :integrations [Hash]
|
36
37
|
# @option :timestamp [#iso8601] (Time.now)
|
38
|
+
# @option :message_id
|
37
39
|
def track(options)
|
38
40
|
Operations::Track.new(self, symbolize_keys(options)).call
|
39
41
|
end
|
@@ -46,6 +48,7 @@ module SimpleSegment
|
|
46
48
|
# @option :context [Hash]
|
47
49
|
# @option :integrations [Hash]
|
48
50
|
# @option :timestamp [#iso8601] (Time.now)
|
51
|
+
# @option :message_id
|
49
52
|
def page(options)
|
50
53
|
Operations::Page.new(self, symbolize_keys(options)).call
|
51
54
|
end
|
@@ -58,6 +61,7 @@ module SimpleSegment
|
|
58
61
|
# @option :context [Hash]
|
59
62
|
# @option :integrations [Hash]
|
60
63
|
# @option :timestamp [#iso8601] (Time.now)
|
64
|
+
# @option :message_id
|
61
65
|
def group(options)
|
62
66
|
Operations::Group.new(self, symbolize_keys(options)).call
|
63
67
|
end
|
@@ -70,6 +74,7 @@ module SimpleSegment
|
|
70
74
|
# @option :context [Hash]
|
71
75
|
# @option :integrations [Hash]
|
72
76
|
# @option :timestamp [#iso8601] (Time.now)
|
77
|
+
# @option :message_id
|
73
78
|
def alias(options)
|
74
79
|
Operations::Alias.new(self, symbolize_keys(options)).call
|
75
80
|
end
|
@@ -36,7 +36,8 @@ module SimpleSegment
|
|
36
36
|
context: context,
|
37
37
|
integrations: options[:integrations],
|
38
38
|
timestamp: timestamp(options.fetch(:timestamp, current_time)),
|
39
|
-
sentAt: current_time.iso8601
|
39
|
+
sentAt: current_time.iso8601,
|
40
|
+
messageId: options[:message_id]
|
40
41
|
}
|
41
42
|
end
|
42
43
|
|
data/lib/simple_segment/utils.rb
CHANGED
@@ -7,9 +7,7 @@ module SimpleSegment
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def symbolize_keys(hash)
|
10
|
-
hash.
|
11
|
-
result[key.to_sym] = value
|
12
|
-
end
|
10
|
+
hash.transform_keys(&:to_sym)
|
13
11
|
end
|
14
12
|
|
15
13
|
# public: Converts all the date values in the into iso8601 strings in place
|
@@ -22,8 +20,8 @@ module SimpleSegment
|
|
22
20
|
# strings
|
23
21
|
#
|
24
22
|
def isoify_dates(hash)
|
25
|
-
hash.
|
26
|
-
|
23
|
+
hash.transform_values do |v|
|
24
|
+
maybe_datetime_in_iso8601(v)
|
27
25
|
end
|
28
26
|
end
|
29
27
|
|
data/simple_segment.gemspec
CHANGED
@@ -24,7 +24,10 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'pry'
|
25
25
|
spec.add_development_dependency 'rake', '>= 10.0'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
-
spec.add_development_dependency 'rubocop', '
|
27
|
+
spec.add_development_dependency 'rubocop', '1.23.0'
|
28
28
|
spec.add_development_dependency 'timecop', '~> 0.8.0'
|
29
29
|
spec.add_development_dependency 'webmock', '~> 3.7'
|
30
|
+
spec.metadata = {
|
31
|
+
'rubygems_mfa_required' => 'true'
|
32
|
+
}
|
30
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_segment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikhail Topolskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.23.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.23.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: timecop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,11 +116,11 @@ executables: []
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
+
- ".github/workflows/ci.yml"
|
119
120
|
- ".gitignore"
|
120
121
|
- ".hound.yml"
|
121
122
|
- ".rspec"
|
122
123
|
- ".rubocop.yml"
|
123
|
-
- ".travis.yml"
|
124
124
|
- CHANGELOG.md
|
125
125
|
- Gemfile
|
126
126
|
- LICENSE.txt
|
@@ -147,7 +147,8 @@ files:
|
|
147
147
|
homepage: https://github.com/whatthewhat/simple_segment
|
148
148
|
licenses:
|
149
149
|
- MIT
|
150
|
-
metadata:
|
150
|
+
metadata:
|
151
|
+
rubygems_mfa_required: 'true'
|
151
152
|
post_install_message:
|
152
153
|
rdoc_options: []
|
153
154
|
require_paths:
|
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
164
|
- !ruby/object:Gem::Version
|
164
165
|
version: '0'
|
165
166
|
requirements: []
|
166
|
-
rubygems_version: 3.
|
167
|
+
rubygems_version: 3.1.6
|
167
168
|
signing_key:
|
168
169
|
specification_version: 4
|
169
170
|
summary: A simple synchronous API client for segment.io.
|