trophy_api_client 1.0.16 → 1.0.17
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/achievements/client.rb +9 -5
- data/lib/trophy_api_client/metrics/client.rb +26 -8
- data/lib/trophy_api_client/points/client.rb +37 -33
- data/lib/trophy_api_client/types/achievement_completion_response.rb +16 -2
- data/lib/trophy_api_client/types/achievement_with_stats_response.rb +39 -9
- data/lib/trophy_api_client/types/achievement_with_stats_response_event_attribute.rb +69 -0
- data/lib/trophy_api_client/types/achievement_with_stats_response_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/event_response.rb +6 -11
- data/lib/trophy_api_client/types/get_user_points_response.rb +41 -6
- data/lib/trophy_api_client/types/metric_event_points_response.rb +43 -6
- data/lib/trophy_api_client/types/points_system_response.rb +98 -0
- data/lib/trophy_api_client/types/points_trigger_response.rb +31 -1
- data/lib/trophy_api_client/types/points_trigger_response_event_attribute.rb +67 -0
- data/lib/trophy_api_client/types/points_trigger_response_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/updated_user.rb +12 -2
- data/lib/trophy_api_client/types/upserted_user.rb +12 -2
- data/lib/trophy_api_client/types/user.rb +12 -2
- data/lib/trophy_api_client/users/client.rb +52 -30
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +5 -0
- metadata +6 -1
@@ -19,6 +19,9 @@ module TrophyApiClient
|
|
19
19
|
# @return [Boolean] Whether the user should receive Trophy-powered emails. If false, Trophy will not
|
20
20
|
# store the user's email address.
|
21
21
|
attr_reader :subscribe_to_emails
|
22
|
+
# @return [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
|
23
|
+
# up in the Trophy dashboard.
|
24
|
+
attr_reader :attributes
|
22
25
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
23
26
|
attr_reader :additional_properties
|
24
27
|
# @return [Object]
|
@@ -34,16 +37,19 @@ module TrophyApiClient
|
|
34
37
|
# @param device_tokens [Array<String>] The user's device tokens, used for push notifications.
|
35
38
|
# @param subscribe_to_emails [Boolean] Whether the user should receive Trophy-powered emails. If false, Trophy will not
|
36
39
|
# store the user's email address.
|
40
|
+
# @param attributes [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
|
41
|
+
# up in the Trophy dashboard.
|
37
42
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
38
43
|
# @return [TrophyApiClient::UpsertedUser]
|
39
44
|
def initialize(id:, email: OMIT, name: OMIT, tz: OMIT, device_tokens: OMIT, subscribe_to_emails: OMIT,
|
40
|
-
additional_properties: nil)
|
45
|
+
attributes: OMIT, additional_properties: nil)
|
41
46
|
@id = id
|
42
47
|
@email = email if email != OMIT
|
43
48
|
@name = name if name != OMIT
|
44
49
|
@tz = tz if tz != OMIT
|
45
50
|
@device_tokens = device_tokens if device_tokens != OMIT
|
46
51
|
@subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
|
52
|
+
@attributes = attributes if attributes != OMIT
|
47
53
|
@additional_properties = additional_properties
|
48
54
|
@_field_set = {
|
49
55
|
"id": id,
|
@@ -51,7 +57,8 @@ module TrophyApiClient
|
|
51
57
|
"name": name,
|
52
58
|
"tz": tz,
|
53
59
|
"deviceTokens": device_tokens,
|
54
|
-
"subscribeToEmails": subscribe_to_emails
|
60
|
+
"subscribeToEmails": subscribe_to_emails,
|
61
|
+
"attributes": attributes
|
55
62
|
}.reject do |_k, v|
|
56
63
|
v == OMIT
|
57
64
|
end
|
@@ -70,6 +77,7 @@ module TrophyApiClient
|
|
70
77
|
tz = parsed_json["tz"]
|
71
78
|
device_tokens = parsed_json["deviceTokens"]
|
72
79
|
subscribe_to_emails = parsed_json["subscribeToEmails"]
|
80
|
+
attributes = parsed_json["attributes"]
|
73
81
|
new(
|
74
82
|
id: id,
|
75
83
|
email: email,
|
@@ -77,6 +85,7 @@ module TrophyApiClient
|
|
77
85
|
tz: tz,
|
78
86
|
device_tokens: device_tokens,
|
79
87
|
subscribe_to_emails: subscribe_to_emails,
|
88
|
+
attributes: attributes,
|
80
89
|
additional_properties: struct
|
81
90
|
)
|
82
91
|
end
|
@@ -101,6 +110,7 @@ module TrophyApiClient
|
|
101
110
|
obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
|
102
111
|
obj.device_tokens&.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
|
103
112
|
obj.subscribe_to_emails&.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
|
113
|
+
obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
|
104
114
|
end
|
105
115
|
end
|
106
116
|
end
|
@@ -27,6 +27,9 @@ module TrophyApiClient
|
|
27
27
|
# @return [Boolean] Whether the user should receive Trophy-powered emails. If false, Trophy will not
|
28
28
|
# store the user's email address.
|
29
29
|
attr_reader :subscribe_to_emails
|
30
|
+
# @return [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
|
31
|
+
# up in the Trophy dashboard.
|
32
|
+
attr_reader :attributes
|
30
33
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
31
34
|
attr_reader :additional_properties
|
32
35
|
# @return [Object]
|
@@ -46,10 +49,12 @@ module TrophyApiClient
|
|
46
49
|
# @param device_tokens [Array<String>] The user's device tokens, used for push notifications.
|
47
50
|
# @param subscribe_to_emails [Boolean] Whether the user should receive Trophy-powered emails. If false, Trophy will not
|
48
51
|
# store the user's email address.
|
52
|
+
# @param attributes [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
|
53
|
+
# up in the Trophy dashboard.
|
49
54
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
50
55
|
# @return [TrophyApiClient::User]
|
51
56
|
def initialize(id:, control: OMIT, created: OMIT, updated: OMIT, email: OMIT, name: OMIT, tz: OMIT,
|
52
|
-
device_tokens: OMIT, subscribe_to_emails: OMIT, additional_properties: nil)
|
57
|
+
device_tokens: OMIT, subscribe_to_emails: OMIT, attributes: OMIT, additional_properties: nil)
|
53
58
|
@control = control if control != OMIT
|
54
59
|
@created = created if created != OMIT
|
55
60
|
@updated = updated if updated != OMIT
|
@@ -59,6 +64,7 @@ module TrophyApiClient
|
|
59
64
|
@tz = tz if tz != OMIT
|
60
65
|
@device_tokens = device_tokens if device_tokens != OMIT
|
61
66
|
@subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
|
67
|
+
@attributes = attributes if attributes != OMIT
|
62
68
|
@additional_properties = additional_properties
|
63
69
|
@_field_set = {
|
64
70
|
"control": control,
|
@@ -69,7 +75,8 @@ module TrophyApiClient
|
|
69
75
|
"name": name,
|
70
76
|
"tz": tz,
|
71
77
|
"deviceTokens": device_tokens,
|
72
|
-
"subscribeToEmails": subscribe_to_emails
|
78
|
+
"subscribeToEmails": subscribe_to_emails,
|
79
|
+
"attributes": attributes
|
73
80
|
}.reject do |_k, v|
|
74
81
|
v == OMIT
|
75
82
|
end
|
@@ -91,6 +98,7 @@ module TrophyApiClient
|
|
91
98
|
tz = parsed_json["tz"]
|
92
99
|
device_tokens = parsed_json["deviceTokens"]
|
93
100
|
subscribe_to_emails = parsed_json["subscribeToEmails"]
|
101
|
+
attributes = parsed_json["attributes"]
|
94
102
|
new(
|
95
103
|
control: control,
|
96
104
|
created: created,
|
@@ -101,6 +109,7 @@ module TrophyApiClient
|
|
101
109
|
tz: tz,
|
102
110
|
device_tokens: device_tokens,
|
103
111
|
subscribe_to_emails: subscribe_to_emails,
|
112
|
+
attributes: attributes,
|
104
113
|
additional_properties: struct
|
105
114
|
)
|
106
115
|
end
|
@@ -128,6 +137,7 @@ module TrophyApiClient
|
|
128
137
|
obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
|
129
138
|
obj.device_tokens&.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
|
130
139
|
obj.subscribe_to_emails&.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
|
140
|
+
obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
|
131
141
|
end
|
132
142
|
end
|
133
143
|
end
|
@@ -35,6 +35,7 @@ module TrophyApiClient
|
|
35
35
|
# * :tz (String)
|
36
36
|
# * :device_tokens (Array<String>)
|
37
37
|
# * :subscribe_to_emails (Boolean)
|
38
|
+
# * :attributes (Hash{String => String})
|
38
39
|
# @param request_options [TrophyApiClient::RequestOptions]
|
39
40
|
# @return [TrophyApiClient::User]
|
40
41
|
# @example
|
@@ -103,6 +104,7 @@ module TrophyApiClient
|
|
103
104
|
# * :tz (String)
|
104
105
|
# * :device_tokens (Array<String>)
|
105
106
|
# * :subscribe_to_emails (Boolean)
|
107
|
+
# * :attributes (Hash{String => String})
|
106
108
|
# @param request_options [TrophyApiClient::RequestOptions]
|
107
109
|
# @return [TrophyApiClient::User]
|
108
110
|
# @example
|
@@ -111,7 +113,7 @@ module TrophyApiClient
|
|
111
113
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
112
114
|
# api_key: "YOUR_API_KEY"
|
113
115
|
# )
|
114
|
-
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London" })
|
116
|
+
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
115
117
|
def identify(id:, request:, request_options: nil)
|
116
118
|
response = @request_client.conn.put do |req|
|
117
119
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -139,6 +141,7 @@ module TrophyApiClient
|
|
139
141
|
# * :tz (String)
|
140
142
|
# * :device_tokens (Array<String>)
|
141
143
|
# * :subscribe_to_emails (Boolean)
|
144
|
+
# * :attributes (Hash{String => String})
|
142
145
|
# @param request_options [TrophyApiClient::RequestOptions]
|
143
146
|
# @return [TrophyApiClient::User]
|
144
147
|
# @example
|
@@ -147,7 +150,7 @@ module TrophyApiClient
|
|
147
150
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
148
151
|
# api_key: "YOUR_API_KEY"
|
149
152
|
# )
|
150
|
-
# api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London" })
|
153
|
+
# api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
151
154
|
def update(id:, request:, request_options: nil)
|
152
155
|
response = @request_client.conn.patch do |req|
|
153
156
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -286,9 +289,12 @@ module TrophyApiClient
|
|
286
289
|
end
|
287
290
|
end
|
288
291
|
|
289
|
-
# Get
|
292
|
+
# Get a user's achievements.
|
290
293
|
#
|
291
294
|
# @param id [String] ID of the user.
|
295
|
+
# @param include_incomplete [String] When set to 'true', returns both completed and incomplete achievements for the
|
296
|
+
# user. When omitted or set to any other value, returns only completed
|
297
|
+
# achievements.
|
292
298
|
# @param request_options [TrophyApiClient::RequestOptions]
|
293
299
|
# @return [Array<TrophyApiClient::CompletedAchievementResponse>]
|
294
300
|
# @example
|
@@ -297,8 +303,8 @@ module TrophyApiClient
|
|
297
303
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
298
304
|
# api_key: "YOUR_API_KEY"
|
299
305
|
# )
|
300
|
-
# api.users.
|
301
|
-
def
|
306
|
+
# api.users.achievements(id: "userId")
|
307
|
+
def achievements(id:, include_incomplete: nil, request_options: nil)
|
302
308
|
response = @request_client.conn.get do |req|
|
303
309
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
304
310
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
@@ -307,9 +313,10 @@ module TrophyApiClient
|
|
307
313
|
**@request_client.get_headers,
|
308
314
|
**(request_options&.additional_headers || {})
|
309
315
|
}.compact
|
310
|
-
|
311
|
-
|
312
|
-
|
316
|
+
req.params = {
|
317
|
+
**(request_options&.additional_query_parameters || {}),
|
318
|
+
"includeIncomplete": include_incomplete
|
319
|
+
}.compact
|
313
320
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
314
321
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
315
322
|
end
|
@@ -357,9 +364,10 @@ module TrophyApiClient
|
|
357
364
|
TrophyApiClient::StreakResponse.from_json(json_object: response.body)
|
358
365
|
end
|
359
366
|
|
360
|
-
# Get a user's points.
|
367
|
+
# Get a user's points for a specific points system.
|
361
368
|
#
|
362
369
|
# @param id [String] ID of the user.
|
370
|
+
# @param key [String] Key of the points system.
|
363
371
|
# @param awards [Integer] The number of recent point awards to return.
|
364
372
|
# @param request_options [TrophyApiClient::RequestOptions]
|
365
373
|
# @return [TrophyApiClient::GetUserPointsResponse]
|
@@ -369,8 +377,8 @@ module TrophyApiClient
|
|
369
377
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
370
378
|
# api_key: "YOUR_API_KEY"
|
371
379
|
# )
|
372
|
-
# api.users.points(id: "userId")
|
373
|
-
def points(id:, awards: nil, request_options: nil)
|
380
|
+
# api.users.points(id: "userId", key: "points-system-key")
|
381
|
+
def points(id:, key:, awards: nil, request_options: nil)
|
374
382
|
response = @request_client.conn.get do |req|
|
375
383
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
376
384
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
@@ -383,14 +391,16 @@ module TrophyApiClient
|
|
383
391
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
384
392
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
385
393
|
end
|
386
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/points"
|
394
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/points/#{key}"
|
387
395
|
end
|
388
396
|
TrophyApiClient::GetUserPointsResponse.from_json(json_object: response.body)
|
389
397
|
end
|
390
398
|
|
391
|
-
# Get a summary of points awards over time for a user
|
399
|
+
# Get a summary of points awards over time for a user for a specific points
|
400
|
+
# system.
|
392
401
|
#
|
393
402
|
# @param id [String] ID of the user.
|
403
|
+
# @param key [String] Key of the points system.
|
394
404
|
# @param aggregation [TrophyApiClient::Users::UsersPointsEventSummaryRequestAggregation] The time period over which to aggregate the event data.
|
395
405
|
# @param start_date [String] The start date for the data range in YYYY-MM-DD format. The startDate must be
|
396
406
|
# before the endDate, and the date range must not exceed 400 days.
|
@@ -406,11 +416,12 @@ module TrophyApiClient
|
|
406
416
|
# )
|
407
417
|
# api.users.points_event_summary(
|
408
418
|
# id: "userId",
|
419
|
+
# key: "points-system-key",
|
409
420
|
# aggregation: DAILY,
|
410
421
|
# start_date: "2024-01-01",
|
411
422
|
# end_date: "2024-01-31"
|
412
423
|
# )
|
413
|
-
def points_event_summary(id:, aggregation:, start_date:, end_date:, request_options: nil)
|
424
|
+
def points_event_summary(id:, key:, aggregation:, start_date:, end_date:, request_options: nil)
|
414
425
|
response = @request_client.conn.get do |req|
|
415
426
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
416
427
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
@@ -428,7 +439,7 @@ module TrophyApiClient
|
|
428
439
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
429
440
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
430
441
|
end
|
431
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/points/event-summary"
|
442
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/points/#{key}/event-summary"
|
432
443
|
end
|
433
444
|
parsed_json = JSON.parse(response.body)
|
434
445
|
parsed_json&.map do |item|
|
@@ -457,6 +468,7 @@ module TrophyApiClient
|
|
457
468
|
# * :tz (String)
|
458
469
|
# * :device_tokens (Array<String>)
|
459
470
|
# * :subscribe_to_emails (Boolean)
|
471
|
+
# * :attributes (Hash{String => String})
|
460
472
|
# @param request_options [TrophyApiClient::RequestOptions]
|
461
473
|
# @return [TrophyApiClient::User]
|
462
474
|
# @example
|
@@ -529,6 +541,7 @@ module TrophyApiClient
|
|
529
541
|
# * :tz (String)
|
530
542
|
# * :device_tokens (Array<String>)
|
531
543
|
# * :subscribe_to_emails (Boolean)
|
544
|
+
# * :attributes (Hash{String => String})
|
532
545
|
# @param request_options [TrophyApiClient::RequestOptions]
|
533
546
|
# @return [TrophyApiClient::User]
|
534
547
|
# @example
|
@@ -537,7 +550,7 @@ module TrophyApiClient
|
|
537
550
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
538
551
|
# api_key: "YOUR_API_KEY"
|
539
552
|
# )
|
540
|
-
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London" })
|
553
|
+
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
541
554
|
def identify(id:, request:, request_options: nil)
|
542
555
|
Async do
|
543
556
|
response = @request_client.conn.put do |req|
|
@@ -567,6 +580,7 @@ module TrophyApiClient
|
|
567
580
|
# * :tz (String)
|
568
581
|
# * :device_tokens (Array<String>)
|
569
582
|
# * :subscribe_to_emails (Boolean)
|
583
|
+
# * :attributes (Hash{String => String})
|
570
584
|
# @param request_options [TrophyApiClient::RequestOptions]
|
571
585
|
# @return [TrophyApiClient::User]
|
572
586
|
# @example
|
@@ -575,7 +589,7 @@ module TrophyApiClient
|
|
575
589
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
576
590
|
# api_key: "YOUR_API_KEY"
|
577
591
|
# )
|
578
|
-
# api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London" })
|
592
|
+
# api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
579
593
|
def update(id:, request:, request_options: nil)
|
580
594
|
Async do
|
581
595
|
response = @request_client.conn.patch do |req|
|
@@ -722,9 +736,12 @@ module TrophyApiClient
|
|
722
736
|
end
|
723
737
|
end
|
724
738
|
|
725
|
-
# Get
|
739
|
+
# Get a user's achievements.
|
726
740
|
#
|
727
741
|
# @param id [String] ID of the user.
|
742
|
+
# @param include_incomplete [String] When set to 'true', returns both completed and incomplete achievements for the
|
743
|
+
# user. When omitted or set to any other value, returns only completed
|
744
|
+
# achievements.
|
728
745
|
# @param request_options [TrophyApiClient::RequestOptions]
|
729
746
|
# @return [Array<TrophyApiClient::CompletedAchievementResponse>]
|
730
747
|
# @example
|
@@ -733,8 +750,8 @@ module TrophyApiClient
|
|
733
750
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
734
751
|
# api_key: "YOUR_API_KEY"
|
735
752
|
# )
|
736
|
-
# api.users.
|
737
|
-
def
|
753
|
+
# api.users.achievements(id: "userId")
|
754
|
+
def achievements(id:, include_incomplete: nil, request_options: nil)
|
738
755
|
Async do
|
739
756
|
response = @request_client.conn.get do |req|
|
740
757
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -744,9 +761,10 @@ module TrophyApiClient
|
|
744
761
|
**@request_client.get_headers,
|
745
762
|
**(request_options&.additional_headers || {})
|
746
763
|
}.compact
|
747
|
-
|
748
|
-
|
749
|
-
|
764
|
+
req.params = {
|
765
|
+
**(request_options&.additional_query_parameters || {}),
|
766
|
+
"includeIncomplete": include_incomplete
|
767
|
+
}.compact
|
750
768
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
751
769
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
752
770
|
end
|
@@ -797,9 +815,10 @@ module TrophyApiClient
|
|
797
815
|
end
|
798
816
|
end
|
799
817
|
|
800
|
-
# Get a user's points.
|
818
|
+
# Get a user's points for a specific points system.
|
801
819
|
#
|
802
820
|
# @param id [String] ID of the user.
|
821
|
+
# @param key [String] Key of the points system.
|
803
822
|
# @param awards [Integer] The number of recent point awards to return.
|
804
823
|
# @param request_options [TrophyApiClient::RequestOptions]
|
805
824
|
# @return [TrophyApiClient::GetUserPointsResponse]
|
@@ -809,8 +828,8 @@ module TrophyApiClient
|
|
809
828
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
810
829
|
# api_key: "YOUR_API_KEY"
|
811
830
|
# )
|
812
|
-
# api.users.points(id: "userId")
|
813
|
-
def points(id:, awards: nil, request_options: nil)
|
831
|
+
# api.users.points(id: "userId", key: "points-system-key")
|
832
|
+
def points(id:, key:, awards: nil, request_options: nil)
|
814
833
|
Async do
|
815
834
|
response = @request_client.conn.get do |req|
|
816
835
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -824,15 +843,17 @@ module TrophyApiClient
|
|
824
843
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
825
844
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
826
845
|
end
|
827
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/points"
|
846
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/points/#{key}"
|
828
847
|
end
|
829
848
|
TrophyApiClient::GetUserPointsResponse.from_json(json_object: response.body)
|
830
849
|
end
|
831
850
|
end
|
832
851
|
|
833
|
-
# Get a summary of points awards over time for a user
|
852
|
+
# Get a summary of points awards over time for a user for a specific points
|
853
|
+
# system.
|
834
854
|
#
|
835
855
|
# @param id [String] ID of the user.
|
856
|
+
# @param key [String] Key of the points system.
|
836
857
|
# @param aggregation [TrophyApiClient::Users::UsersPointsEventSummaryRequestAggregation] The time period over which to aggregate the event data.
|
837
858
|
# @param start_date [String] The start date for the data range in YYYY-MM-DD format. The startDate must be
|
838
859
|
# before the endDate, and the date range must not exceed 400 days.
|
@@ -848,11 +869,12 @@ module TrophyApiClient
|
|
848
869
|
# )
|
849
870
|
# api.users.points_event_summary(
|
850
871
|
# id: "userId",
|
872
|
+
# key: "points-system-key",
|
851
873
|
# aggregation: DAILY,
|
852
874
|
# start_date: "2024-01-01",
|
853
875
|
# end_date: "2024-01-31"
|
854
876
|
# )
|
855
|
-
def points_event_summary(id:, aggregation:, start_date:, end_date:, request_options: nil)
|
877
|
+
def points_event_summary(id:, key:, aggregation:, start_date:, end_date:, request_options: nil)
|
856
878
|
Async do
|
857
879
|
response = @request_client.conn.get do |req|
|
858
880
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -871,7 +893,7 @@ module TrophyApiClient
|
|
871
893
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
872
894
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
873
895
|
end
|
874
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/points/event-summary"
|
896
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/points/#{key}/event-summary"
|
875
897
|
end
|
876
898
|
parsed_json = JSON.parse(response.body)
|
877
899
|
parsed_json&.map do |item|
|
data/lib/types_export.rb
CHANGED
@@ -18,6 +18,8 @@ require_relative "trophy_api_client/types/metric_event_points_response"
|
|
18
18
|
require_relative "trophy_api_client/types/achievement_response_trigger"
|
19
19
|
require_relative "trophy_api_client/types/achievement_response"
|
20
20
|
require_relative "trophy_api_client/types/completed_achievement_response"
|
21
|
+
require_relative "trophy_api_client/types/achievement_with_stats_response_user_attributes_item"
|
22
|
+
require_relative "trophy_api_client/types/achievement_with_stats_response_event_attribute"
|
21
23
|
require_relative "trophy_api_client/types/achievement_with_stats_response"
|
22
24
|
require_relative "trophy_api_client/types/metric_response"
|
23
25
|
require_relative "trophy_api_client/types/updated_user"
|
@@ -30,4 +32,7 @@ require_relative "trophy_api_client/types/points_range"
|
|
30
32
|
require_relative "trophy_api_client/types/points_summary_response"
|
31
33
|
require_relative "trophy_api_client/types/points_trigger_response_type"
|
32
34
|
require_relative "trophy_api_client/types/points_trigger_response_status"
|
35
|
+
require_relative "trophy_api_client/types/points_trigger_response_user_attributes_item"
|
36
|
+
require_relative "trophy_api_client/types/points_trigger_response_event_attribute"
|
33
37
|
require_relative "trophy_api_client/types/points_trigger_response"
|
38
|
+
require_relative "trophy_api_client/types/points_system_response"
|
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.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trophy Labs, Inc
|
@@ -106,6 +106,8 @@ files:
|
|
106
106
|
- lib/trophy_api_client/types/achievement_response.rb
|
107
107
|
- lib/trophy_api_client/types/achievement_response_trigger.rb
|
108
108
|
- lib/trophy_api_client/types/achievement_with_stats_response.rb
|
109
|
+
- lib/trophy_api_client/types/achievement_with_stats_response_event_attribute.rb
|
110
|
+
- lib/trophy_api_client/types/achievement_with_stats_response_user_attributes_item.rb
|
109
111
|
- lib/trophy_api_client/types/base_streak_response.rb
|
110
112
|
- lib/trophy_api_client/types/completed_achievement_response.rb
|
111
113
|
- lib/trophy_api_client/types/error_body.rb
|
@@ -118,10 +120,13 @@ files:
|
|
118
120
|
- lib/trophy_api_client/types/points_award.rb
|
119
121
|
- lib/trophy_api_client/types/points_range.rb
|
120
122
|
- lib/trophy_api_client/types/points_summary_response.rb
|
123
|
+
- lib/trophy_api_client/types/points_system_response.rb
|
121
124
|
- lib/trophy_api_client/types/points_trigger.rb
|
122
125
|
- lib/trophy_api_client/types/points_trigger_response.rb
|
126
|
+
- lib/trophy_api_client/types/points_trigger_response_event_attribute.rb
|
123
127
|
- lib/trophy_api_client/types/points_trigger_response_status.rb
|
124
128
|
- lib/trophy_api_client/types/points_trigger_response_type.rb
|
129
|
+
- lib/trophy_api_client/types/points_trigger_response_user_attributes_item.rb
|
125
130
|
- lib/trophy_api_client/types/points_trigger_type.rb
|
126
131
|
- lib/trophy_api_client/types/streak_frequency.rb
|
127
132
|
- lib/trophy_api_client/types/streak_response.rb
|