gitlab-sdk 0.2.6 → 0.3.0

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
  SHA256:
3
- metadata.gz: 2c5951cd03dfb98fbcb92ef04436e50e984117040e59cb991a3bd8f4d8b7557e
4
- data.tar.gz: 820348b1c3ba2fa2b46ca06d1660069518f827d307042c9c3536195f1da8a93e
3
+ metadata.gz: 38ec160731634aef4547e601d3e8b69ad5c885963d9236e89d8eff213c28743f
4
+ data.tar.gz: bf4a0c6454ae9102211a1fc3e8bcd7f3bd4b928d96a4703f92f9d2bcd07a4afd
5
5
  SHA512:
6
- metadata.gz: 5fc3cb9ab2a0598948471499bc4ef79d76ff46f3c57da9316a98c2b19ea49d8c11ef4b812b7d977809417569c9581e642a2151b27b847643a215c071321123e0
7
- data.tar.gz: de9b05e5bab69adc5c6e3687bbd0f88d86e71be845768d6cbf45cd6904b44eba8d93758c3f8659ab0fbc838f8f06ce61992fd8cb7ad7c7850fd467c5e2cfc25f
6
+ metadata.gz: 91844d2429060c4ad01212d9306a4073e4f631296fee2361dc344dc4c8fe25147796361e348a0af567e0c0f13a287befb4427923c8238b30c5991f2a64be7ed4
7
+ data.tar.gz: 8cce8707020443c8dd48aae6c0de1d8cd5601b8404209d446bf53a70b5244d06e98b1f6c61745f0daef3e413d85799b14510bfeb202a40c06b47d3628c63f20f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-sdk (0.2.6)
4
+ gitlab-sdk (0.3.0)
5
5
  activesupport (>= 5.2.0)
6
6
  rake (~> 13.0)
7
7
  snowplow-tracker (~> 0.8.0)
data/README.md CHANGED
@@ -26,6 +26,10 @@ client = GitlabSDK::Client.new(app_id: 'YOUR_APP_ID', host: 'YOUR_HOST')
26
26
  |:----------------|:---------------------------------------------------------------------------------------------------------------------------------------------------|
27
27
  | `app_id` | The ID specified in the GitLab Project Analytics setup guide. It ensures your data is sent to your analytics instance. |
28
28
  | `host` | The GitLab Project Analytics instance specified in the setup guide. When using a non-standard port, includde it here, e.g. `http://localhost:9091` |
29
+ | `buffer_size` | Optional. Default `1`. How many events are sent in one request at a time. Setting more than `1` will change the HTTP method from `GET` to `POST`. |
30
+ | `async` | Optional. Default `true`. Use `AsyncEmitter` instead of `Emitter` for non-blocking requests. |
31
+
32
+ For more details see Snowplow Ruby Tracker [docs](https://snowplow.github.io/snowplow-ruby-tracker/).
29
33
 
30
34
  ## Methods
31
35
 
@@ -15,8 +15,8 @@ module GitlabSDK
15
15
 
16
16
  HostHasNoSchemeError = Class.new(StandardError)
17
17
 
18
- def initialize(app_id:, host:)
19
- emitter = build_emitter(host)
18
+ def initialize(app_id:, host:, buffer_size: 1, async: true)
19
+ emitter = build_emitter(host, buffer_size: buffer_size, async: async)
20
20
 
21
21
  @tracker = SnowplowTracker::Tracker.new(
22
22
  emitters: emitter,
@@ -49,12 +49,23 @@ module GitlabSDK
49
49
 
50
50
  attr_reader :tracker
51
51
 
52
- def build_emitter(host)
52
+ def build_emitter(host, buffer_size:, async:)
53
53
  uri = URI(host)
54
54
  raise HostHasNoSchemeError unless uri.scheme
55
+ raise ArgumentError, 'buffer_size has to be positive' unless buffer_size.positive?
55
56
 
56
57
  endpoint = "#{uri.hostname}:#{uri.port}#{uri.path}"
57
- SnowplowTracker::Emitter.new(endpoint: endpoint, options: { protocol: uri.scheme })
58
+ method = buffer_size > 1 ? 'post' : 'get'
59
+ emitter_class = async ? SnowplowTracker::AsyncEmitter : SnowplowTracker::Emitter
60
+
61
+ emitter_class.new(
62
+ endpoint: endpoint,
63
+ options: {
64
+ protocol: uri.scheme,
65
+ method: method,
66
+ buffer_size: buffer_size
67
+ }
68
+ )
58
69
  end
59
70
 
60
71
  def set_subject_data
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitlabSDK
4
- VERSION = "0.2.6"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-10 00:00:00.000000000 Z
11
+ date: 2024-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -119,7 +119,7 @@ metadata:
119
119
  homepage_uri: https://gitlab.com/gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb
120
120
  source_code_uri: https://gitlab.com/gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb
121
121
  changelog_uri: https://gitlab.com/gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb/-/releases
122
- post_install_message:
122
+ post_install_message:
123
123
  rdoc_options: []
124
124
  require_paths:
125
125
  - lib
@@ -134,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
- rubygems_version: 3.1.6
138
- signing_key:
137
+ rubygems_version: 3.3.26
138
+ signing_key:
139
139
  specification_version: 4
140
140
  summary: Client side Ruby SDK for GitLab Application services
141
141
  test_files: []