trophy_api_client 1.13.0 → 1.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63cf1c72d377d4e597ede4a41d8114467eb3234e3aa16322447a03ea2a27fc0a
4
- data.tar.gz: 17dd217600b02a7ec867e9a2ffed08baafa6761d159638c1ae9058994848920f
3
+ metadata.gz: 45068f7d5694f561b61d480fa8e8d89c556f9dfa860f75689cbcf4b4fa2098c3
4
+ data.tar.gz: a86937078e80ad934bcc256ea439cf3403b3ae583e3dbdd2cea5e73e72f5da64
5
5
  SHA512:
6
- metadata.gz: 7e7a475bcefa4b4935e398395e7a0fd365006a170442ca1f86534f28d26a229d46336f967a4877eab8fda1092241e818d50cb32d6c916a8d92f370c153a0f3bb
7
- data.tar.gz: 74b391c48f09d09b03f4fa6b7b2da9e47869b831bb4a5842a67eef233a89bf0132975ccf6d4e4e4e5d55aaa64d7ddc643ef59c3291e8fd2a0ce448e3b2910405
6
+ metadata.gz: e8fac77c390e4bc53659399927abd76957c181addeec88f300098fc04fc4a84ac5a6e48284ab00fe05e160db003ef8c9e6efa2c15d10af1bc50327539f77c6cb
7
+ data.tar.gz: 98a01274b0a1003797a4f1bd0f202a8aaeccc2d675be465244749a607461bd888dd825d5734c90960d0f86507b6afc07eac04cba8ffcf5d1e6ffa2fad792e01d
data/lib/gemconfig.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  module Gemconfig
5
- VERSION = "1.13.0"
5
+ VERSION = "1.14.0"
6
6
  AUTHORS = ["Trophy Labs, Inc"].freeze
7
7
  EMAIL = ""
8
8
  SUMMARY = "Ruby library for the Trophy API."
@@ -6,9 +6,12 @@ require "ostruct"
6
6
  require "json"
7
7
 
8
8
  module TrophyApiClient
9
- # Per-user streak configuration. Requires streak customization to be enabled in
10
- # dashboard settings.
9
+ # Per-user streak configuration. Metric and evaluation mode overrides require
10
+ # streak customization to be enabled in dashboard settings.
11
11
  class StreakPreferences
12
+ # @return [Boolean] Whether streaks are calculated for this user. When false, the user's streak is
13
+ # always 0 and streak webhooks and notifications are not sent.
14
+ attr_reader :enabled
12
15
  # @return [TrophyApiClient::StreakEvaluationModePreference]
13
16
  attr_reader :evaluation_mode
14
17
  # @return [Array<TrophyApiClient::StreakMetricPreference>] Metrics and thresholds that count toward this user's streak.
@@ -21,15 +24,18 @@ module TrophyApiClient
21
24
 
22
25
  OMIT = Object.new
23
26
 
27
+ # @param enabled [Boolean] Whether streaks are calculated for this user. When false, the user's streak is
28
+ # always 0 and streak webhooks and notifications are not sent.
24
29
  # @param evaluation_mode [TrophyApiClient::StreakEvaluationModePreference]
25
30
  # @param metrics [Array<TrophyApiClient::StreakMetricPreference>] Metrics and thresholds that count toward this user's streak.
26
31
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
32
  # @return [TrophyApiClient::StreakPreferences]
28
- def initialize(evaluation_mode: OMIT, metrics: OMIT, additional_properties: nil)
33
+ def initialize(enabled: OMIT, evaluation_mode: OMIT, metrics: OMIT, additional_properties: nil)
34
+ @enabled = enabled if enabled != OMIT
29
35
  @evaluation_mode = evaluation_mode if evaluation_mode != OMIT
30
36
  @metrics = metrics if metrics != OMIT
31
37
  @additional_properties = additional_properties
32
- @_field_set = { "evaluationMode": evaluation_mode, "metrics": metrics }.reject do |_k, v|
38
+ @_field_set = { "enabled": enabled, "evaluationMode": evaluation_mode, "metrics": metrics }.reject do |_k, v|
33
39
  v == OMIT
34
40
  end
35
41
  end
@@ -41,12 +47,14 @@ module TrophyApiClient
41
47
  def self.from_json(json_object:)
42
48
  struct = JSON.parse(json_object, object_class: OpenStruct)
43
49
  parsed_json = JSON.parse(json_object)
50
+ enabled = parsed_json["enabled"]
44
51
  evaluation_mode = parsed_json["evaluationMode"]
45
52
  metrics = parsed_json["metrics"]&.map do |item|
46
53
  item = item.to_json
47
54
  TrophyApiClient::StreakMetricPreference.from_json(json_object: item)
48
55
  end
49
56
  new(
57
+ enabled: enabled,
50
58
  evaluation_mode: evaluation_mode,
51
59
  metrics: metrics,
52
60
  additional_properties: struct
@@ -67,6 +75,7 @@ module TrophyApiClient
67
75
  # @param obj [Object]
68
76
  # @return [Void]
69
77
  def self.validate_raw(obj:)
78
+ obj.enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.enabled is not the expected type, validation failed.")
70
79
  obj.evaluation_mode&.is_a?(TrophyApiClient::StreakEvaluationModePreference) != false || raise("Passed value for field obj.evaluation_mode is not the expected type, validation failed.")
71
80
  obj.metrics&.is_a?(Array) != false || raise("Passed value for field obj.metrics is not the expected type, validation failed.")
72
81
  end
@@ -222,6 +222,7 @@ module TrophyApiClient
222
222
  # * :reactivation (Array<TrophyApiClient::NotificationChannel>)
223
223
  # * :streak_reminder (Array<TrophyApiClient::NotificationChannel>)
224
224
  # @param streak [Hash] Request of type TrophyApiClient::StreakPreferences, as a Hash
225
+ # * :enabled (Boolean)
225
226
  # * :evaluation_mode (TrophyApiClient::StreakEvaluationModePreference)
226
227
  # * :metrics (Array<TrophyApiClient::StreakMetricPreference>)
227
228
  # @param request_options [TrophyApiClient::RequestOptions]
@@ -881,6 +882,7 @@ module TrophyApiClient
881
882
  # * :reactivation (Array<TrophyApiClient::NotificationChannel>)
882
883
  # * :streak_reminder (Array<TrophyApiClient::NotificationChannel>)
883
884
  # @param streak [Hash] Request of type TrophyApiClient::StreakPreferences, as a Hash
885
+ # * :enabled (Boolean)
884
886
  # * :evaluation_mode (TrophyApiClient::StreakEvaluationModePreference)
885
887
  # * :metrics (Array<TrophyApiClient::StreakMetricPreference>)
886
888
  # @param request_options [TrophyApiClient::RequestOptions]
@@ -1,3 +1,3 @@
1
1
  module MyGem
2
- VERSION = "1.13.0"
2
+ VERSION = "1.14.0"
3
3
  end
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.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trophy Labs, Inc