trophy_api_client 1.1.2 → 1.3.4
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/leaderboards/types/leaderboards_all_response_item.rb +12 -4
- data/lib/trophy_api_client/points/client.rb +152 -0
- data/lib/trophy_api_client/types/achievement_response.rb +23 -11
- data/lib/trophy_api_client/types/achievement_response_event_attribute.rb +2 -2
- data/lib/trophy_api_client/types/achievement_response_event_attributes_item.rb +66 -0
- data/lib/trophy_api_client/types/achievement_with_stats_response.rb +23 -11
- data/lib/trophy_api_client/types/get_user_points_response.rb +38 -22
- data/lib/trophy_api_client/types/leaderboard_response.rb +12 -4
- data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +12 -4
- data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +30 -8
- data/lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb +67 -0
- data/lib/trophy_api_client/types/metric_event_points_response.rb +47 -31
- data/lib/trophy_api_client/types/points_level.rb +103 -0
- data/lib/trophy_api_client/types/points_level_summary_response.rb +7 -0
- data/lib/trophy_api_client/types/points_level_summary_response_item.rb +71 -0
- data/lib/trophy_api_client/types/points_response.rb +103 -0
- data/lib/trophy_api_client/types/points_system_response.rb +4 -4
- data/lib/trophy_api_client/types/points_trigger.rb +101 -9
- data/lib/trophy_api_client/types/{points_trigger_response_event_attribute.rb → points_trigger_event_attribute.rb} +7 -7
- data/lib/trophy_api_client/types/points_trigger_event_attributes_item.rb +65 -0
- data/lib/trophy_api_client/types/{points_trigger_response_status.rb → points_trigger_status.rb} +2 -1
- data/lib/trophy_api_client/types/{points_trigger_response_user_attributes_item.rb → points_trigger_user_attributes_item.rb} +7 -9
- data/lib/trophy_api_client/types/streak_response.rb +4 -2
- data/lib/trophy_api_client/types/user_achievement_response.rb +23 -11
- data/lib/trophy_api_client/types/user_achievement_with_stats_response.rb +23 -11
- data/lib/trophy_api_client/types/user_leaderboard_response.rb +12 -4
- data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +12 -4
- data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +11 -3
- data/lib/trophy_api_client/types/webhooks_points_level_changed_payload.rb +117 -0
- data/lib/trophy_api_client/types/webhooks_points_level_changed_payload_points.rb +114 -0
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +12 -6
- metadata +14 -8
- data/lib/trophy_api_client/types/points_trigger_response.rb +0 -211
- data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +0 -9
- data/lib/trophy_api_client/types/points_trigger_response_type.rb +0 -12
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
# The points system in which the level changed.
|
|
8
|
+
class WebhooksPointsLevelChangedPayloadPoints
|
|
9
|
+
# @return [Integer] The user's total points in this system.
|
|
10
|
+
attr_reader :total
|
|
11
|
+
# @return [String] The ID of the points system
|
|
12
|
+
attr_reader :id
|
|
13
|
+
# @return [String] The key of the points system
|
|
14
|
+
attr_reader :key
|
|
15
|
+
# @return [String] The name of the points system
|
|
16
|
+
attr_reader :name
|
|
17
|
+
# @return [String] The description of the points system
|
|
18
|
+
attr_reader :description
|
|
19
|
+
# @return [String] The URL of the badge image for the points system
|
|
20
|
+
attr_reader :badge_url
|
|
21
|
+
# @return [Float] The maximum number of points a user can be awarded in this points system
|
|
22
|
+
attr_reader :max_points
|
|
23
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
24
|
+
attr_reader :additional_properties
|
|
25
|
+
# @return [Object]
|
|
26
|
+
attr_reader :_field_set
|
|
27
|
+
protected :_field_set
|
|
28
|
+
|
|
29
|
+
OMIT = Object.new
|
|
30
|
+
|
|
31
|
+
# @param total [Integer] The user's total points in this system.
|
|
32
|
+
# @param id [String] The ID of the points system
|
|
33
|
+
# @param key [String] The key of the points system
|
|
34
|
+
# @param name [String] The name of the points system
|
|
35
|
+
# @param description [String] The description of the points system
|
|
36
|
+
# @param badge_url [String] The URL of the badge image for the points system
|
|
37
|
+
# @param max_points [Float] The maximum number of points a user can be awarded in this points system
|
|
38
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
39
|
+
# @return [TrophyApiClient::WebhooksPointsLevelChangedPayloadPoints]
|
|
40
|
+
def initialize(total:, id:, key:, name:, description: OMIT, badge_url: OMIT, max_points: OMIT,
|
|
41
|
+
additional_properties: nil)
|
|
42
|
+
@total = total
|
|
43
|
+
@id = id
|
|
44
|
+
@key = key
|
|
45
|
+
@name = name
|
|
46
|
+
@description = description if description != OMIT
|
|
47
|
+
@badge_url = badge_url if badge_url != OMIT
|
|
48
|
+
@max_points = max_points if max_points != OMIT
|
|
49
|
+
@additional_properties = additional_properties
|
|
50
|
+
@_field_set = {
|
|
51
|
+
"total": total,
|
|
52
|
+
"id": id,
|
|
53
|
+
"key": key,
|
|
54
|
+
"name": name,
|
|
55
|
+
"description": description,
|
|
56
|
+
"badgeUrl": badge_url,
|
|
57
|
+
"maxPoints": max_points
|
|
58
|
+
}.reject do |_k, v|
|
|
59
|
+
v == OMIT
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Deserialize a JSON object to an instance of
|
|
64
|
+
# WebhooksPointsLevelChangedPayloadPoints
|
|
65
|
+
#
|
|
66
|
+
# @param json_object [String]
|
|
67
|
+
# @return [TrophyApiClient::WebhooksPointsLevelChangedPayloadPoints]
|
|
68
|
+
def self.from_json(json_object:)
|
|
69
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
70
|
+
parsed_json = JSON.parse(json_object)
|
|
71
|
+
total = parsed_json["total"]
|
|
72
|
+
id = parsed_json["id"]
|
|
73
|
+
key = parsed_json["key"]
|
|
74
|
+
name = parsed_json["name"]
|
|
75
|
+
description = parsed_json["description"]
|
|
76
|
+
badge_url = parsed_json["badgeUrl"]
|
|
77
|
+
max_points = parsed_json["maxPoints"]
|
|
78
|
+
new(
|
|
79
|
+
total: total,
|
|
80
|
+
id: id,
|
|
81
|
+
key: key,
|
|
82
|
+
name: name,
|
|
83
|
+
description: description,
|
|
84
|
+
badge_url: badge_url,
|
|
85
|
+
max_points: max_points,
|
|
86
|
+
additional_properties: struct
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Serialize an instance of WebhooksPointsLevelChangedPayloadPoints to a JSON
|
|
91
|
+
# object
|
|
92
|
+
#
|
|
93
|
+
# @return [String]
|
|
94
|
+
def to_json(*_args)
|
|
95
|
+
@_field_set&.to_json
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
99
|
+
# hash and check each fields type against the current object's property
|
|
100
|
+
# definitions.
|
|
101
|
+
#
|
|
102
|
+
# @param obj [Object]
|
|
103
|
+
# @return [Void]
|
|
104
|
+
def self.validate_raw(obj:)
|
|
105
|
+
obj.total.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
|
|
106
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
107
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
108
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
109
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
110
|
+
obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
|
|
111
|
+
obj.max_points&.is_a?(Float) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
data/lib/types_export.rb
CHANGED
|
@@ -18,6 +18,8 @@ require_relative "trophy_api_client/types/webhooks_streak_lost_payload"
|
|
|
18
18
|
require_relative "trophy_api_client/types/webhooks_streak_freeze_consumed_payload"
|
|
19
19
|
require_relative "trophy_api_client/types/webhooks_streak_freeze_earned_payload"
|
|
20
20
|
require_relative "trophy_api_client/types/webhooks_points_changed_payload"
|
|
21
|
+
require_relative "trophy_api_client/types/webhooks_points_level_changed_payload_points"
|
|
22
|
+
require_relative "trophy_api_client/types/webhooks_points_level_changed_payload"
|
|
21
23
|
require_relative "trophy_api_client/types/webhooks_points_boost_started_payload"
|
|
22
24
|
require_relative "trophy_api_client/types/webhooks_points_boost_finished_payload"
|
|
23
25
|
require_relative "trophy_api_client/types/webhooks_leaderboard_started_payload"
|
|
@@ -33,7 +35,11 @@ require_relative "trophy_api_client/types/metric_event_streak_response"
|
|
|
33
35
|
require_relative "trophy_api_client/types/streak_response_streak_history_item"
|
|
34
36
|
require_relative "trophy_api_client/types/streak_response"
|
|
35
37
|
require_relative "trophy_api_client/types/points_trigger_type"
|
|
38
|
+
require_relative "trophy_api_client/types/points_trigger_status"
|
|
36
39
|
require_relative "trophy_api_client/types/points_trigger_time_unit"
|
|
40
|
+
require_relative "trophy_api_client/types/points_trigger_user_attributes_item"
|
|
41
|
+
require_relative "trophy_api_client/types/points_trigger_event_attribute"
|
|
42
|
+
require_relative "trophy_api_client/types/points_trigger_event_attributes_item"
|
|
37
43
|
require_relative "trophy_api_client/types/points_trigger"
|
|
38
44
|
require_relative "trophy_api_client/types/points_award"
|
|
39
45
|
require_relative "trophy_api_client/types/points_boost_status"
|
|
@@ -42,17 +48,23 @@ require_relative "trophy_api_client/types/points_boost"
|
|
|
42
48
|
require_relative "trophy_api_client/types/points_boost_webhook_payload_status"
|
|
43
49
|
require_relative "trophy_api_client/types/points_boost_webhook_payload_rounding"
|
|
44
50
|
require_relative "trophy_api_client/types/points_boost_webhook_payload"
|
|
51
|
+
require_relative "trophy_api_client/types/points_response"
|
|
45
52
|
require_relative "trophy_api_client/types/get_user_points_response"
|
|
53
|
+
require_relative "trophy_api_client/types/points_level_summary_response_item"
|
|
54
|
+
require_relative "trophy_api_client/types/points_level_summary_response"
|
|
55
|
+
require_relative "trophy_api_client/types/points_level"
|
|
46
56
|
require_relative "trophy_api_client/types/leaderboard_response_rank_by"
|
|
47
57
|
require_relative "trophy_api_client/types/leaderboard_response_run_unit"
|
|
48
58
|
require_relative "trophy_api_client/types/leaderboard_response"
|
|
49
59
|
require_relative "trophy_api_client/types/leaderboard_response_with_rankings_status"
|
|
50
60
|
require_relative "trophy_api_client/types/leaderboard_response_with_rankings"
|
|
51
61
|
require_relative "trophy_api_client/types/metric_event_points_response"
|
|
62
|
+
require_relative "trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item"
|
|
52
63
|
require_relative "trophy_api_client/types/metric_event_leaderboard_response"
|
|
53
64
|
require_relative "trophy_api_client/types/achievement_response_trigger"
|
|
54
65
|
require_relative "trophy_api_client/types/achievement_response_user_attributes_item"
|
|
55
66
|
require_relative "trophy_api_client/types/achievement_response_event_attribute"
|
|
67
|
+
require_relative "trophy_api_client/types/achievement_response_event_attributes_item"
|
|
56
68
|
require_relative "trophy_api_client/types/achievement_response"
|
|
57
69
|
require_relative "trophy_api_client/types/user_achievement_response"
|
|
58
70
|
require_relative "trophy_api_client/types/user_achievement_with_stats_response"
|
|
@@ -70,12 +82,6 @@ require_relative "trophy_api_client/types/achievement_completion_response"
|
|
|
70
82
|
require_relative "trophy_api_client/types/event_response"
|
|
71
83
|
require_relative "trophy_api_client/types/points_range"
|
|
72
84
|
require_relative "trophy_api_client/types/points_summary_response"
|
|
73
|
-
require_relative "trophy_api_client/types/points_trigger_response_type"
|
|
74
|
-
require_relative "trophy_api_client/types/points_trigger_response_status"
|
|
75
|
-
require_relative "trophy_api_client/types/points_trigger_response_time_unit"
|
|
76
|
-
require_relative "trophy_api_client/types/points_trigger_response_user_attributes_item"
|
|
77
|
-
require_relative "trophy_api_client/types/points_trigger_response_event_attribute"
|
|
78
|
-
require_relative "trophy_api_client/types/points_trigger_response"
|
|
79
85
|
require_relative "trophy_api_client/types/points_system_response"
|
|
80
86
|
require_relative "trophy_api_client/types/streak_ranking_user"
|
|
81
87
|
require_relative "trophy_api_client/types/leaderboard_ranking"
|
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.
|
|
4
|
+
version: 1.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Trophy Labs, Inc
|
|
@@ -119,6 +119,7 @@ files:
|
|
|
119
119
|
- lib/trophy_api_client/types/achievement_completion_response.rb
|
|
120
120
|
- lib/trophy_api_client/types/achievement_response.rb
|
|
121
121
|
- lib/trophy_api_client/types/achievement_response_event_attribute.rb
|
|
122
|
+
- lib/trophy_api_client/types/achievement_response_event_attributes_item.rb
|
|
122
123
|
- lib/trophy_api_client/types/achievement_response_trigger.rb
|
|
123
124
|
- lib/trophy_api_client/types/achievement_response_user_attributes_item.rb
|
|
124
125
|
- lib/trophy_api_client/types/achievement_with_stats_response.rb
|
|
@@ -144,6 +145,7 @@ files:
|
|
|
144
145
|
- lib/trophy_api_client/types/leaderboard_response_with_rankings.rb
|
|
145
146
|
- lib/trophy_api_client/types/leaderboard_response_with_rankings_status.rb
|
|
146
147
|
- lib/trophy_api_client/types/metric_event_leaderboard_response.rb
|
|
148
|
+
- lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb
|
|
147
149
|
- lib/trophy_api_client/types/metric_event_points_response.rb
|
|
148
150
|
- lib/trophy_api_client/types/metric_event_streak_response.rb
|
|
149
151
|
- lib/trophy_api_client/types/metric_response.rb
|
|
@@ -158,18 +160,20 @@ files:
|
|
|
158
160
|
- lib/trophy_api_client/types/points_boost_webhook_payload.rb
|
|
159
161
|
- lib/trophy_api_client/types/points_boost_webhook_payload_rounding.rb
|
|
160
162
|
- lib/trophy_api_client/types/points_boost_webhook_payload_status.rb
|
|
163
|
+
- lib/trophy_api_client/types/points_level.rb
|
|
164
|
+
- lib/trophy_api_client/types/points_level_summary_response.rb
|
|
165
|
+
- lib/trophy_api_client/types/points_level_summary_response_item.rb
|
|
161
166
|
- lib/trophy_api_client/types/points_range.rb
|
|
167
|
+
- lib/trophy_api_client/types/points_response.rb
|
|
162
168
|
- lib/trophy_api_client/types/points_summary_response.rb
|
|
163
169
|
- lib/trophy_api_client/types/points_system_response.rb
|
|
164
170
|
- lib/trophy_api_client/types/points_trigger.rb
|
|
165
|
-
- lib/trophy_api_client/types/
|
|
166
|
-
- lib/trophy_api_client/types/
|
|
167
|
-
- lib/trophy_api_client/types/
|
|
168
|
-
- lib/trophy_api_client/types/points_trigger_response_time_unit.rb
|
|
169
|
-
- lib/trophy_api_client/types/points_trigger_response_type.rb
|
|
170
|
-
- lib/trophy_api_client/types/points_trigger_response_user_attributes_item.rb
|
|
171
|
+
- lib/trophy_api_client/types/points_trigger_event_attribute.rb
|
|
172
|
+
- lib/trophy_api_client/types/points_trigger_event_attributes_item.rb
|
|
173
|
+
- lib/trophy_api_client/types/points_trigger_status.rb
|
|
171
174
|
- lib/trophy_api_client/types/points_trigger_time_unit.rb
|
|
172
175
|
- lib/trophy_api_client/types/points_trigger_type.rb
|
|
176
|
+
- lib/trophy_api_client/types/points_trigger_user_attributes_item.rb
|
|
173
177
|
- lib/trophy_api_client/types/restore_streaks_response.rb
|
|
174
178
|
- lib/trophy_api_client/types/streak_frequency.rb
|
|
175
179
|
- lib/trophy_api_client/types/streak_ranking_user.rb
|
|
@@ -192,6 +196,8 @@ files:
|
|
|
192
196
|
- lib/trophy_api_client/types/webhooks_points_boost_finished_payload.rb
|
|
193
197
|
- lib/trophy_api_client/types/webhooks_points_boost_started_payload.rb
|
|
194
198
|
- lib/trophy_api_client/types/webhooks_points_changed_payload.rb
|
|
199
|
+
- lib/trophy_api_client/types/webhooks_points_level_changed_payload.rb
|
|
200
|
+
- lib/trophy_api_client/types/webhooks_points_level_changed_payload_points.rb
|
|
195
201
|
- lib/trophy_api_client/types/webhooks_streak_extended_payload.rb
|
|
196
202
|
- lib/trophy_api_client/types/webhooks_streak_freeze_consumed_payload.rb
|
|
197
203
|
- lib/trophy_api_client/types/webhooks_streak_freeze_earned_payload.rb
|
|
@@ -235,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
235
241
|
- !ruby/object:Gem::Version
|
|
236
242
|
version: '0'
|
|
237
243
|
requirements: []
|
|
238
|
-
rubygems_version: 4.0.
|
|
244
|
+
rubygems_version: 4.0.6
|
|
239
245
|
specification_version: 4
|
|
240
246
|
summary: Ruby library for the Trophy API.
|
|
241
247
|
test_files: []
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "points_trigger_response_type"
|
|
4
|
-
require_relative "points_trigger_response_status"
|
|
5
|
-
require_relative "points_trigger_response_time_unit"
|
|
6
|
-
require_relative "points_trigger_response_user_attributes_item"
|
|
7
|
-
require_relative "points_trigger_response_event_attribute"
|
|
8
|
-
require "date"
|
|
9
|
-
require "ostruct"
|
|
10
|
-
require "json"
|
|
11
|
-
|
|
12
|
-
module TrophyApiClient
|
|
13
|
-
class PointsTriggerResponse
|
|
14
|
-
# @return [String] The unique ID of the trigger.
|
|
15
|
-
attr_reader :id
|
|
16
|
-
# @return [TrophyApiClient::PointsTriggerResponseType] The type of trigger.
|
|
17
|
-
attr_reader :type
|
|
18
|
-
# @return [Integer] The points awarded by this trigger.
|
|
19
|
-
attr_reader :points
|
|
20
|
-
# @return [TrophyApiClient::PointsTriggerResponseStatus] The status of the trigger.
|
|
21
|
-
attr_reader :status
|
|
22
|
-
# @return [String] The unique ID of the achievement associated with this trigger, if the trigger is
|
|
23
|
-
# an achievement.
|
|
24
|
-
attr_reader :achievement_id
|
|
25
|
-
# @return [String] The unique ID of the metric associated with this trigger, if the trigger is a
|
|
26
|
-
# metric.
|
|
27
|
-
attr_reader :metric_id
|
|
28
|
-
# @return [Integer] The amount that a user must increase the metric to earn the points, if the
|
|
29
|
-
# trigger is a metric.
|
|
30
|
-
attr_reader :metric_threshold
|
|
31
|
-
# @return [Integer] The number of consecutive streak periods that a user must complete to earn the
|
|
32
|
-
# points, if the trigger is a streak.
|
|
33
|
-
attr_reader :streak_length_threshold
|
|
34
|
-
# @return [String] The name of the metric associated with this trigger, if the trigger is a metric.
|
|
35
|
-
attr_reader :metric_name
|
|
36
|
-
# @return [String] The name of the achievement associated with this trigger, if the trigger is an
|
|
37
|
-
# achievement.
|
|
38
|
-
attr_reader :achievement_name
|
|
39
|
-
# @return [TrophyApiClient::PointsTriggerResponseTimeUnit] The time unit of the trigger, if the trigger is a time interval.
|
|
40
|
-
attr_reader :time_unit
|
|
41
|
-
# @return [Integer] The interval of the trigger in the time unit, if the trigger is a time interval.
|
|
42
|
-
attr_reader :time_interval
|
|
43
|
-
# @return [Array<TrophyApiClient::PointsTriggerResponseUserAttributesItem>] User attribute filters that must be met for this trigger to activate. Only
|
|
44
|
-
# present if the trigger has user attribute filters configured.
|
|
45
|
-
attr_reader :user_attributes
|
|
46
|
-
# @return [TrophyApiClient::PointsTriggerResponseEventAttribute] Event attribute filter that must be met for this trigger to activate. Only
|
|
47
|
-
# present if the trigger has an event filter configured.
|
|
48
|
-
attr_reader :event_attribute
|
|
49
|
-
# @return [DateTime] The date and time the trigger was created, in ISO 8601 format.
|
|
50
|
-
attr_reader :created
|
|
51
|
-
# @return [DateTime] The date and time the trigger was last updated, in ISO 8601 format.
|
|
52
|
-
attr_reader :updated
|
|
53
|
-
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
54
|
-
attr_reader :additional_properties
|
|
55
|
-
# @return [Object]
|
|
56
|
-
attr_reader :_field_set
|
|
57
|
-
protected :_field_set
|
|
58
|
-
|
|
59
|
-
OMIT = Object.new
|
|
60
|
-
|
|
61
|
-
# @param id [String] The unique ID of the trigger.
|
|
62
|
-
# @param type [TrophyApiClient::PointsTriggerResponseType] The type of trigger.
|
|
63
|
-
# @param points [Integer] The points awarded by this trigger.
|
|
64
|
-
# @param status [TrophyApiClient::PointsTriggerResponseStatus] The status of the trigger.
|
|
65
|
-
# @param achievement_id [String] The unique ID of the achievement associated with this trigger, if the trigger is
|
|
66
|
-
# an achievement.
|
|
67
|
-
# @param metric_id [String] The unique ID of the metric associated with this trigger, if the trigger is a
|
|
68
|
-
# metric.
|
|
69
|
-
# @param metric_threshold [Integer] The amount that a user must increase the metric to earn the points, if the
|
|
70
|
-
# trigger is a metric.
|
|
71
|
-
# @param streak_length_threshold [Integer] The number of consecutive streak periods that a user must complete to earn the
|
|
72
|
-
# points, if the trigger is a streak.
|
|
73
|
-
# @param metric_name [String] The name of the metric associated with this trigger, if the trigger is a metric.
|
|
74
|
-
# @param achievement_name [String] The name of the achievement associated with this trigger, if the trigger is an
|
|
75
|
-
# achievement.
|
|
76
|
-
# @param time_unit [TrophyApiClient::PointsTriggerResponseTimeUnit] The time unit of the trigger, if the trigger is a time interval.
|
|
77
|
-
# @param time_interval [Integer] The interval of the trigger in the time unit, if the trigger is a time interval.
|
|
78
|
-
# @param user_attributes [Array<TrophyApiClient::PointsTriggerResponseUserAttributesItem>] User attribute filters that must be met for this trigger to activate. Only
|
|
79
|
-
# present if the trigger has user attribute filters configured.
|
|
80
|
-
# @param event_attribute [TrophyApiClient::PointsTriggerResponseEventAttribute] Event attribute filter that must be met for this trigger to activate. Only
|
|
81
|
-
# present if the trigger has an event filter configured.
|
|
82
|
-
# @param created [DateTime] The date and time the trigger was created, in ISO 8601 format.
|
|
83
|
-
# @param updated [DateTime] The date and time the trigger was last updated, in ISO 8601 format.
|
|
84
|
-
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
85
|
-
# @return [TrophyApiClient::PointsTriggerResponse]
|
|
86
|
-
def initialize(id:, type:, points:, status:, created:, updated:, achievement_id: OMIT, metric_id: OMIT, metric_threshold: OMIT,
|
|
87
|
-
streak_length_threshold: OMIT, metric_name: OMIT, achievement_name: OMIT, time_unit: OMIT, time_interval: OMIT, user_attributes: OMIT, event_attribute: OMIT, additional_properties: nil)
|
|
88
|
-
@id = id
|
|
89
|
-
@type = type
|
|
90
|
-
@points = points
|
|
91
|
-
@status = status
|
|
92
|
-
@achievement_id = achievement_id if achievement_id != OMIT
|
|
93
|
-
@metric_id = metric_id if metric_id != OMIT
|
|
94
|
-
@metric_threshold = metric_threshold if metric_threshold != OMIT
|
|
95
|
-
@streak_length_threshold = streak_length_threshold if streak_length_threshold != OMIT
|
|
96
|
-
@metric_name = metric_name if metric_name != OMIT
|
|
97
|
-
@achievement_name = achievement_name if achievement_name != OMIT
|
|
98
|
-
@time_unit = time_unit if time_unit != OMIT
|
|
99
|
-
@time_interval = time_interval if time_interval != OMIT
|
|
100
|
-
@user_attributes = user_attributes if user_attributes != OMIT
|
|
101
|
-
@event_attribute = event_attribute if event_attribute != OMIT
|
|
102
|
-
@created = created
|
|
103
|
-
@updated = updated
|
|
104
|
-
@additional_properties = additional_properties
|
|
105
|
-
@_field_set = {
|
|
106
|
-
"id": id,
|
|
107
|
-
"type": type,
|
|
108
|
-
"points": points,
|
|
109
|
-
"status": status,
|
|
110
|
-
"achievementId": achievement_id,
|
|
111
|
-
"metricId": metric_id,
|
|
112
|
-
"metricThreshold": metric_threshold,
|
|
113
|
-
"streakLengthThreshold": streak_length_threshold,
|
|
114
|
-
"metricName": metric_name,
|
|
115
|
-
"achievementName": achievement_name,
|
|
116
|
-
"timeUnit": time_unit,
|
|
117
|
-
"timeInterval": time_interval,
|
|
118
|
-
"userAttributes": user_attributes,
|
|
119
|
-
"eventAttribute": event_attribute,
|
|
120
|
-
"created": created,
|
|
121
|
-
"updated": updated
|
|
122
|
-
}.reject do |_k, v|
|
|
123
|
-
v == OMIT
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
# Deserialize a JSON object to an instance of PointsTriggerResponse
|
|
128
|
-
#
|
|
129
|
-
# @param json_object [String]
|
|
130
|
-
# @return [TrophyApiClient::PointsTriggerResponse]
|
|
131
|
-
def self.from_json(json_object:)
|
|
132
|
-
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
133
|
-
parsed_json = JSON.parse(json_object)
|
|
134
|
-
id = parsed_json["id"]
|
|
135
|
-
type = parsed_json["type"]
|
|
136
|
-
points = parsed_json["points"]
|
|
137
|
-
status = parsed_json["status"]
|
|
138
|
-
achievement_id = parsed_json["achievementId"]
|
|
139
|
-
metric_id = parsed_json["metricId"]
|
|
140
|
-
metric_threshold = parsed_json["metricThreshold"]
|
|
141
|
-
streak_length_threshold = parsed_json["streakLengthThreshold"]
|
|
142
|
-
metric_name = parsed_json["metricName"]
|
|
143
|
-
achievement_name = parsed_json["achievementName"]
|
|
144
|
-
time_unit = parsed_json["timeUnit"]
|
|
145
|
-
time_interval = parsed_json["timeInterval"]
|
|
146
|
-
user_attributes = parsed_json["userAttributes"]&.map do |item|
|
|
147
|
-
item = item.to_json
|
|
148
|
-
TrophyApiClient::PointsTriggerResponseUserAttributesItem.from_json(json_object: item)
|
|
149
|
-
end
|
|
150
|
-
if parsed_json["eventAttribute"].nil?
|
|
151
|
-
event_attribute = nil
|
|
152
|
-
else
|
|
153
|
-
event_attribute = parsed_json["eventAttribute"].to_json
|
|
154
|
-
event_attribute = TrophyApiClient::PointsTriggerResponseEventAttribute.from_json(json_object: event_attribute)
|
|
155
|
-
end
|
|
156
|
-
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
|
157
|
-
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
|
158
|
-
new(
|
|
159
|
-
id: id,
|
|
160
|
-
type: type,
|
|
161
|
-
points: points,
|
|
162
|
-
status: status,
|
|
163
|
-
achievement_id: achievement_id,
|
|
164
|
-
metric_id: metric_id,
|
|
165
|
-
metric_threshold: metric_threshold,
|
|
166
|
-
streak_length_threshold: streak_length_threshold,
|
|
167
|
-
metric_name: metric_name,
|
|
168
|
-
achievement_name: achievement_name,
|
|
169
|
-
time_unit: time_unit,
|
|
170
|
-
time_interval: time_interval,
|
|
171
|
-
user_attributes: user_attributes,
|
|
172
|
-
event_attribute: event_attribute,
|
|
173
|
-
created: created,
|
|
174
|
-
updated: updated,
|
|
175
|
-
additional_properties: struct
|
|
176
|
-
)
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
# Serialize an instance of PointsTriggerResponse to a JSON object
|
|
180
|
-
#
|
|
181
|
-
# @return [String]
|
|
182
|
-
def to_json(*_args)
|
|
183
|
-
@_field_set&.to_json
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
187
|
-
# hash and check each fields type against the current object's property
|
|
188
|
-
# definitions.
|
|
189
|
-
#
|
|
190
|
-
# @param obj [Object]
|
|
191
|
-
# @return [Void]
|
|
192
|
-
def self.validate_raw(obj:)
|
|
193
|
-
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
194
|
-
obj.type.is_a?(TrophyApiClient::PointsTriggerResponseType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
195
|
-
obj.points.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
|
|
196
|
-
obj.status.is_a?(TrophyApiClient::PointsTriggerResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
197
|
-
obj.achievement_id&.is_a?(String) != false || raise("Passed value for field obj.achievement_id is not the expected type, validation failed.")
|
|
198
|
-
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
199
|
-
obj.metric_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.metric_threshold is not the expected type, validation failed.")
|
|
200
|
-
obj.streak_length_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length_threshold is not the expected type, validation failed.")
|
|
201
|
-
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
202
|
-
obj.achievement_name&.is_a?(String) != false || raise("Passed value for field obj.achievement_name is not the expected type, validation failed.")
|
|
203
|
-
obj.time_unit&.is_a?(TrophyApiClient::PointsTriggerResponseTimeUnit) != false || raise("Passed value for field obj.time_unit is not the expected type, validation failed.")
|
|
204
|
-
obj.time_interval&.is_a?(Integer) != false || raise("Passed value for field obj.time_interval is not the expected type, validation failed.")
|
|
205
|
-
obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
|
206
|
-
obj.event_attribute.nil? || TrophyApiClient::PointsTriggerResponseEventAttribute.validate_raw(obj: obj.event_attribute)
|
|
207
|
-
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
|
208
|
-
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
|
209
|
-
end
|
|
210
|
-
end
|
|
211
|
-
end
|