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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/gitlab-sdk/client.rb +15 -4
- data/lib/gitlab-sdk/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38ec160731634aef4547e601d3e8b69ad5c885963d9236e89d8eff213c28743f
|
4
|
+
data.tar.gz: bf4a0c6454ae9102211a1fc3e8bcd7f3bd4b928d96a4703f92f9d2bcd07a4afd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91844d2429060c4ad01212d9306a4073e4f631296fee2361dc344dc4c8fe25147796361e348a0af567e0c0f13a287befb4427923c8238b30c5991f2a64be7ed4
|
7
|
+
data.tar.gz: 8cce8707020443c8dd48aae6c0de1d8cd5601b8404209d446bf53a70b5244d06e98b1f6c61745f0daef3e413d85799b14510bfeb202a40c06b47d3628c63f20f
|
data/Gemfile.lock
CHANGED
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
|
|
data/lib/gitlab-sdk/client.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/gitlab-sdk/version.rb
CHANGED
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.
|
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-
|
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.
|
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: []
|