trophy_api_client 1.0.12 → 1.0.14
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/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/users/client.rb +74 -2
- data/lib/trophy_api_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8366072c3be65aa0e4fa350f5d0b0313f9d38e1d907cb59f63982b3da33f7700
|
4
|
+
data.tar.gz: ec64eee7eb6cd567cdbc765933a6ca983cdbdb82179b53390cde72627988e91d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7049e227b0c5609be15587e82dd7c76ea4e4b3075eb6a94ba70b24eeb640a4ae0e1210d00bc58cc251f82334d8c2e8cbc7a31f03375b7f1195daf303c0007f2
|
7
|
+
data.tar.gz: '036865ebf9e563fb0feb20af8b457a732a9667a22521b6d0f757cf16a7f929b307f336b74c458a97f28a65b83b035e5ced77a00230b69fe76a97eef2b1d47b75'
|
data/lib/gemconfig.rb
CHANGED
@@ -26,7 +26,7 @@ module TrophyApiClient
|
|
26
26
|
@request_client = request_client
|
27
27
|
end
|
28
28
|
|
29
|
-
#
|
29
|
+
# Create a new user.
|
30
30
|
#
|
31
31
|
# @param request [Hash] The user object.Request of type TrophyApiClient::UpsertedUser, as a Hash
|
32
32
|
# * :id (String)
|
@@ -93,6 +93,41 @@ module TrophyApiClient
|
|
93
93
|
TrophyApiClient::User.from_json(json_object: response.body)
|
94
94
|
end
|
95
95
|
|
96
|
+
# Identify a user.
|
97
|
+
#
|
98
|
+
# @param id [String] ID of the user to identify.
|
99
|
+
# @param request [Hash] The user object.Request of type TrophyApiClient::UpdatedUser, as a Hash
|
100
|
+
# * :email (String)
|
101
|
+
# * :name (String)
|
102
|
+
# * :tz (String)
|
103
|
+
# * :subscribe_to_emails (Boolean)
|
104
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
105
|
+
# @return [TrophyApiClient::User]
|
106
|
+
# @example
|
107
|
+
# api = TrophyApiClient::Client.new(
|
108
|
+
# base_url: "https://api.example.com",
|
109
|
+
# environment: TrophyApiClient::Environment::DEFAULT,
|
110
|
+
# api_key: "YOUR_API_KEY"
|
111
|
+
# )
|
112
|
+
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London" })
|
113
|
+
def identify(id:, request:, request_options: nil)
|
114
|
+
response = @request_client.conn.put do |req|
|
115
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
116
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
117
|
+
req.headers = {
|
118
|
+
**(req.headers || {}),
|
119
|
+
**@request_client.get_headers,
|
120
|
+
**(request_options&.additional_headers || {})
|
121
|
+
}.compact
|
122
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
123
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
124
|
+
end
|
125
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
126
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}"
|
127
|
+
end
|
128
|
+
TrophyApiClient::User.from_json(json_object: response.body)
|
129
|
+
end
|
130
|
+
|
96
131
|
# Update a user.
|
97
132
|
#
|
98
133
|
# @param id [String] ID of the user to update.
|
@@ -410,7 +445,7 @@ module TrophyApiClient
|
|
410
445
|
@request_client = request_client
|
411
446
|
end
|
412
447
|
|
413
|
-
#
|
448
|
+
# Create a new user.
|
414
449
|
#
|
415
450
|
# @param request [Hash] The user object.Request of type TrophyApiClient::UpsertedUser, as a Hash
|
416
451
|
# * :id (String)
|
@@ -481,6 +516,43 @@ module TrophyApiClient
|
|
481
516
|
end
|
482
517
|
end
|
483
518
|
|
519
|
+
# Identify a user.
|
520
|
+
#
|
521
|
+
# @param id [String] ID of the user to identify.
|
522
|
+
# @param request [Hash] The user object.Request of type TrophyApiClient::UpdatedUser, as a Hash
|
523
|
+
# * :email (String)
|
524
|
+
# * :name (String)
|
525
|
+
# * :tz (String)
|
526
|
+
# * :subscribe_to_emails (Boolean)
|
527
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
528
|
+
# @return [TrophyApiClient::User]
|
529
|
+
# @example
|
530
|
+
# api = TrophyApiClient::Client.new(
|
531
|
+
# base_url: "https://api.example.com",
|
532
|
+
# environment: TrophyApiClient::Environment::DEFAULT,
|
533
|
+
# api_key: "YOUR_API_KEY"
|
534
|
+
# )
|
535
|
+
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London" })
|
536
|
+
def identify(id:, request:, request_options: nil)
|
537
|
+
Async do
|
538
|
+
response = @request_client.conn.put do |req|
|
539
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
540
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
541
|
+
req.headers = {
|
542
|
+
**(req.headers || {}),
|
543
|
+
**@request_client.get_headers,
|
544
|
+
**(request_options&.additional_headers || {})
|
545
|
+
}.compact
|
546
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
547
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
548
|
+
end
|
549
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
550
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}"
|
551
|
+
end
|
552
|
+
TrophyApiClient::User.from_json(json_object: response.body)
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
484
556
|
# Update a user.
|
485
557
|
#
|
486
558
|
# @param id [String] ID of the user to update.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trophy_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trophy Labs, Inc
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
|
-
rubygems_version: 3.6.
|
159
|
+
rubygems_version: 3.6.9
|
160
160
|
specification_version: 4
|
161
161
|
summary: Ruby library for the Trophy API.
|
162
162
|
test_files: []
|