trophy_api_client 1.0.27 → 1.0.28
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/environment.rb +1 -1
- data/lib/gemconfig.rb +1 -1
- data/lib/requests.rb +8 -8
- data/lib/trophy_api_client/achievements/client.rb +10 -8
- data/lib/trophy_api_client/admin/client.rb +30 -0
- data/lib/trophy_api_client/admin/streaks/client.rb +32 -0
- data/lib/trophy_api_client/admin/streaks/freezes/client.rb +98 -0
- data/lib/trophy_api_client/admin/streaks/freezes/types/create_streak_freezes_request_freezes_item.rb +62 -0
- data/lib/trophy_api_client/leaderboards/client.rb +8 -8
- data/lib/trophy_api_client/metrics/client.rb +4 -4
- data/lib/trophy_api_client/points/client.rb +8 -8
- data/lib/trophy_api_client/streaks/client.rb +8 -8
- data/lib/trophy_api_client/types/base_streak_response.rb +42 -2
- data/lib/trophy_api_client/types/bulk_insert_issue.rb +74 -0
- data/lib/trophy_api_client/types/bulk_insert_issue_level.rb +9 -0
- data/lib/trophy_api_client/types/create_streak_freezes_response.rb +60 -0
- data/lib/trophy_api_client/types/metric_event_streak_response.rb +42 -2
- data/lib/trophy_api_client/types/streak_response.rb +42 -2
- data/lib/trophy_api_client/types/streak_response_streak_history_item.rb +18 -2
- data/lib/trophy_api_client/users/client.rb +60 -48
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/trophy_api_client.rb +9 -2
- data/lib/types_export.rb +4 -0
- metadata +8 -1
@@ -18,6 +18,18 @@ module TrophyApiClient
|
|
18
18
|
attr_reader :period_end
|
19
19
|
# @return [String] The date the streak will expire if the user does not increment a metric.
|
20
20
|
attr_reader :expires
|
21
|
+
# @return [Integer] The number of available streak freezes. Only present if the organization has
|
22
|
+
# enabled streak freezes.
|
23
|
+
attr_reader :freezes
|
24
|
+
# @return [Integer] The maximum number of streak freezes a user can have. Only present if the
|
25
|
+
# organization has enabled streak freezes.
|
26
|
+
attr_reader :max_freezes
|
27
|
+
# @return [Integer] The interval at which the user will earn streak freezes, in days. Only present
|
28
|
+
# if the organization has enabled streak freeze auto-earn.
|
29
|
+
attr_reader :freeze_auto_earn_interval
|
30
|
+
# @return [Integer] The amount of streak freezes the user will earn per interval. Only present if
|
31
|
+
# the organization has enabled streak freeze auto-earn.
|
32
|
+
attr_reader :freeze_auto_earn_amount
|
21
33
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
22
34
|
attr_reader :additional_properties
|
23
35
|
# @return [Object]
|
@@ -32,16 +44,28 @@ module TrophyApiClient
|
|
32
44
|
# @param period_start [String] The start date of the current streak period.
|
33
45
|
# @param period_end [String] The end date of the current streak period.
|
34
46
|
# @param expires [String] The date the streak will expire if the user does not increment a metric.
|
47
|
+
# @param freezes [Integer] The number of available streak freezes. Only present if the organization has
|
48
|
+
# enabled streak freezes.
|
49
|
+
# @param max_freezes [Integer] The maximum number of streak freezes a user can have. Only present if the
|
50
|
+
# organization has enabled streak freezes.
|
51
|
+
# @param freeze_auto_earn_interval [Integer] The interval at which the user will earn streak freezes, in days. Only present
|
52
|
+
# if the organization has enabled streak freeze auto-earn.
|
53
|
+
# @param freeze_auto_earn_amount [Integer] The amount of streak freezes the user will earn per interval. Only present if
|
54
|
+
# the organization has enabled streak freeze auto-earn.
|
35
55
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
36
56
|
# @return [TrophyApiClient::BaseStreakResponse]
|
37
57
|
def initialize(length:, frequency:, started: OMIT, period_start: OMIT, period_end: OMIT, expires: OMIT,
|
38
|
-
additional_properties: nil)
|
58
|
+
freezes: OMIT, max_freezes: OMIT, freeze_auto_earn_interval: OMIT, freeze_auto_earn_amount: OMIT, additional_properties: nil)
|
39
59
|
@length = length
|
40
60
|
@frequency = frequency
|
41
61
|
@started = started if started != OMIT
|
42
62
|
@period_start = period_start if period_start != OMIT
|
43
63
|
@period_end = period_end if period_end != OMIT
|
44
64
|
@expires = expires if expires != OMIT
|
65
|
+
@freezes = freezes if freezes != OMIT
|
66
|
+
@max_freezes = max_freezes if max_freezes != OMIT
|
67
|
+
@freeze_auto_earn_interval = freeze_auto_earn_interval if freeze_auto_earn_interval != OMIT
|
68
|
+
@freeze_auto_earn_amount = freeze_auto_earn_amount if freeze_auto_earn_amount != OMIT
|
45
69
|
@additional_properties = additional_properties
|
46
70
|
@_field_set = {
|
47
71
|
"length": length,
|
@@ -49,7 +73,11 @@ module TrophyApiClient
|
|
49
73
|
"started": started,
|
50
74
|
"periodStart": period_start,
|
51
75
|
"periodEnd": period_end,
|
52
|
-
"expires": expires
|
76
|
+
"expires": expires,
|
77
|
+
"freezes": freezes,
|
78
|
+
"maxFreezes": max_freezes,
|
79
|
+
"freezeAutoEarnInterval": freeze_auto_earn_interval,
|
80
|
+
"freezeAutoEarnAmount": freeze_auto_earn_amount
|
53
81
|
}.reject do |_k, v|
|
54
82
|
v == OMIT
|
55
83
|
end
|
@@ -68,6 +96,10 @@ module TrophyApiClient
|
|
68
96
|
period_start = parsed_json["periodStart"]
|
69
97
|
period_end = parsed_json["periodEnd"]
|
70
98
|
expires = parsed_json["expires"]
|
99
|
+
freezes = parsed_json["freezes"]
|
100
|
+
max_freezes = parsed_json["maxFreezes"]
|
101
|
+
freeze_auto_earn_interval = parsed_json["freezeAutoEarnInterval"]
|
102
|
+
freeze_auto_earn_amount = parsed_json["freezeAutoEarnAmount"]
|
71
103
|
new(
|
72
104
|
length: length,
|
73
105
|
frequency: frequency,
|
@@ -75,6 +107,10 @@ module TrophyApiClient
|
|
75
107
|
period_start: period_start,
|
76
108
|
period_end: period_end,
|
77
109
|
expires: expires,
|
110
|
+
freezes: freezes,
|
111
|
+
max_freezes: max_freezes,
|
112
|
+
freeze_auto_earn_interval: freeze_auto_earn_interval,
|
113
|
+
freeze_auto_earn_amount: freeze_auto_earn_amount,
|
78
114
|
additional_properties: struct
|
79
115
|
)
|
80
116
|
end
|
@@ -99,6 +135,10 @@ module TrophyApiClient
|
|
99
135
|
obj.period_start&.is_a?(String) != false || raise("Passed value for field obj.period_start is not the expected type, validation failed.")
|
100
136
|
obj.period_end&.is_a?(String) != false || raise("Passed value for field obj.period_end is not the expected type, validation failed.")
|
101
137
|
obj.expires&.is_a?(String) != false || raise("Passed value for field obj.expires is not the expected type, validation failed.")
|
138
|
+
obj.freezes&.is_a?(Integer) != false || raise("Passed value for field obj.freezes is not the expected type, validation failed.")
|
139
|
+
obj.max_freezes&.is_a?(Integer) != false || raise("Passed value for field obj.max_freezes is not the expected type, validation failed.")
|
140
|
+
obj.freeze_auto_earn_interval&.is_a?(Integer) != false || raise("Passed value for field obj.freeze_auto_earn_interval is not the expected type, validation failed.")
|
141
|
+
obj.freeze_auto_earn_amount&.is_a?(Integer) != false || raise("Passed value for field obj.freeze_auto_earn_amount is not the expected type, validation failed.")
|
102
142
|
end
|
103
143
|
end
|
104
144
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "bulk_insert_issue_level"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module TrophyApiClient
|
8
|
+
# An issue encountered while bulk inserting data.
|
9
|
+
class BulkInsertIssue
|
10
|
+
# @return [String] The ID of the user the issue relates to.
|
11
|
+
attr_reader :user_id
|
12
|
+
# @return [TrophyApiClient::BulkInsertIssueLevel] The severity level of the issue.
|
13
|
+
attr_reader :level
|
14
|
+
# @return [String] A human-readable description of the issue.
|
15
|
+
attr_reader :reason
|
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 user_id [String] The ID of the user the issue relates to.
|
25
|
+
# @param level [TrophyApiClient::BulkInsertIssueLevel] The severity level of the issue.
|
26
|
+
# @param reason [String] A human-readable description of the issue.
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
# @return [TrophyApiClient::BulkInsertIssue]
|
29
|
+
def initialize(user_id:, level:, reason:, additional_properties: nil)
|
30
|
+
@user_id = user_id
|
31
|
+
@level = level
|
32
|
+
@reason = reason
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
@_field_set = { "userId": user_id, "level": level, "reason": reason }
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of BulkInsertIssue
|
38
|
+
#
|
39
|
+
# @param json_object [String]
|
40
|
+
# @return [TrophyApiClient::BulkInsertIssue]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
user_id = parsed_json["userId"]
|
45
|
+
level = parsed_json["level"]
|
46
|
+
reason = parsed_json["reason"]
|
47
|
+
new(
|
48
|
+
user_id: user_id,
|
49
|
+
level: level,
|
50
|
+
reason: reason,
|
51
|
+
additional_properties: struct
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Serialize an instance of BulkInsertIssue to a JSON object
|
56
|
+
#
|
57
|
+
# @return [String]
|
58
|
+
def to_json(*_args)
|
59
|
+
@_field_set&.to_json
|
60
|
+
end
|
61
|
+
|
62
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
63
|
+
# hash and check each fields type against the current object's property
|
64
|
+
# definitions.
|
65
|
+
#
|
66
|
+
# @param obj [Object]
|
67
|
+
# @return [Void]
|
68
|
+
def self.validate_raw(obj:)
|
69
|
+
obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
|
70
|
+
obj.level.is_a?(TrophyApiClient::BulkInsertIssueLevel) != false || raise("Passed value for field obj.level is not the expected type, validation failed.")
|
71
|
+
obj.reason.is_a?(String) != false || raise("Passed value for field obj.reason is not the expected type, validation failed.")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "bulk_insert_issue"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module TrophyApiClient
|
8
|
+
# Response containing any issues encountered while creating streak freezes.
|
9
|
+
class CreateStreakFreezesResponse
|
10
|
+
# @return [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during freeze creation.
|
11
|
+
attr_reader :issues
|
12
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
attr_reader :additional_properties
|
14
|
+
# @return [Object]
|
15
|
+
attr_reader :_field_set
|
16
|
+
protected :_field_set
|
17
|
+
|
18
|
+
OMIT = Object.new
|
19
|
+
|
20
|
+
# @param issues [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during freeze creation.
|
21
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
22
|
+
# @return [TrophyApiClient::CreateStreakFreezesResponse]
|
23
|
+
def initialize(issues:, additional_properties: nil)
|
24
|
+
@issues = issues
|
25
|
+
@additional_properties = additional_properties
|
26
|
+
@_field_set = { "issues": issues }
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserialize a JSON object to an instance of CreateStreakFreezesResponse
|
30
|
+
#
|
31
|
+
# @param json_object [String]
|
32
|
+
# @return [TrophyApiClient::CreateStreakFreezesResponse]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
parsed_json = JSON.parse(json_object)
|
36
|
+
issues = parsed_json["issues"]&.map do |item|
|
37
|
+
item = item.to_json
|
38
|
+
TrophyApiClient::BulkInsertIssue.from_json(json_object: item)
|
39
|
+
end
|
40
|
+
new(issues: issues, additional_properties: struct)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Serialize an instance of CreateStreakFreezesResponse to a JSON object
|
44
|
+
#
|
45
|
+
# @return [String]
|
46
|
+
def to_json(*_args)
|
47
|
+
@_field_set&.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
51
|
+
# hash and check each fields type against the current object's property
|
52
|
+
# definitions.
|
53
|
+
#
|
54
|
+
# @param obj [Object]
|
55
|
+
# @return [Void]
|
56
|
+
def self.validate_raw(obj:)
|
57
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -21,6 +21,18 @@ module TrophyApiClient
|
|
21
21
|
attr_reader :period_end
|
22
22
|
# @return [String] The date the streak will expire if the user does not increment a metric.
|
23
23
|
attr_reader :expires
|
24
|
+
# @return [Integer] The number of available streak freezes. Only present if the organization has
|
25
|
+
# enabled streak freezes.
|
26
|
+
attr_reader :freezes
|
27
|
+
# @return [Integer] The maximum number of streak freezes a user can have. Only present if the
|
28
|
+
# organization has enabled streak freezes.
|
29
|
+
attr_reader :max_freezes
|
30
|
+
# @return [Integer] The interval at which the user will earn streak freezes, in days. Only present
|
31
|
+
# if the organization has enabled streak freeze auto-earn.
|
32
|
+
attr_reader :freeze_auto_earn_interval
|
33
|
+
# @return [Integer] The amount of streak freezes the user will earn per interval. Only present if
|
34
|
+
# the organization has enabled streak freeze auto-earn.
|
35
|
+
attr_reader :freeze_auto_earn_amount
|
24
36
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
25
37
|
attr_reader :additional_properties
|
26
38
|
# @return [Object]
|
@@ -36,10 +48,18 @@ module TrophyApiClient
|
|
36
48
|
# @param period_start [String] The start date of the current streak period.
|
37
49
|
# @param period_end [String] The end date of the current streak period.
|
38
50
|
# @param expires [String] The date the streak will expire if the user does not increment a metric.
|
51
|
+
# @param freezes [Integer] The number of available streak freezes. Only present if the organization has
|
52
|
+
# enabled streak freezes.
|
53
|
+
# @param max_freezes [Integer] The maximum number of streak freezes a user can have. Only present if the
|
54
|
+
# organization has enabled streak freezes.
|
55
|
+
# @param freeze_auto_earn_interval [Integer] The interval at which the user will earn streak freezes, in days. Only present
|
56
|
+
# if the organization has enabled streak freeze auto-earn.
|
57
|
+
# @param freeze_auto_earn_amount [Integer] The amount of streak freezes the user will earn per interval. Only present if
|
58
|
+
# the organization has enabled streak freeze auto-earn.
|
39
59
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
40
60
|
# @return [TrophyApiClient::MetricEventStreakResponse]
|
41
61
|
def initialize(length:, frequency:, extended: OMIT, started: OMIT, period_start: OMIT, period_end: OMIT,
|
42
|
-
expires: OMIT, additional_properties: nil)
|
62
|
+
expires: OMIT, freezes: OMIT, max_freezes: OMIT, freeze_auto_earn_interval: OMIT, freeze_auto_earn_amount: OMIT, additional_properties: nil)
|
43
63
|
@extended = extended if extended != OMIT
|
44
64
|
@length = length
|
45
65
|
@frequency = frequency
|
@@ -47,6 +67,10 @@ module TrophyApiClient
|
|
47
67
|
@period_start = period_start if period_start != OMIT
|
48
68
|
@period_end = period_end if period_end != OMIT
|
49
69
|
@expires = expires if expires != OMIT
|
70
|
+
@freezes = freezes if freezes != OMIT
|
71
|
+
@max_freezes = max_freezes if max_freezes != OMIT
|
72
|
+
@freeze_auto_earn_interval = freeze_auto_earn_interval if freeze_auto_earn_interval != OMIT
|
73
|
+
@freeze_auto_earn_amount = freeze_auto_earn_amount if freeze_auto_earn_amount != OMIT
|
50
74
|
@additional_properties = additional_properties
|
51
75
|
@_field_set = {
|
52
76
|
"extended": extended,
|
@@ -55,7 +79,11 @@ module TrophyApiClient
|
|
55
79
|
"started": started,
|
56
80
|
"periodStart": period_start,
|
57
81
|
"periodEnd": period_end,
|
58
|
-
"expires": expires
|
82
|
+
"expires": expires,
|
83
|
+
"freezes": freezes,
|
84
|
+
"maxFreezes": max_freezes,
|
85
|
+
"freezeAutoEarnInterval": freeze_auto_earn_interval,
|
86
|
+
"freezeAutoEarnAmount": freeze_auto_earn_amount
|
59
87
|
}.reject do |_k, v|
|
60
88
|
v == OMIT
|
61
89
|
end
|
@@ -75,6 +103,10 @@ module TrophyApiClient
|
|
75
103
|
period_start = parsed_json["periodStart"]
|
76
104
|
period_end = parsed_json["periodEnd"]
|
77
105
|
expires = parsed_json["expires"]
|
106
|
+
freezes = parsed_json["freezes"]
|
107
|
+
max_freezes = parsed_json["maxFreezes"]
|
108
|
+
freeze_auto_earn_interval = parsed_json["freezeAutoEarnInterval"]
|
109
|
+
freeze_auto_earn_amount = parsed_json["freezeAutoEarnAmount"]
|
78
110
|
new(
|
79
111
|
extended: extended,
|
80
112
|
length: length,
|
@@ -83,6 +115,10 @@ module TrophyApiClient
|
|
83
115
|
period_start: period_start,
|
84
116
|
period_end: period_end,
|
85
117
|
expires: expires,
|
118
|
+
freezes: freezes,
|
119
|
+
max_freezes: max_freezes,
|
120
|
+
freeze_auto_earn_interval: freeze_auto_earn_interval,
|
121
|
+
freeze_auto_earn_amount: freeze_auto_earn_amount,
|
86
122
|
additional_properties: struct
|
87
123
|
)
|
88
124
|
end
|
@@ -108,6 +144,10 @@ module TrophyApiClient
|
|
108
144
|
obj.period_start&.is_a?(String) != false || raise("Passed value for field obj.period_start is not the expected type, validation failed.")
|
109
145
|
obj.period_end&.is_a?(String) != false || raise("Passed value for field obj.period_end is not the expected type, validation failed.")
|
110
146
|
obj.expires&.is_a?(String) != false || raise("Passed value for field obj.expires is not the expected type, validation failed.")
|
147
|
+
obj.freezes&.is_a?(Integer) != false || raise("Passed value for field obj.freezes is not the expected type, validation failed.")
|
148
|
+
obj.max_freezes&.is_a?(Integer) != false || raise("Passed value for field obj.max_freezes is not the expected type, validation failed.")
|
149
|
+
obj.freeze_auto_earn_interval&.is_a?(Integer) != false || raise("Passed value for field obj.freeze_auto_earn_interval is not the expected type, validation failed.")
|
150
|
+
obj.freeze_auto_earn_amount&.is_a?(Integer) != false || raise("Passed value for field obj.freeze_auto_earn_amount is not the expected type, validation failed.")
|
111
151
|
end
|
112
152
|
end
|
113
153
|
end
|
@@ -25,6 +25,18 @@ module TrophyApiClient
|
|
25
25
|
attr_reader :period_end
|
26
26
|
# @return [String] The date the streak will expire if the user does not increment a metric.
|
27
27
|
attr_reader :expires
|
28
|
+
# @return [Integer] The number of available streak freezes. Only present if the organization has
|
29
|
+
# enabled streak freezes.
|
30
|
+
attr_reader :freezes
|
31
|
+
# @return [Integer] The maximum number of streak freezes a user can have. Only present if the
|
32
|
+
# organization has enabled streak freezes.
|
33
|
+
attr_reader :max_freezes
|
34
|
+
# @return [Integer] The interval at which the user will earn streak freezes, in days. Only present
|
35
|
+
# if the organization has enabled streak freeze auto-earn.
|
36
|
+
attr_reader :freeze_auto_earn_interval
|
37
|
+
# @return [Integer] The amount of streak freezes the user will earn per interval. Only present if
|
38
|
+
# the organization has enabled streak freeze auto-earn.
|
39
|
+
attr_reader :freeze_auto_earn_amount
|
28
40
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
29
41
|
attr_reader :additional_properties
|
30
42
|
# @return [Object]
|
@@ -42,10 +54,18 @@ module TrophyApiClient
|
|
42
54
|
# @param period_start [String] The start date of the current streak period.
|
43
55
|
# @param period_end [String] The end date of the current streak period.
|
44
56
|
# @param expires [String] The date the streak will expire if the user does not increment a metric.
|
57
|
+
# @param freezes [Integer] The number of available streak freezes. Only present if the organization has
|
58
|
+
# enabled streak freezes.
|
59
|
+
# @param max_freezes [Integer] The maximum number of streak freezes a user can have. Only present if the
|
60
|
+
# organization has enabled streak freezes.
|
61
|
+
# @param freeze_auto_earn_interval [Integer] The interval at which the user will earn streak freezes, in days. Only present
|
62
|
+
# if the organization has enabled streak freeze auto-earn.
|
63
|
+
# @param freeze_auto_earn_amount [Integer] The amount of streak freezes the user will earn per interval. Only present if
|
64
|
+
# the organization has enabled streak freeze auto-earn.
|
45
65
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
46
66
|
# @return [TrophyApiClient::StreakResponse]
|
47
67
|
def initialize(length:, frequency:, streak_history: OMIT, rank: OMIT, started: OMIT, period_start: OMIT,
|
48
|
-
period_end: OMIT, expires: OMIT, additional_properties: nil)
|
68
|
+
period_end: OMIT, expires: OMIT, freezes: OMIT, max_freezes: OMIT, freeze_auto_earn_interval: OMIT, freeze_auto_earn_amount: OMIT, additional_properties: nil)
|
49
69
|
@streak_history = streak_history if streak_history != OMIT
|
50
70
|
@rank = rank if rank != OMIT
|
51
71
|
@length = length
|
@@ -54,6 +74,10 @@ module TrophyApiClient
|
|
54
74
|
@period_start = period_start if period_start != OMIT
|
55
75
|
@period_end = period_end if period_end != OMIT
|
56
76
|
@expires = expires if expires != OMIT
|
77
|
+
@freezes = freezes if freezes != OMIT
|
78
|
+
@max_freezes = max_freezes if max_freezes != OMIT
|
79
|
+
@freeze_auto_earn_interval = freeze_auto_earn_interval if freeze_auto_earn_interval != OMIT
|
80
|
+
@freeze_auto_earn_amount = freeze_auto_earn_amount if freeze_auto_earn_amount != OMIT
|
57
81
|
@additional_properties = additional_properties
|
58
82
|
@_field_set = {
|
59
83
|
"streakHistory": streak_history,
|
@@ -63,7 +87,11 @@ module TrophyApiClient
|
|
63
87
|
"started": started,
|
64
88
|
"periodStart": period_start,
|
65
89
|
"periodEnd": period_end,
|
66
|
-
"expires": expires
|
90
|
+
"expires": expires,
|
91
|
+
"freezes": freezes,
|
92
|
+
"maxFreezes": max_freezes,
|
93
|
+
"freezeAutoEarnInterval": freeze_auto_earn_interval,
|
94
|
+
"freezeAutoEarnAmount": freeze_auto_earn_amount
|
67
95
|
}.reject do |_k, v|
|
68
96
|
v == OMIT
|
69
97
|
end
|
@@ -87,6 +115,10 @@ module TrophyApiClient
|
|
87
115
|
period_start = parsed_json["periodStart"]
|
88
116
|
period_end = parsed_json["periodEnd"]
|
89
117
|
expires = parsed_json["expires"]
|
118
|
+
freezes = parsed_json["freezes"]
|
119
|
+
max_freezes = parsed_json["maxFreezes"]
|
120
|
+
freeze_auto_earn_interval = parsed_json["freezeAutoEarnInterval"]
|
121
|
+
freeze_auto_earn_amount = parsed_json["freezeAutoEarnAmount"]
|
90
122
|
new(
|
91
123
|
streak_history: streak_history,
|
92
124
|
rank: rank,
|
@@ -96,6 +128,10 @@ module TrophyApiClient
|
|
96
128
|
period_start: period_start,
|
97
129
|
period_end: period_end,
|
98
130
|
expires: expires,
|
131
|
+
freezes: freezes,
|
132
|
+
max_freezes: max_freezes,
|
133
|
+
freeze_auto_earn_interval: freeze_auto_earn_interval,
|
134
|
+
freeze_auto_earn_amount: freeze_auto_earn_amount,
|
99
135
|
additional_properties: struct
|
100
136
|
)
|
101
137
|
end
|
@@ -122,6 +158,10 @@ module TrophyApiClient
|
|
122
158
|
obj.period_start&.is_a?(String) != false || raise("Passed value for field obj.period_start is not the expected type, validation failed.")
|
123
159
|
obj.period_end&.is_a?(String) != false || raise("Passed value for field obj.period_end is not the expected type, validation failed.")
|
124
160
|
obj.expires&.is_a?(String) != false || raise("Passed value for field obj.expires is not the expected type, validation failed.")
|
161
|
+
obj.freezes&.is_a?(Integer) != false || raise("Passed value for field obj.freezes is not the expected type, validation failed.")
|
162
|
+
obj.max_freezes&.is_a?(Integer) != false || raise("Passed value for field obj.max_freezes is not the expected type, validation failed.")
|
163
|
+
obj.freeze_auto_earn_interval&.is_a?(Integer) != false || raise("Passed value for field obj.freeze_auto_earn_interval is not the expected type, validation failed.")
|
164
|
+
obj.freeze_auto_earn_amount&.is_a?(Integer) != false || raise("Passed value for field obj.freeze_auto_earn_amount is not the expected type, validation failed.")
|
125
165
|
end
|
126
166
|
end
|
127
167
|
end
|
@@ -12,6 +12,9 @@ module TrophyApiClient
|
|
12
12
|
attr_reader :period_end
|
13
13
|
# @return [Integer] The length of the user's streak during this period.
|
14
14
|
attr_reader :length
|
15
|
+
# @return [Boolean] Whether the user used a streak freeze during this period. Only present if the
|
16
|
+
# organization has enabled streak freezes.
|
17
|
+
attr_reader :used_freeze
|
15
18
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
16
19
|
attr_reader :additional_properties
|
17
20
|
# @return [Object]
|
@@ -23,14 +26,24 @@ module TrophyApiClient
|
|
23
26
|
# @param period_start [String] The date this streak period started.
|
24
27
|
# @param period_end [String] The date this streak period ended.
|
25
28
|
# @param length [Integer] The length of the user's streak during this period.
|
29
|
+
# @param used_freeze [Boolean] Whether the user used a streak freeze during this period. Only present if the
|
30
|
+
# organization has enabled streak freezes.
|
26
31
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
27
32
|
# @return [TrophyApiClient::StreakResponseStreakHistoryItem]
|
28
|
-
def initialize(period_start:, period_end:, length:, additional_properties: nil)
|
33
|
+
def initialize(period_start:, period_end:, length:, used_freeze: OMIT, additional_properties: nil)
|
29
34
|
@period_start = period_start
|
30
35
|
@period_end = period_end
|
31
36
|
@length = length
|
37
|
+
@used_freeze = used_freeze if used_freeze != OMIT
|
32
38
|
@additional_properties = additional_properties
|
33
|
-
@_field_set = {
|
39
|
+
@_field_set = {
|
40
|
+
"periodStart": period_start,
|
41
|
+
"periodEnd": period_end,
|
42
|
+
"length": length,
|
43
|
+
"usedFreeze": used_freeze
|
44
|
+
}.reject do |_k, v|
|
45
|
+
v == OMIT
|
46
|
+
end
|
34
47
|
end
|
35
48
|
|
36
49
|
# Deserialize a JSON object to an instance of StreakResponseStreakHistoryItem
|
@@ -43,10 +56,12 @@ module TrophyApiClient
|
|
43
56
|
period_start = parsed_json["periodStart"]
|
44
57
|
period_end = parsed_json["periodEnd"]
|
45
58
|
length = parsed_json["length"]
|
59
|
+
used_freeze = parsed_json["usedFreeze"]
|
46
60
|
new(
|
47
61
|
period_start: period_start,
|
48
62
|
period_end: period_end,
|
49
63
|
length: length,
|
64
|
+
used_freeze: used_freeze,
|
50
65
|
additional_properties: struct
|
51
66
|
)
|
52
67
|
end
|
@@ -68,6 +83,7 @@ module TrophyApiClient
|
|
68
83
|
obj.period_start.is_a?(String) != false || raise("Passed value for field obj.period_start is not the expected type, validation failed.")
|
69
84
|
obj.period_end.is_a?(String) != false || raise("Passed value for field obj.period_end is not the expected type, validation failed.")
|
70
85
|
obj.length.is_a?(Integer) != false || raise("Passed value for field obj.length is not the expected type, validation failed.")
|
86
|
+
obj.used_freeze&.is_a?(Boolean) != false || raise("Passed value for field obj.used_freeze is not the expected type, validation failed.")
|
71
87
|
end
|
72
88
|
end
|
73
89
|
end
|