trophy_api_client 1.0.42 → 1.1.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/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/admin/client.rb +7 -0
- data/lib/trophy_api_client/admin/points/boosts/client.rb +247 -0
- data/lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb +111 -0
- data/lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item_rounding.rb +16 -0
- data/lib/trophy_api_client/admin/points/client.rb +32 -0
- data/lib/trophy_api_client/leaderboards/client.rb +20 -12
- data/lib/trophy_api_client/points/client.rb +85 -2
- data/lib/trophy_api_client/types/archive_points_boosts_response.rb +56 -0
- data/lib/trophy_api_client/types/create_points_boosts_response.rb +75 -0
- data/lib/trophy_api_client/types/created_points_boost.rb +122 -0
- data/lib/trophy_api_client/types/created_points_boost_rounding.rb +10 -0
- data/lib/trophy_api_client/types/created_points_boost_status.rb +10 -0
- data/lib/trophy_api_client/types/metric_event_points_response.rb +10 -9
- data/lib/trophy_api_client/types/points_award.rb +15 -2
- data/lib/trophy_api_client/types/points_boost.rb +112 -0
- data/lib/trophy_api_client/types/points_boost_rounding.rb +10 -0
- data/lib/trophy_api_client/types/points_boost_status.rb +10 -0
- data/lib/trophy_api_client/types/points_boost_webhook_payload.rb +149 -0
- data/lib/trophy_api_client/types/points_boost_webhook_payload_rounding.rb +10 -0
- data/lib/trophy_api_client/types/points_boost_webhook_payload_status.rb +9 -0
- data/lib/trophy_api_client/types/webhooks_points_boost_finished_payload.rb +79 -0
- data/lib/trophy_api_client/types/webhooks_points_boost_started_payload.rb +79 -0
- data/lib/trophy_api_client/types/webhooks_points_changed_payload.rb +5 -5
- data/lib/trophy_api_client/users/client.rb +81 -0
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +15 -0
- metadata +18 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "points_boost_webhook_payload_status"
|
|
4
|
+
require_relative "points_boost_webhook_payload_rounding"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Points boost payload sent in points.boost_started and points.boost_finished
|
|
10
|
+
# webhook events.
|
|
11
|
+
class PointsBoostWebhookPayload
|
|
12
|
+
# @return [String] The ID of the points boost.
|
|
13
|
+
attr_reader :id
|
|
14
|
+
# @return [String] The name of the points boost.
|
|
15
|
+
attr_reader :name
|
|
16
|
+
# @return [TrophyApiClient::PointsBoostWebhookPayloadStatus] The status of the points boost.
|
|
17
|
+
attr_reader :status
|
|
18
|
+
# @return [String] The customer-facing user ID that the boost is scoped to, or null for global
|
|
19
|
+
# boosts.
|
|
20
|
+
attr_reader :user_id
|
|
21
|
+
# @return [String] The ID of the points system this boost applies to.
|
|
22
|
+
attr_reader :points_system_id
|
|
23
|
+
# @return [String] The key of the points system this boost applies to.
|
|
24
|
+
attr_reader :points_system_key
|
|
25
|
+
# @return [String] The name of the points system this boost applies to.
|
|
26
|
+
attr_reader :points_system_name
|
|
27
|
+
# @return [String] The start date of the points boost (YYYY-MM-DD).
|
|
28
|
+
attr_reader :start
|
|
29
|
+
# @return [String] The end date of the points boost (YYYY-MM-DD), or null if open-ended.
|
|
30
|
+
attr_reader :end_
|
|
31
|
+
# @return [Float] The multiplier applied to points during the boost.
|
|
32
|
+
attr_reader :multiplier
|
|
33
|
+
# @return [TrophyApiClient::PointsBoostWebhookPayloadRounding] The rounding method applied to boosted points.
|
|
34
|
+
attr_reader :rounding
|
|
35
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
36
|
+
attr_reader :additional_properties
|
|
37
|
+
# @return [Object]
|
|
38
|
+
attr_reader :_field_set
|
|
39
|
+
protected :_field_set
|
|
40
|
+
|
|
41
|
+
OMIT = Object.new
|
|
42
|
+
|
|
43
|
+
# @param id [String] The ID of the points boost.
|
|
44
|
+
# @param name [String] The name of the points boost.
|
|
45
|
+
# @param status [TrophyApiClient::PointsBoostWebhookPayloadStatus] The status of the points boost.
|
|
46
|
+
# @param user_id [String] The customer-facing user ID that the boost is scoped to, or null for global
|
|
47
|
+
# boosts.
|
|
48
|
+
# @param points_system_id [String] The ID of the points system this boost applies to.
|
|
49
|
+
# @param points_system_key [String] The key of the points system this boost applies to.
|
|
50
|
+
# @param points_system_name [String] The name of the points system this boost applies to.
|
|
51
|
+
# @param start [String] The start date of the points boost (YYYY-MM-DD).
|
|
52
|
+
# @param end_ [String] The end date of the points boost (YYYY-MM-DD), or null if open-ended.
|
|
53
|
+
# @param multiplier [Float] The multiplier applied to points during the boost.
|
|
54
|
+
# @param rounding [TrophyApiClient::PointsBoostWebhookPayloadRounding] The rounding method applied to boosted points.
|
|
55
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
56
|
+
# @return [TrophyApiClient::PointsBoostWebhookPayload]
|
|
57
|
+
def initialize(id:, name:, status:, points_system_id:, points_system_key:, points_system_name:, start:,
|
|
58
|
+
multiplier:, rounding:, user_id: OMIT, end_: OMIT, additional_properties: nil)
|
|
59
|
+
@id = id
|
|
60
|
+
@name = name
|
|
61
|
+
@status = status
|
|
62
|
+
@user_id = user_id if user_id != OMIT
|
|
63
|
+
@points_system_id = points_system_id
|
|
64
|
+
@points_system_key = points_system_key
|
|
65
|
+
@points_system_name = points_system_name
|
|
66
|
+
@start = start
|
|
67
|
+
@end_ = end_ if end_ != OMIT
|
|
68
|
+
@multiplier = multiplier
|
|
69
|
+
@rounding = rounding
|
|
70
|
+
@additional_properties = additional_properties
|
|
71
|
+
@_field_set = {
|
|
72
|
+
"id": id,
|
|
73
|
+
"name": name,
|
|
74
|
+
"status": status,
|
|
75
|
+
"userId": user_id,
|
|
76
|
+
"pointsSystemId": points_system_id,
|
|
77
|
+
"pointsSystemKey": points_system_key,
|
|
78
|
+
"pointsSystemName": points_system_name,
|
|
79
|
+
"start": start,
|
|
80
|
+
"end": end_,
|
|
81
|
+
"multiplier": multiplier,
|
|
82
|
+
"rounding": rounding
|
|
83
|
+
}.reject do |_k, v|
|
|
84
|
+
v == OMIT
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Deserialize a JSON object to an instance of PointsBoostWebhookPayload
|
|
89
|
+
#
|
|
90
|
+
# @param json_object [String]
|
|
91
|
+
# @return [TrophyApiClient::PointsBoostWebhookPayload]
|
|
92
|
+
def self.from_json(json_object:)
|
|
93
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
94
|
+
parsed_json = JSON.parse(json_object)
|
|
95
|
+
id = parsed_json["id"]
|
|
96
|
+
name = parsed_json["name"]
|
|
97
|
+
status = parsed_json["status"]
|
|
98
|
+
user_id = parsed_json["userId"]
|
|
99
|
+
points_system_id = parsed_json["pointsSystemId"]
|
|
100
|
+
points_system_key = parsed_json["pointsSystemKey"]
|
|
101
|
+
points_system_name = parsed_json["pointsSystemName"]
|
|
102
|
+
start = parsed_json["start"]
|
|
103
|
+
end_ = parsed_json["end"]
|
|
104
|
+
multiplier = parsed_json["multiplier"]
|
|
105
|
+
rounding = parsed_json["rounding"]
|
|
106
|
+
new(
|
|
107
|
+
id: id,
|
|
108
|
+
name: name,
|
|
109
|
+
status: status,
|
|
110
|
+
user_id: user_id,
|
|
111
|
+
points_system_id: points_system_id,
|
|
112
|
+
points_system_key: points_system_key,
|
|
113
|
+
points_system_name: points_system_name,
|
|
114
|
+
start: start,
|
|
115
|
+
end_: end_,
|
|
116
|
+
multiplier: multiplier,
|
|
117
|
+
rounding: rounding,
|
|
118
|
+
additional_properties: struct
|
|
119
|
+
)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Serialize an instance of PointsBoostWebhookPayload to a JSON object
|
|
123
|
+
#
|
|
124
|
+
# @return [String]
|
|
125
|
+
def to_json(*_args)
|
|
126
|
+
@_field_set&.to_json
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
130
|
+
# hash and check each fields type against the current object's property
|
|
131
|
+
# definitions.
|
|
132
|
+
#
|
|
133
|
+
# @param obj [Object]
|
|
134
|
+
# @return [Void]
|
|
135
|
+
def self.validate_raw(obj:)
|
|
136
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
137
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
138
|
+
obj.status.is_a?(TrophyApiClient::PointsBoostWebhookPayloadStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
139
|
+
obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
|
|
140
|
+
obj.points_system_id.is_a?(String) != false || raise("Passed value for field obj.points_system_id is not the expected type, validation failed.")
|
|
141
|
+
obj.points_system_key.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
|
|
142
|
+
obj.points_system_name.is_a?(String) != false || raise("Passed value for field obj.points_system_name is not the expected type, validation failed.")
|
|
143
|
+
obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
|
144
|
+
obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
|
145
|
+
obj.multiplier.is_a?(Float) != false || raise("Passed value for field obj.multiplier is not the expected type, validation failed.")
|
|
146
|
+
obj.rounding.is_a?(TrophyApiClient::PointsBoostWebhookPayloadRounding) != false || raise("Passed value for field obj.rounding is not the expected type, validation failed.")
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "date"
|
|
4
|
+
require_relative "points_boost_webhook_payload"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
class WebhooksPointsBoostFinishedPayload
|
|
10
|
+
# @return [String] The webhook event type.
|
|
11
|
+
attr_reader :type
|
|
12
|
+
# @return [DateTime] When the event occurred (ISO 8601).
|
|
13
|
+
attr_reader :timestamp
|
|
14
|
+
# @return [TrophyApiClient::PointsBoostWebhookPayload] The points boost that finished.
|
|
15
|
+
attr_reader :boost
|
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
|
+
attr_reader :additional_properties
|
|
18
|
+
# @return [Object]
|
|
19
|
+
attr_reader :_field_set
|
|
20
|
+
protected :_field_set
|
|
21
|
+
|
|
22
|
+
OMIT = Object.new
|
|
23
|
+
|
|
24
|
+
# @param type [String] The webhook event type.
|
|
25
|
+
# @param timestamp [DateTime] When the event occurred (ISO 8601).
|
|
26
|
+
# @param boost [TrophyApiClient::PointsBoostWebhookPayload] The points boost that finished.
|
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
28
|
+
# @return [TrophyApiClient::WebhooksPointsBoostFinishedPayload]
|
|
29
|
+
def initialize(type:, timestamp:, boost:, additional_properties: nil)
|
|
30
|
+
@type = type
|
|
31
|
+
@timestamp = timestamp
|
|
32
|
+
@boost = boost
|
|
33
|
+
@additional_properties = additional_properties
|
|
34
|
+
@_field_set = { "type": type, "timestamp": timestamp, "boost": boost }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Deserialize a JSON object to an instance of WebhooksPointsBoostFinishedPayload
|
|
38
|
+
#
|
|
39
|
+
# @param json_object [String]
|
|
40
|
+
# @return [TrophyApiClient::WebhooksPointsBoostFinishedPayload]
|
|
41
|
+
def self.from_json(json_object:)
|
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
43
|
+
parsed_json = JSON.parse(json_object)
|
|
44
|
+
type = parsed_json["type"]
|
|
45
|
+
timestamp = (DateTime.parse(parsed_json["timestamp"]) unless parsed_json["timestamp"].nil?)
|
|
46
|
+
if parsed_json["boost"].nil?
|
|
47
|
+
boost = nil
|
|
48
|
+
else
|
|
49
|
+
boost = parsed_json["boost"].to_json
|
|
50
|
+
boost = TrophyApiClient::PointsBoostWebhookPayload.from_json(json_object: boost)
|
|
51
|
+
end
|
|
52
|
+
new(
|
|
53
|
+
type: type,
|
|
54
|
+
timestamp: timestamp,
|
|
55
|
+
boost: boost,
|
|
56
|
+
additional_properties: struct
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Serialize an instance of WebhooksPointsBoostFinishedPayload to a JSON object
|
|
61
|
+
#
|
|
62
|
+
# @return [String]
|
|
63
|
+
def to_json(*_args)
|
|
64
|
+
@_field_set&.to_json
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
68
|
+
# hash and check each fields type against the current object's property
|
|
69
|
+
# definitions.
|
|
70
|
+
#
|
|
71
|
+
# @param obj [Object]
|
|
72
|
+
# @return [Void]
|
|
73
|
+
def self.validate_raw(obj:)
|
|
74
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
75
|
+
obj.timestamp.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
|
|
76
|
+
TrophyApiClient::PointsBoostWebhookPayload.validate_raw(obj: obj.boost)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "date"
|
|
4
|
+
require_relative "points_boost_webhook_payload"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
class WebhooksPointsBoostStartedPayload
|
|
10
|
+
# @return [String] The webhook event type.
|
|
11
|
+
attr_reader :type
|
|
12
|
+
# @return [DateTime] When the event occurred (ISO 8601).
|
|
13
|
+
attr_reader :timestamp
|
|
14
|
+
# @return [TrophyApiClient::PointsBoostWebhookPayload] The points boost that started.
|
|
15
|
+
attr_reader :boost
|
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
|
+
attr_reader :additional_properties
|
|
18
|
+
# @return [Object]
|
|
19
|
+
attr_reader :_field_set
|
|
20
|
+
protected :_field_set
|
|
21
|
+
|
|
22
|
+
OMIT = Object.new
|
|
23
|
+
|
|
24
|
+
# @param type [String] The webhook event type.
|
|
25
|
+
# @param timestamp [DateTime] When the event occurred (ISO 8601).
|
|
26
|
+
# @param boost [TrophyApiClient::PointsBoostWebhookPayload] The points boost that started.
|
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
28
|
+
# @return [TrophyApiClient::WebhooksPointsBoostStartedPayload]
|
|
29
|
+
def initialize(type:, timestamp:, boost:, additional_properties: nil)
|
|
30
|
+
@type = type
|
|
31
|
+
@timestamp = timestamp
|
|
32
|
+
@boost = boost
|
|
33
|
+
@additional_properties = additional_properties
|
|
34
|
+
@_field_set = { "type": type, "timestamp": timestamp, "boost": boost }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Deserialize a JSON object to an instance of WebhooksPointsBoostStartedPayload
|
|
38
|
+
#
|
|
39
|
+
# @param json_object [String]
|
|
40
|
+
# @return [TrophyApiClient::WebhooksPointsBoostStartedPayload]
|
|
41
|
+
def self.from_json(json_object:)
|
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
43
|
+
parsed_json = JSON.parse(json_object)
|
|
44
|
+
type = parsed_json["type"]
|
|
45
|
+
timestamp = (DateTime.parse(parsed_json["timestamp"]) unless parsed_json["timestamp"].nil?)
|
|
46
|
+
if parsed_json["boost"].nil?
|
|
47
|
+
boost = nil
|
|
48
|
+
else
|
|
49
|
+
boost = parsed_json["boost"].to_json
|
|
50
|
+
boost = TrophyApiClient::PointsBoostWebhookPayload.from_json(json_object: boost)
|
|
51
|
+
end
|
|
52
|
+
new(
|
|
53
|
+
type: type,
|
|
54
|
+
timestamp: timestamp,
|
|
55
|
+
boost: boost,
|
|
56
|
+
additional_properties: struct
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Serialize an instance of WebhooksPointsBoostStartedPayload to a JSON object
|
|
61
|
+
#
|
|
62
|
+
# @return [String]
|
|
63
|
+
def to_json(*_args)
|
|
64
|
+
@_field_set&.to_json
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
68
|
+
# hash and check each fields type against the current object's property
|
|
69
|
+
# definitions.
|
|
70
|
+
#
|
|
71
|
+
# @param obj [Object]
|
|
72
|
+
# @return [Void]
|
|
73
|
+
def self.validate_raw(obj:)
|
|
74
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
75
|
+
obj.timestamp.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
|
|
76
|
+
TrophyApiClient::PointsBoostWebhookPayload.validate_raw(obj: obj.boost)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "user"
|
|
4
|
-
require_relative "
|
|
4
|
+
require_relative "metric_event_points_response"
|
|
5
5
|
require "ostruct"
|
|
6
6
|
require "json"
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ module TrophyApiClient
|
|
|
11
11
|
attr_reader :type
|
|
12
12
|
# @return [TrophyApiClient::User] The user whose points increased or decreased.
|
|
13
13
|
attr_reader :user
|
|
14
|
-
# @return [TrophyApiClient::
|
|
14
|
+
# @return [TrophyApiClient::MetricEventPointsResponse] The user's points after the event (includes added amount for this event).
|
|
15
15
|
attr_reader :points
|
|
16
16
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
17
|
attr_reader :additional_properties
|
|
@@ -23,7 +23,7 @@ module TrophyApiClient
|
|
|
23
23
|
|
|
24
24
|
# @param type [String] The webhook event type.
|
|
25
25
|
# @param user [TrophyApiClient::User] The user whose points increased or decreased.
|
|
26
|
-
# @param points [TrophyApiClient::
|
|
26
|
+
# @param points [TrophyApiClient::MetricEventPointsResponse] The user's points after the event (includes added amount for this event).
|
|
27
27
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
28
28
|
# @return [TrophyApiClient::WebhooksPointsChangedPayload]
|
|
29
29
|
def initialize(type:, user:, points:, additional_properties: nil)
|
|
@@ -52,7 +52,7 @@ module TrophyApiClient
|
|
|
52
52
|
points = nil
|
|
53
53
|
else
|
|
54
54
|
points = parsed_json["points"].to_json
|
|
55
|
-
points = TrophyApiClient::
|
|
55
|
+
points = TrophyApiClient::MetricEventPointsResponse.from_json(json_object: points)
|
|
56
56
|
end
|
|
57
57
|
new(
|
|
58
58
|
type: type,
|
|
@@ -78,7 +78,7 @@ module TrophyApiClient
|
|
|
78
78
|
def self.validate_raw(obj:)
|
|
79
79
|
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
80
80
|
TrophyApiClient::User.validate_raw(obj: obj.user)
|
|
81
|
-
TrophyApiClient::
|
|
81
|
+
TrophyApiClient::MetricEventPointsResponse.validate_raw(obj: obj.points)
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -13,6 +13,7 @@ require_relative "types/users_metric_event_summary_response_item"
|
|
|
13
13
|
require_relative "../types/user_achievement_with_stats_response"
|
|
14
14
|
require_relative "../types/streak_response"
|
|
15
15
|
require_relative "../types/get_user_points_response"
|
|
16
|
+
require_relative "../types/points_boost"
|
|
16
17
|
require_relative "types/users_points_event_summary_request_aggregation"
|
|
17
18
|
require_relative "types/users_points_event_summary_response_item"
|
|
18
19
|
require_relative "../types/user_leaderboard_response_with_history"
|
|
@@ -475,6 +476,45 @@ module TrophyApiClient
|
|
|
475
476
|
TrophyApiClient::GetUserPointsResponse.from_json(json_object: response.body)
|
|
476
477
|
end
|
|
477
478
|
|
|
479
|
+
# Get active points boosts for a user in a specific points system. Returns both
|
|
480
|
+
# global boosts the user is eligible for and user-specific boosts.
|
|
481
|
+
#
|
|
482
|
+
# @param id [String] ID of the user.
|
|
483
|
+
# @param key [String] Key of the points system.
|
|
484
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
485
|
+
# @return [Array<TrophyApiClient::PointsBoost>]
|
|
486
|
+
# @example
|
|
487
|
+
# api = TrophyApiClient::Client.new(
|
|
488
|
+
# base_url: "https://api.example.com",
|
|
489
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
490
|
+
# api_key: "YOUR_API_KEY"
|
|
491
|
+
# )
|
|
492
|
+
# api.users.points_boosts(id: "userId", key: "points-system-key")
|
|
493
|
+
def points_boosts(id:, key:, request_options: nil)
|
|
494
|
+
response = @request_client.conn.get do |req|
|
|
495
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
496
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
497
|
+
req.headers = {
|
|
498
|
+
**(req.headers || {}),
|
|
499
|
+
**@request_client.get_headers,
|
|
500
|
+
**(request_options&.additional_headers || {})
|
|
501
|
+
}.compact
|
|
502
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
503
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
504
|
+
end
|
|
505
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
506
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
507
|
+
end
|
|
508
|
+
req.url "#{@request_client.get_url(environment: api,
|
|
509
|
+
request_options: request_options)}/users/#{id}/points/#{key}/boosts"
|
|
510
|
+
end
|
|
511
|
+
parsed_json = JSON.parse(response.body)
|
|
512
|
+
parsed_json&.map do |item|
|
|
513
|
+
item = item.to_json
|
|
514
|
+
TrophyApiClient::PointsBoost.from_json(json_object: item)
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
|
|
478
518
|
# Get a summary of points awards over time for a user for a specific points
|
|
479
519
|
# system.
|
|
480
520
|
#
|
|
@@ -1086,6 +1126,47 @@ module TrophyApiClient
|
|
|
1086
1126
|
end
|
|
1087
1127
|
end
|
|
1088
1128
|
|
|
1129
|
+
# Get active points boosts for a user in a specific points system. Returns both
|
|
1130
|
+
# global boosts the user is eligible for and user-specific boosts.
|
|
1131
|
+
#
|
|
1132
|
+
# @param id [String] ID of the user.
|
|
1133
|
+
# @param key [String] Key of the points system.
|
|
1134
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1135
|
+
# @return [Array<TrophyApiClient::PointsBoost>]
|
|
1136
|
+
# @example
|
|
1137
|
+
# api = TrophyApiClient::Client.new(
|
|
1138
|
+
# base_url: "https://api.example.com",
|
|
1139
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1140
|
+
# api_key: "YOUR_API_KEY"
|
|
1141
|
+
# )
|
|
1142
|
+
# api.users.points_boosts(id: "userId", key: "points-system-key")
|
|
1143
|
+
def points_boosts(id:, key:, request_options: nil)
|
|
1144
|
+
Async do
|
|
1145
|
+
response = @request_client.conn.get do |req|
|
|
1146
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1147
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1148
|
+
req.headers = {
|
|
1149
|
+
**(req.headers || {}),
|
|
1150
|
+
**@request_client.get_headers,
|
|
1151
|
+
**(request_options&.additional_headers || {})
|
|
1152
|
+
}.compact
|
|
1153
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
1154
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
1155
|
+
end
|
|
1156
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1157
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1158
|
+
end
|
|
1159
|
+
req.url "#{@request_client.get_url(environment: api,
|
|
1160
|
+
request_options: request_options)}/users/#{id}/points/#{key}/boosts"
|
|
1161
|
+
end
|
|
1162
|
+
parsed_json = JSON.parse(response.body)
|
|
1163
|
+
parsed_json&.map do |item|
|
|
1164
|
+
item = item.to_json
|
|
1165
|
+
TrophyApiClient::PointsBoost.from_json(json_object: item)
|
|
1166
|
+
end
|
|
1167
|
+
end
|
|
1168
|
+
end
|
|
1169
|
+
|
|
1089
1170
|
# Get a summary of points awards over time for a user for a specific points
|
|
1090
1171
|
# system.
|
|
1091
1172
|
#
|
data/lib/types_export.rb
CHANGED
|
@@ -8,6 +8,8 @@ require_relative "trophy_api_client/streaks/types/streaks_rankings_request_type"
|
|
|
8
8
|
require_relative "trophy_api_client/leaderboards/types/leaderboards_all_response_item_status"
|
|
9
9
|
require_relative "trophy_api_client/leaderboards/types/leaderboards_all_response_item"
|
|
10
10
|
require_relative "trophy_api_client/admin/streaks/types/restore_streaks_request_users_item"
|
|
11
|
+
require_relative "trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item_rounding"
|
|
12
|
+
require_relative "trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item"
|
|
11
13
|
require_relative "trophy_api_client/admin/streaks/freezes/types/create_streak_freezes_request_freezes_item"
|
|
12
14
|
require_relative "trophy_api_client/types/webhooks_achievement_completed_payload"
|
|
13
15
|
require_relative "trophy_api_client/types/webhooks_streak_started_payload"
|
|
@@ -16,6 +18,8 @@ require_relative "trophy_api_client/types/webhooks_streak_lost_payload"
|
|
|
16
18
|
require_relative "trophy_api_client/types/webhooks_streak_freeze_consumed_payload"
|
|
17
19
|
require_relative "trophy_api_client/types/webhooks_streak_freeze_earned_payload"
|
|
18
20
|
require_relative "trophy_api_client/types/webhooks_points_changed_payload"
|
|
21
|
+
require_relative "trophy_api_client/types/webhooks_points_boost_started_payload"
|
|
22
|
+
require_relative "trophy_api_client/types/webhooks_points_boost_finished_payload"
|
|
19
23
|
require_relative "trophy_api_client/types/webhooks_leaderboard_started_payload"
|
|
20
24
|
require_relative "trophy_api_client/types/webhooks_leaderboard_changed_payload"
|
|
21
25
|
require_relative "trophy_api_client/types/webhooks_leaderboard_finished_payload"
|
|
@@ -32,6 +36,12 @@ require_relative "trophy_api_client/types/points_trigger_type"
|
|
|
32
36
|
require_relative "trophy_api_client/types/points_trigger_time_unit"
|
|
33
37
|
require_relative "trophy_api_client/types/points_trigger"
|
|
34
38
|
require_relative "trophy_api_client/types/points_award"
|
|
39
|
+
require_relative "trophy_api_client/types/points_boost_status"
|
|
40
|
+
require_relative "trophy_api_client/types/points_boost_rounding"
|
|
41
|
+
require_relative "trophy_api_client/types/points_boost"
|
|
42
|
+
require_relative "trophy_api_client/types/points_boost_webhook_payload_status"
|
|
43
|
+
require_relative "trophy_api_client/types/points_boost_webhook_payload_rounding"
|
|
44
|
+
require_relative "trophy_api_client/types/points_boost_webhook_payload"
|
|
35
45
|
require_relative "trophy_api_client/types/get_user_points_response"
|
|
36
46
|
require_relative "trophy_api_client/types/leaderboard_response_rank_by"
|
|
37
47
|
require_relative "trophy_api_client/types/leaderboard_response_run_unit"
|
|
@@ -74,6 +84,11 @@ require_relative "trophy_api_client/types/user_leaderboard_response"
|
|
|
74
84
|
require_relative "trophy_api_client/types/user_leaderboard_response_with_history"
|
|
75
85
|
require_relative "trophy_api_client/types/webhook_user_leaderboard_response"
|
|
76
86
|
require_relative "trophy_api_client/types/create_streak_freezes_response"
|
|
87
|
+
require_relative "trophy_api_client/types/created_points_boost_status"
|
|
88
|
+
require_relative "trophy_api_client/types/created_points_boost_rounding"
|
|
89
|
+
require_relative "trophy_api_client/types/created_points_boost"
|
|
90
|
+
require_relative "trophy_api_client/types/create_points_boosts_response"
|
|
91
|
+
require_relative "trophy_api_client/types/archive_points_boosts_response"
|
|
77
92
|
require_relative "trophy_api_client/types/restore_streaks_response"
|
|
78
93
|
require_relative "trophy_api_client/types/bulk_insert_issue_level"
|
|
79
94
|
require_relative "trophy_api_client/types/bulk_insert_issue"
|
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.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Trophy Labs, Inc
|
|
@@ -101,6 +101,10 @@ files:
|
|
|
101
101
|
- lib/trophy_api_client.rb
|
|
102
102
|
- lib/trophy_api_client/achievements/client.rb
|
|
103
103
|
- lib/trophy_api_client/admin/client.rb
|
|
104
|
+
- lib/trophy_api_client/admin/points/boosts/client.rb
|
|
105
|
+
- lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb
|
|
106
|
+
- lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item_rounding.rb
|
|
107
|
+
- lib/trophy_api_client/admin/points/client.rb
|
|
104
108
|
- lib/trophy_api_client/admin/streaks/client.rb
|
|
105
109
|
- lib/trophy_api_client/admin/streaks/freezes/client.rb
|
|
106
110
|
- lib/trophy_api_client/admin/streaks/freezes/types/create_streak_freezes_request_freezes_item.rb
|
|
@@ -118,12 +122,17 @@ files:
|
|
|
118
122
|
- lib/trophy_api_client/types/achievement_response_trigger.rb
|
|
119
123
|
- lib/trophy_api_client/types/achievement_response_user_attributes_item.rb
|
|
120
124
|
- lib/trophy_api_client/types/achievement_with_stats_response.rb
|
|
125
|
+
- lib/trophy_api_client/types/archive_points_boosts_response.rb
|
|
121
126
|
- lib/trophy_api_client/types/base_streak_response.rb
|
|
122
127
|
- lib/trophy_api_client/types/bulk_insert_issue.rb
|
|
123
128
|
- lib/trophy_api_client/types/bulk_insert_issue_level.rb
|
|
124
129
|
- lib/trophy_api_client/types/bulk_streak_response.rb
|
|
125
130
|
- lib/trophy_api_client/types/bulk_streak_response_item.rb
|
|
131
|
+
- lib/trophy_api_client/types/create_points_boosts_response.rb
|
|
126
132
|
- lib/trophy_api_client/types/create_streak_freezes_response.rb
|
|
133
|
+
- lib/trophy_api_client/types/created_points_boost.rb
|
|
134
|
+
- lib/trophy_api_client/types/created_points_boost_rounding.rb
|
|
135
|
+
- lib/trophy_api_client/types/created_points_boost_status.rb
|
|
127
136
|
- lib/trophy_api_client/types/error_body.rb
|
|
128
137
|
- lib/trophy_api_client/types/event_response.rb
|
|
129
138
|
- lib/trophy_api_client/types/get_user_points_response.rb
|
|
@@ -143,6 +152,12 @@ files:
|
|
|
143
152
|
- lib/trophy_api_client/types/notification_preferences.rb
|
|
144
153
|
- lib/trophy_api_client/types/notification_type.rb
|
|
145
154
|
- lib/trophy_api_client/types/points_award.rb
|
|
155
|
+
- lib/trophy_api_client/types/points_boost.rb
|
|
156
|
+
- lib/trophy_api_client/types/points_boost_rounding.rb
|
|
157
|
+
- lib/trophy_api_client/types/points_boost_status.rb
|
|
158
|
+
- lib/trophy_api_client/types/points_boost_webhook_payload.rb
|
|
159
|
+
- lib/trophy_api_client/types/points_boost_webhook_payload_rounding.rb
|
|
160
|
+
- lib/trophy_api_client/types/points_boost_webhook_payload_status.rb
|
|
146
161
|
- lib/trophy_api_client/types/points_range.rb
|
|
147
162
|
- lib/trophy_api_client/types/points_summary_response.rb
|
|
148
163
|
- lib/trophy_api_client/types/points_system_response.rb
|
|
@@ -174,6 +189,8 @@ files:
|
|
|
174
189
|
- lib/trophy_api_client/types/webhooks_leaderboard_finished_payload.rb
|
|
175
190
|
- lib/trophy_api_client/types/webhooks_leaderboard_rank_changed_payload.rb
|
|
176
191
|
- lib/trophy_api_client/types/webhooks_leaderboard_started_payload.rb
|
|
192
|
+
- lib/trophy_api_client/types/webhooks_points_boost_finished_payload.rb
|
|
193
|
+
- lib/trophy_api_client/types/webhooks_points_boost_started_payload.rb
|
|
177
194
|
- lib/trophy_api_client/types/webhooks_points_changed_payload.rb
|
|
178
195
|
- lib/trophy_api_client/types/webhooks_streak_extended_payload.rb
|
|
179
196
|
- lib/trophy_api_client/types/webhooks_streak_freeze_consumed_payload.rb
|