userplex 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +15 -27
- data/lib/userplex/client.rb +3 -12
- data/lib/userplex/internal/transport/base_client.rb +0 -6
- data/lib/userplex/models/log_batch_params.rb +57 -0
- data/lib/userplex/models/log_batch_response.rb +16 -0
- data/lib/userplex/models/log_new_params.rb +46 -0
- data/lib/userplex/models/log_new_response.rb +16 -0
- data/lib/userplex/models/user_identify_params.rb +14 -14
- data/lib/userplex/models/user_identify_response.rb +1 -2
- data/lib/userplex/models.rb +4 -0
- data/lib/userplex/resources/logs.rb +60 -0
- data/lib/userplex/resources/users.rb +6 -9
- data/lib/userplex/version.rb +1 -1
- data/lib/userplex.rb +5 -1
- data/rbi/userplex/client.rbi +2 -7
- data/rbi/userplex/internal/transport/base_client.rbi +0 -5
- data/rbi/userplex/models/log_batch_params.rbi +113 -0
- data/rbi/userplex/models/log_batch_response.rbi +23 -0
- data/rbi/userplex/models/log_new_params.rbi +76 -0
- data/rbi/userplex/models/log_new_response.rbi +23 -0
- data/rbi/userplex/models/user_identify_params.rbi +17 -17
- data/rbi/userplex/models/user_identify_response.rbi +1 -5
- data/rbi/userplex/models.rbi +4 -0
- data/rbi/userplex/resources/logs.rbi +47 -0
- data/rbi/userplex/resources/users.rbi +6 -8
- data/sig/userplex/client.rbs +1 -3
- data/sig/userplex/internal/transport/base_client.rbs +0 -2
- data/sig/userplex/models/log_batch_params.rbs +66 -0
- data/sig/userplex/models/log_batch_response.rbs +13 -0
- data/sig/userplex/models/log_new_params.rbs +47 -0
- data/sig/userplex/models/log_new_response.rbs +13 -0
- data/sig/userplex/models/user_identify_params.rbs +8 -8
- data/sig/userplex/models.rbs +4 -0
- data/sig/userplex/resources/logs.rbs +20 -0
- data/sig/userplex/resources/users.rbs +1 -1
- metadata +17 -5
- data/lib/userplex/resources/events.rb +0 -14
- data/rbi/userplex/resources/events.rbi +0 -12
- data/sig/userplex/resources/events.rbs +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ccc461e8d1af92a26c98de1c70db8c715b417e06938ed86cb8f8fb1a44b7b5ad
|
|
4
|
+
data.tar.gz: 3bce0ceaddbc3900107fc0241c341ab7d5dcfeb6eb1c32973452bfaac1e4ef88
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe33e8b3d4f264cf611171829a4f46b898d73b074e0fdc0279fd48c195436b7ae5f48b029a8c7230e776431a3d26e336dd3fd6d73883cdd7028fe885d7e5d799
|
|
7
|
+
data.tar.gz: e56c69c304b83299744f3466795320332173db9fabc07b7dcc98f6d4570361da4010a3013f544456186110a4d061638f32bd1e3537ecab0ad5b49ee5b9e36832
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0 (2025-12-23)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.8.0...v0.9.0](https://github.com/dqnamo/userplex-ruby/compare/v0.8.0...v0.9.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** manual updates ([5a5e029](https://github.com/dqnamo/userplex-ruby/commit/5a5e0297d519ec2fbbd614f0a7b9835bf2c5a9aa))
|
|
10
|
+
|
|
11
|
+
## 0.8.0 (2025-12-19)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.7.0...v0.8.0](https://github.com/dqnamo/userplex-ruby/compare/v0.7.0...v0.8.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** manual updates ([300604c](https://github.com/dqnamo/userplex-ruby/commit/300604ca424ea6571bf0263b236d635847ff8866))
|
|
18
|
+
|
|
3
19
|
## 0.7.0 (2025-12-19)
|
|
4
20
|
|
|
5
21
|
Full Changelog: [v0.6.2...v0.7.0](https://github.com/dqnamo/userplex-ruby/compare/v0.6.2...v0.7.0)
|
data/README.md
CHANGED
|
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
15
15
|
<!-- x-release-please-start-version -->
|
|
16
16
|
|
|
17
17
|
```ruby
|
|
18
|
-
gem "userplex", "~> 0.
|
|
18
|
+
gem "userplex", "~> 0.9.0"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
<!-- x-release-please-end -->
|
|
@@ -26,11 +26,9 @@ gem "userplex", "~> 0.7.0"
|
|
|
26
26
|
require "bundler/setup"
|
|
27
27
|
require "userplex"
|
|
28
28
|
|
|
29
|
-
userplex = Userplex::Client.new(
|
|
30
|
-
api_key: ENV["USERPLEX_API_KEY"] # This is the default and can be omitted
|
|
31
|
-
)
|
|
29
|
+
userplex = Userplex::Client.new(api_key: "My API Key")
|
|
32
30
|
|
|
33
|
-
response = userplex.
|
|
31
|
+
response = userplex.logs.new(name: "REPLACE_ME")
|
|
34
32
|
|
|
35
33
|
puts(response.success)
|
|
36
34
|
```
|
|
@@ -41,7 +39,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
|
|
|
41
39
|
|
|
42
40
|
```ruby
|
|
43
41
|
begin
|
|
44
|
-
|
|
42
|
+
log = userplex.logs.new(name: "REPLACE_ME")
|
|
45
43
|
rescue Userplex::Errors::APIConnectionError => e
|
|
46
44
|
puts("The server could not be reached")
|
|
47
45
|
puts(e.cause) # an underlying Exception, likely raised within `net/http`
|
|
@@ -80,16 +78,12 @@ You can use the `max_retries` option to configure or disable this:
|
|
|
80
78
|
```ruby
|
|
81
79
|
# Configure the default for all requests:
|
|
82
80
|
userplex = Userplex::Client.new(
|
|
83
|
-
max_retries: 0 # default is 2
|
|
81
|
+
max_retries: 0, # default is 2
|
|
82
|
+
api_key: "My API Key"
|
|
84
83
|
)
|
|
85
84
|
|
|
86
85
|
# Or, configure per-request:
|
|
87
|
-
userplex.
|
|
88
|
-
user_id: "user_id",
|
|
89
|
-
email: "REPLACE_ME",
|
|
90
|
-
name: "REPLACE_ME",
|
|
91
|
-
request_options: {max_retries: 5}
|
|
92
|
-
)
|
|
86
|
+
userplex.logs.new(name: "REPLACE_ME", request_options: {max_retries: 5})
|
|
93
87
|
```
|
|
94
88
|
|
|
95
89
|
### Timeouts
|
|
@@ -99,16 +93,12 @@ By default, requests will time out after 60 seconds. You can use the timeout opt
|
|
|
99
93
|
```ruby
|
|
100
94
|
# Configure the default for all requests:
|
|
101
95
|
userplex = Userplex::Client.new(
|
|
102
|
-
timeout: nil # default is 60
|
|
96
|
+
timeout: nil, # default is 60
|
|
97
|
+
api_key: "My API Key"
|
|
103
98
|
)
|
|
104
99
|
|
|
105
100
|
# Or, configure per-request:
|
|
106
|
-
userplex.
|
|
107
|
-
user_id: "user_id",
|
|
108
|
-
email: "REPLACE_ME",
|
|
109
|
-
name: "REPLACE_ME",
|
|
110
|
-
request_options: {timeout: 5}
|
|
111
|
-
)
|
|
101
|
+
userplex.logs.new(name: "REPLACE_ME", request_options: {timeout: 5})
|
|
112
102
|
```
|
|
113
103
|
|
|
114
104
|
On timeout, `Userplex::Errors::APITimeoutError` is raised.
|
|
@@ -139,9 +129,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
|
|
|
139
129
|
|
|
140
130
|
```ruby
|
|
141
131
|
response =
|
|
142
|
-
userplex.
|
|
143
|
-
user_id: "user_id",
|
|
144
|
-
email: "REPLACE_ME",
|
|
132
|
+
userplex.logs.new(
|
|
145
133
|
name: "REPLACE_ME",
|
|
146
134
|
request_options: {
|
|
147
135
|
extra_query: {my_query_parameter: value},
|
|
@@ -188,18 +176,18 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
|
|
|
188
176
|
You can provide typesafe request parameters like so:
|
|
189
177
|
|
|
190
178
|
```ruby
|
|
191
|
-
userplex.
|
|
179
|
+
userplex.logs.new(name: "REPLACE_ME")
|
|
192
180
|
```
|
|
193
181
|
|
|
194
182
|
Or, equivalently:
|
|
195
183
|
|
|
196
184
|
```ruby
|
|
197
185
|
# Hashes work, but are not typesafe:
|
|
198
|
-
userplex.
|
|
186
|
+
userplex.logs.new(name: "REPLACE_ME")
|
|
199
187
|
|
|
200
188
|
# You can also splat a full Params class:
|
|
201
|
-
params = Userplex::
|
|
202
|
-
userplex.
|
|
189
|
+
params = Userplex::LogNewParams.new(name: "REPLACE_ME")
|
|
190
|
+
userplex.logs.new(**params)
|
|
203
191
|
```
|
|
204
192
|
|
|
205
193
|
## Versioning
|
data/lib/userplex/client.rb
CHANGED
|
@@ -22,17 +22,8 @@ module Userplex
|
|
|
22
22
|
# @return [Userplex::Resources::Users]
|
|
23
23
|
attr_reader :users
|
|
24
24
|
|
|
25
|
-
# @return [Userplex::Resources::
|
|
26
|
-
attr_reader :
|
|
27
|
-
|
|
28
|
-
# @api private
|
|
29
|
-
#
|
|
30
|
-
# @return [Hash{String=>String}]
|
|
31
|
-
private def auth_headers
|
|
32
|
-
return {} if @api_key.nil?
|
|
33
|
-
|
|
34
|
-
{"authorization" => "Bearer #{@api_key}"}
|
|
35
|
-
end
|
|
25
|
+
# @return [Userplex::Resources::Logs]
|
|
26
|
+
attr_reader :logs
|
|
36
27
|
|
|
37
28
|
# Creates and returns a new client for interacting with the API.
|
|
38
29
|
#
|
|
@@ -74,7 +65,7 @@ module Userplex
|
|
|
74
65
|
)
|
|
75
66
|
|
|
76
67
|
@users = Userplex::Resources::Users.new(client: self)
|
|
77
|
-
@
|
|
68
|
+
@logs = Userplex::Resources::Logs.new(client: self)
|
|
78
69
|
end
|
|
79
70
|
end
|
|
80
71
|
end
|
|
@@ -215,11 +215,6 @@ module Userplex
|
|
|
215
215
|
@max_retry_delay = max_retry_delay
|
|
216
216
|
end
|
|
217
217
|
|
|
218
|
-
# @api private
|
|
219
|
-
#
|
|
220
|
-
# @return [Hash{String=>String}]
|
|
221
|
-
private def auth_headers = {}
|
|
222
|
-
|
|
223
218
|
# @api private
|
|
224
219
|
#
|
|
225
220
|
# @return [String]
|
|
@@ -276,7 +271,6 @@ module Userplex
|
|
|
276
271
|
|
|
277
272
|
headers = Userplex::Internal::Util.normalized_headers(
|
|
278
273
|
@headers,
|
|
279
|
-
auth_headers,
|
|
280
274
|
req[:headers].to_h,
|
|
281
275
|
opts[:extra_headers].to_h
|
|
282
276
|
)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Userplex
|
|
4
|
+
module Models
|
|
5
|
+
# @see Userplex::Resources::Logs#batch
|
|
6
|
+
class LogBatchParams < Userplex::Internal::Type::BaseModel
|
|
7
|
+
extend Userplex::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Userplex::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute body
|
|
11
|
+
# A list of logs to ingest
|
|
12
|
+
#
|
|
13
|
+
# @return [Array<Userplex::Models::LogBatchParams::Body>, nil]
|
|
14
|
+
optional :body, -> { Userplex::Internal::Type::ArrayOf[Userplex::LogBatchParams::Body] }
|
|
15
|
+
|
|
16
|
+
# @!method initialize(body: nil, request_options: {})
|
|
17
|
+
# @param body [Array<Userplex::Models::LogBatchParams::Body>] A list of logs to ingest
|
|
18
|
+
#
|
|
19
|
+
# @param request_options [Userplex::RequestOptions, Hash{Symbol=>Object}]
|
|
20
|
+
|
|
21
|
+
class Body < Userplex::Internal::Type::BaseModel
|
|
22
|
+
# @!attribute name
|
|
23
|
+
# Log name
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
required :name, String
|
|
27
|
+
|
|
28
|
+
# @!attribute data
|
|
29
|
+
# Additional log data
|
|
30
|
+
#
|
|
31
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
32
|
+
optional :data, Userplex::Internal::Type::HashOf[Userplex::Internal::Type::Unknown]
|
|
33
|
+
|
|
34
|
+
# @!attribute timestamp
|
|
35
|
+
# Log timestamp (ISO 8601)
|
|
36
|
+
#
|
|
37
|
+
# @return [Time, nil]
|
|
38
|
+
optional :timestamp, Time
|
|
39
|
+
|
|
40
|
+
# @!attribute user_id
|
|
41
|
+
# External user ID
|
|
42
|
+
#
|
|
43
|
+
# @return [String, nil]
|
|
44
|
+
optional :user_id, String
|
|
45
|
+
|
|
46
|
+
# @!method initialize(name:, data: nil, timestamp: nil, user_id: nil)
|
|
47
|
+
# @param name [String] Log name
|
|
48
|
+
#
|
|
49
|
+
# @param data [Hash{Symbol=>Object}] Additional log data
|
|
50
|
+
#
|
|
51
|
+
# @param timestamp [Time] Log timestamp (ISO 8601)
|
|
52
|
+
#
|
|
53
|
+
# @param user_id [String] External user ID
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Userplex
|
|
4
|
+
module Models
|
|
5
|
+
# @see Userplex::Resources::Logs#batch
|
|
6
|
+
class LogBatchResponse < Userplex::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute success
|
|
8
|
+
#
|
|
9
|
+
# @return [Boolean]
|
|
10
|
+
required :success, Userplex::Internal::Type::Boolean
|
|
11
|
+
|
|
12
|
+
# @!method initialize(success:)
|
|
13
|
+
# @param success [Boolean]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Userplex
|
|
4
|
+
module Models
|
|
5
|
+
# @see Userplex::Resources::Logs#new
|
|
6
|
+
class LogNewParams < Userplex::Internal::Type::BaseModel
|
|
7
|
+
extend Userplex::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Userplex::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute name
|
|
11
|
+
# Log name
|
|
12
|
+
#
|
|
13
|
+
# @return [String]
|
|
14
|
+
required :name, String
|
|
15
|
+
|
|
16
|
+
# @!attribute data
|
|
17
|
+
# Additional log data
|
|
18
|
+
#
|
|
19
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
20
|
+
optional :data, Userplex::Internal::Type::HashOf[Userplex::Internal::Type::Unknown]
|
|
21
|
+
|
|
22
|
+
# @!attribute timestamp
|
|
23
|
+
# Log timestamp (ISO 8601)
|
|
24
|
+
#
|
|
25
|
+
# @return [Time, nil]
|
|
26
|
+
optional :timestamp, Time
|
|
27
|
+
|
|
28
|
+
# @!attribute user_id
|
|
29
|
+
# External user ID
|
|
30
|
+
#
|
|
31
|
+
# @return [String, nil]
|
|
32
|
+
optional :user_id, String
|
|
33
|
+
|
|
34
|
+
# @!method initialize(name:, data: nil, timestamp: nil, user_id: nil, request_options: {})
|
|
35
|
+
# @param name [String] Log name
|
|
36
|
+
#
|
|
37
|
+
# @param data [Hash{Symbol=>Object}] Additional log data
|
|
38
|
+
#
|
|
39
|
+
# @param timestamp [Time] Log timestamp (ISO 8601)
|
|
40
|
+
#
|
|
41
|
+
# @param user_id [String] External user ID
|
|
42
|
+
#
|
|
43
|
+
# @param request_options [Userplex::RequestOptions, Hash{Symbol=>Object}]
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Userplex
|
|
4
|
+
module Models
|
|
5
|
+
# @see Userplex::Resources::Logs#new
|
|
6
|
+
class LogNewResponse < Userplex::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute success
|
|
8
|
+
#
|
|
9
|
+
# @return [Boolean]
|
|
10
|
+
required :success, Userplex::Internal::Type::Boolean
|
|
11
|
+
|
|
12
|
+
# @!method initialize(success:)
|
|
13
|
+
# @param success [Boolean]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -8,37 +8,37 @@ module Userplex
|
|
|
8
8
|
include Userplex::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
10
|
# @!attribute user_id
|
|
11
|
-
#
|
|
11
|
+
# External user ID
|
|
12
12
|
#
|
|
13
13
|
# @return [String]
|
|
14
14
|
required :user_id, String
|
|
15
15
|
|
|
16
|
+
# @!attribute attributes
|
|
17
|
+
# Additional user attributes
|
|
18
|
+
#
|
|
19
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
20
|
+
optional :attributes, Userplex::Internal::Type::HashOf[Userplex::Internal::Type::Unknown]
|
|
21
|
+
|
|
16
22
|
# @!attribute email
|
|
17
|
-
# User email
|
|
23
|
+
# User email
|
|
18
24
|
#
|
|
19
25
|
# @return [String, nil]
|
|
20
26
|
optional :email, String
|
|
21
27
|
|
|
22
28
|
# @!attribute name
|
|
23
|
-
# User
|
|
29
|
+
# User name
|
|
24
30
|
#
|
|
25
31
|
# @return [String, nil]
|
|
26
32
|
optional :name, String
|
|
27
33
|
|
|
28
|
-
# @!
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
# @return [Hash{Symbol=>Object, nil}, nil]
|
|
32
|
-
optional :properties, Userplex::Internal::Type::HashOf[Userplex::Internal::Type::Unknown, nil?: true]
|
|
33
|
-
|
|
34
|
-
# @!method initialize(user_id:, email: nil, name: nil, properties: nil, request_options: {})
|
|
35
|
-
# @param user_id [String] Unique identifier for the user
|
|
34
|
+
# @!method initialize(user_id:, attributes: nil, email: nil, name: nil, request_options: {})
|
|
35
|
+
# @param user_id [String] External user ID
|
|
36
36
|
#
|
|
37
|
-
# @param
|
|
37
|
+
# @param attributes [Hash{Symbol=>Object}] Additional user attributes
|
|
38
38
|
#
|
|
39
|
-
# @param
|
|
39
|
+
# @param email [String] User email
|
|
40
40
|
#
|
|
41
|
-
# @param
|
|
41
|
+
# @param name [String] User name
|
|
42
42
|
#
|
|
43
43
|
# @param request_options [Userplex::RequestOptions, Hash{Symbol=>Object}]
|
|
44
44
|
end
|
|
@@ -5,13 +5,12 @@ module Userplex
|
|
|
5
5
|
# @see Userplex::Resources::Users#identify
|
|
6
6
|
class UserIdentifyResponse < Userplex::Internal::Type::BaseModel
|
|
7
7
|
# @!attribute success
|
|
8
|
-
# Operation success status
|
|
9
8
|
#
|
|
10
9
|
# @return [Boolean]
|
|
11
10
|
required :success, Userplex::Internal::Type::Boolean
|
|
12
11
|
|
|
13
12
|
# @!method initialize(success:)
|
|
14
|
-
# @param success [Boolean]
|
|
13
|
+
# @param success [Boolean]
|
|
15
14
|
end
|
|
16
15
|
end
|
|
17
16
|
end
|
data/lib/userplex/models.rb
CHANGED
|
@@ -39,5 +39,9 @@ module Userplex
|
|
|
39
39
|
mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
LogBatchParams = Userplex::Models::LogBatchParams
|
|
43
|
+
|
|
44
|
+
LogNewParams = Userplex::Models::LogNewParams
|
|
45
|
+
|
|
42
46
|
UserIdentifyParams = Userplex::Models::UserIdentifyParams
|
|
43
47
|
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Userplex
|
|
4
|
+
module Resources
|
|
5
|
+
class Logs
|
|
6
|
+
# @overload batch(body: nil, request_options: {})
|
|
7
|
+
#
|
|
8
|
+
# @param body [Array<Userplex::Models::LogBatchParams::Body>] A list of logs to ingest
|
|
9
|
+
#
|
|
10
|
+
# @param request_options [Userplex::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
11
|
+
#
|
|
12
|
+
# @return [Userplex::Models::LogBatchResponse]
|
|
13
|
+
#
|
|
14
|
+
# @see Userplex::Models::LogBatchParams
|
|
15
|
+
def batch(params = {})
|
|
16
|
+
parsed, options = Userplex::LogBatchParams.dump_request(params)
|
|
17
|
+
@client.request(
|
|
18
|
+
method: :post,
|
|
19
|
+
path: "logs",
|
|
20
|
+
body: parsed[:body],
|
|
21
|
+
model: Userplex::Models::LogBatchResponse,
|
|
22
|
+
options: options
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @overload new(name:, data: nil, timestamp: nil, user_id: nil, request_options: {})
|
|
27
|
+
#
|
|
28
|
+
# @param name [String] Log name
|
|
29
|
+
#
|
|
30
|
+
# @param data [Hash{Symbol=>Object}] Additional log data
|
|
31
|
+
#
|
|
32
|
+
# @param timestamp [Time] Log timestamp (ISO 8601)
|
|
33
|
+
#
|
|
34
|
+
# @param user_id [String] External user ID
|
|
35
|
+
#
|
|
36
|
+
# @param request_options [Userplex::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
37
|
+
#
|
|
38
|
+
# @return [Userplex::Models::LogNewResponse]
|
|
39
|
+
#
|
|
40
|
+
# @see Userplex::Models::LogNewParams
|
|
41
|
+
def new(params)
|
|
42
|
+
parsed, options = Userplex::LogNewParams.dump_request(params)
|
|
43
|
+
@client.request(
|
|
44
|
+
method: :post,
|
|
45
|
+
path: "log",
|
|
46
|
+
body: parsed,
|
|
47
|
+
model: Userplex::Models::LogNewResponse,
|
|
48
|
+
options: options
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @api private
|
|
53
|
+
#
|
|
54
|
+
# @param client [Userplex::Client]
|
|
55
|
+
def initialize(client:)
|
|
56
|
+
@client = client
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
module Userplex
|
|
4
4
|
module Resources
|
|
5
5
|
class Users
|
|
6
|
-
#
|
|
7
|
-
# Requires a valid API key for authentication.
|
|
6
|
+
# @overload identify(user_id:, attributes: nil, email: nil, name: nil, request_options: {})
|
|
8
7
|
#
|
|
9
|
-
# @
|
|
8
|
+
# @param user_id [String] External user ID
|
|
10
9
|
#
|
|
11
|
-
# @param
|
|
10
|
+
# @param attributes [Hash{Symbol=>Object}] Additional user attributes
|
|
12
11
|
#
|
|
13
|
-
# @param email [String] User email
|
|
12
|
+
# @param email [String] User email
|
|
14
13
|
#
|
|
15
|
-
# @param name [String] User
|
|
16
|
-
#
|
|
17
|
-
# @param properties [Hash{Symbol=>Object, nil}] Additional user properties
|
|
14
|
+
# @param name [String] User name
|
|
18
15
|
#
|
|
19
16
|
# @param request_options [Userplex::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
20
17
|
#
|
|
@@ -25,7 +22,7 @@ module Userplex
|
|
|
25
22
|
parsed, options = Userplex::UserIdentifyParams.dump_request(params)
|
|
26
23
|
@client.request(
|
|
27
24
|
method: :post,
|
|
28
|
-
path: "
|
|
25
|
+
path: "identify",
|
|
29
26
|
body: parsed,
|
|
30
27
|
model: Userplex::Models::UserIdentifyResponse,
|
|
31
28
|
options: options
|
data/lib/userplex/version.rb
CHANGED
data/lib/userplex.rb
CHANGED
|
@@ -52,8 +52,12 @@ require_relative "userplex/errors"
|
|
|
52
52
|
require_relative "userplex/internal/transport/base_client"
|
|
53
53
|
require_relative "userplex/internal/transport/pooled_net_requester"
|
|
54
54
|
require_relative "userplex/client"
|
|
55
|
+
require_relative "userplex/models/log_batch_params"
|
|
56
|
+
require_relative "userplex/models/log_batch_response"
|
|
57
|
+
require_relative "userplex/models/log_new_params"
|
|
58
|
+
require_relative "userplex/models/log_new_response"
|
|
55
59
|
require_relative "userplex/models/user_identify_params"
|
|
56
60
|
require_relative "userplex/models/user_identify_response"
|
|
57
61
|
require_relative "userplex/models"
|
|
58
|
-
require_relative "userplex/resources/
|
|
62
|
+
require_relative "userplex/resources/logs"
|
|
59
63
|
require_relative "userplex/resources/users"
|
data/rbi/userplex/client.rbi
CHANGED
|
@@ -17,13 +17,8 @@ module Userplex
|
|
|
17
17
|
sig { returns(Userplex::Resources::Users) }
|
|
18
18
|
attr_reader :users
|
|
19
19
|
|
|
20
|
-
sig { returns(Userplex::Resources::
|
|
21
|
-
attr_reader :
|
|
22
|
-
|
|
23
|
-
# @api private
|
|
24
|
-
sig { override.returns(T::Hash[String, String]) }
|
|
25
|
-
private def auth_headers
|
|
26
|
-
end
|
|
20
|
+
sig { returns(Userplex::Resources::Logs) }
|
|
21
|
+
attr_reader :logs
|
|
27
22
|
|
|
28
23
|
# Creates and returns a new client for interacting with the API.
|
|
29
24
|
sig do
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Userplex
|
|
4
|
+
module Models
|
|
5
|
+
class LogBatchParams < Userplex::Internal::Type::BaseModel
|
|
6
|
+
extend Userplex::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include Userplex::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(Userplex::LogBatchParams, Userplex::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# A list of logs to ingest
|
|
15
|
+
sig { returns(T.nilable(T::Array[Userplex::LogBatchParams::Body])) }
|
|
16
|
+
attr_reader :body
|
|
17
|
+
|
|
18
|
+
sig do
|
|
19
|
+
params(body: T::Array[Userplex::LogBatchParams::Body::OrHash]).void
|
|
20
|
+
end
|
|
21
|
+
attr_writer :body
|
|
22
|
+
|
|
23
|
+
sig do
|
|
24
|
+
params(
|
|
25
|
+
body: T::Array[Userplex::LogBatchParams::Body::OrHash],
|
|
26
|
+
request_options: Userplex::RequestOptions::OrHash
|
|
27
|
+
).returns(T.attached_class)
|
|
28
|
+
end
|
|
29
|
+
def self.new(
|
|
30
|
+
# A list of logs to ingest
|
|
31
|
+
body: nil,
|
|
32
|
+
request_options: {}
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
sig do
|
|
37
|
+
override.returns(
|
|
38
|
+
{
|
|
39
|
+
body: T::Array[Userplex::LogBatchParams::Body],
|
|
40
|
+
request_options: Userplex::RequestOptions
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
def to_hash
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class Body < Userplex::Internal::Type::BaseModel
|
|
48
|
+
OrHash =
|
|
49
|
+
T.type_alias do
|
|
50
|
+
T.any(Userplex::LogBatchParams::Body, Userplex::Internal::AnyHash)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Log name
|
|
54
|
+
sig { returns(String) }
|
|
55
|
+
attr_accessor :name
|
|
56
|
+
|
|
57
|
+
# Additional log data
|
|
58
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
59
|
+
attr_reader :data
|
|
60
|
+
|
|
61
|
+
sig { params(data: T::Hash[Symbol, T.anything]).void }
|
|
62
|
+
attr_writer :data
|
|
63
|
+
|
|
64
|
+
# Log timestamp (ISO 8601)
|
|
65
|
+
sig { returns(T.nilable(Time)) }
|
|
66
|
+
attr_reader :timestamp
|
|
67
|
+
|
|
68
|
+
sig { params(timestamp: Time).void }
|
|
69
|
+
attr_writer :timestamp
|
|
70
|
+
|
|
71
|
+
# External user ID
|
|
72
|
+
sig { returns(T.nilable(String)) }
|
|
73
|
+
attr_reader :user_id
|
|
74
|
+
|
|
75
|
+
sig { params(user_id: String).void }
|
|
76
|
+
attr_writer :user_id
|
|
77
|
+
|
|
78
|
+
sig do
|
|
79
|
+
params(
|
|
80
|
+
name: String,
|
|
81
|
+
data: T::Hash[Symbol, T.anything],
|
|
82
|
+
timestamp: Time,
|
|
83
|
+
user_id: String
|
|
84
|
+
).returns(T.attached_class)
|
|
85
|
+
end
|
|
86
|
+
def self.new(
|
|
87
|
+
# Log name
|
|
88
|
+
name:,
|
|
89
|
+
# Additional log data
|
|
90
|
+
data: nil,
|
|
91
|
+
# Log timestamp (ISO 8601)
|
|
92
|
+
timestamp: nil,
|
|
93
|
+
# External user ID
|
|
94
|
+
user_id: nil
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
sig do
|
|
99
|
+
override.returns(
|
|
100
|
+
{
|
|
101
|
+
name: String,
|
|
102
|
+
data: T::Hash[Symbol, T.anything],
|
|
103
|
+
timestamp: Time,
|
|
104
|
+
user_id: String
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
end
|
|
108
|
+
def to_hash
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|