trophy_api_client 1.0.31 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/achievements/client.rb +2 -2
- data/lib/trophy_api_client/leaderboards/client.rb +10 -8
- data/lib/trophy_api_client/metrics/client.rb +2 -2
- data/lib/trophy_api_client/types/event_response.rb +8 -4
- data/lib/trophy_api_client/types/streak_frequency.rb +0 -1
- data/lib/trophy_api_client/types/updated_user.rb +11 -11
- data/lib/trophy_api_client/types/upserted_user.rb +12 -12
- data/lib/trophy_api_client/types/user.rb +42 -44
- data/lib/trophy_api_client/users/client.rb +6 -6
- data/lib/trophy_api_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c366f7c278a1c8b7f7698f91cc5f448abe91920b95de8e2121d59b96167d5990
|
|
4
|
+
data.tar.gz: 4f78d0b2180d000591f917d5bad471dde99320a6760b1f1607408a482b8fb39c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23b37ab57e5d7fd361ffc96e303949452eb625a528430d728eef81c36d59323afb7a5cfe6dfcafdee57890bbe7fef33a81d82d18efa6f0874cc33a33fc98b835
|
|
7
|
+
data.tar.gz: 379550d242727643d53856cc6e8880ccb2f918e6feaf844535589f7473e18a3877b6a71a89c1ce540fd0081a796742f9b108ec0dd533823c50dfbe9aec24f97b
|
data/lib/gemconfig.rb
CHANGED
|
@@ -76,7 +76,7 @@ module TrophyApiClient
|
|
|
76
76
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
77
77
|
# api_key: "YOUR_API_KEY"
|
|
78
78
|
# )
|
|
79
|
-
# api.achievements.complete(key: "finish-onboarding", user: { email: "user@example.com",
|
|
79
|
+
# api.achievements.complete(key: "finish-onboarding", user: { email: "user@example.com", tz: "Europe/London", id: "user-id" })
|
|
80
80
|
def complete(key:, user:, request_options: nil)
|
|
81
81
|
response = @request_client.conn.post do |req|
|
|
82
82
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -167,7 +167,7 @@ module TrophyApiClient
|
|
|
167
167
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
168
168
|
# api_key: "YOUR_API_KEY"
|
|
169
169
|
# )
|
|
170
|
-
# api.achievements.complete(key: "finish-onboarding", user: { email: "user@example.com",
|
|
170
|
+
# api.achievements.complete(key: "finish-onboarding", user: { email: "user@example.com", tz: "Europe/London", id: "user-id" })
|
|
171
171
|
def complete(key:, user:, request_options: nil)
|
|
172
172
|
Async do
|
|
173
173
|
response = @request_client.conn.post do |req|
|
|
@@ -56,14 +56,15 @@ module TrophyApiClient
|
|
|
56
56
|
#
|
|
57
57
|
# @param key [String] Unique key of the leaderboard as set when created.
|
|
58
58
|
# @param offset [Integer] Number of rankings to skip for pagination.
|
|
59
|
-
# @param limit [Integer] Maximum number of rankings to return.
|
|
59
|
+
# @param limit [Integer] Maximum number of rankings to return. Cannot be greater than the size of the
|
|
60
|
+
# leaderboard.
|
|
60
61
|
# @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
|
|
61
62
|
# run.
|
|
62
63
|
# @param user_id [String] When provided, offset is relative to this user's position on the leaderboard. If
|
|
63
64
|
# the user is not found in the leaderboard, returns empty rankings array.
|
|
64
|
-
# @param user_attributes [String] Attribute key and value to filter the rankings by, separated by a colon.
|
|
65
|
-
# parameter is required, and only valid for
|
|
66
|
-
# attribute.
|
|
65
|
+
# @param user_attributes [String] Attribute key and value to filter the rankings by, separated by a colon. For
|
|
66
|
+
# example, `city:London`. This parameter is required, and only valid for
|
|
67
|
+
# leaderboards with a breakdown attribute.
|
|
67
68
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
68
69
|
# @return [TrophyApiClient::LeaderboardResponseWithRankings]
|
|
69
70
|
# @example
|
|
@@ -157,14 +158,15 @@ module TrophyApiClient
|
|
|
157
158
|
#
|
|
158
159
|
# @param key [String] Unique key of the leaderboard as set when created.
|
|
159
160
|
# @param offset [Integer] Number of rankings to skip for pagination.
|
|
160
|
-
# @param limit [Integer] Maximum number of rankings to return.
|
|
161
|
+
# @param limit [Integer] Maximum number of rankings to return. Cannot be greater than the size of the
|
|
162
|
+
# leaderboard.
|
|
161
163
|
# @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
|
|
162
164
|
# run.
|
|
163
165
|
# @param user_id [String] When provided, offset is relative to this user's position on the leaderboard. If
|
|
164
166
|
# the user is not found in the leaderboard, returns empty rankings array.
|
|
165
|
-
# @param user_attributes [String] Attribute key and value to filter the rankings by, separated by a colon.
|
|
166
|
-
# parameter is required, and only valid for
|
|
167
|
-
# attribute.
|
|
167
|
+
# @param user_attributes [String] Attribute key and value to filter the rankings by, separated by a colon. For
|
|
168
|
+
# example, `city:London`. This parameter is required, and only valid for
|
|
169
|
+
# leaderboards with a breakdown attribute.
|
|
168
170
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
169
171
|
# @return [TrophyApiClient::LeaderboardResponseWithRankings]
|
|
170
172
|
# @example
|
|
@@ -42,7 +42,7 @@ module TrophyApiClient
|
|
|
42
42
|
# api.metrics.event(
|
|
43
43
|
# idempotency_key: "e4296e4b-8493-4bd1-9c30-5a1a9ac4d78f",
|
|
44
44
|
# key: "words-written",
|
|
45
|
-
# user: { email: "user@example.com",
|
|
45
|
+
# user: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" }, id: "18" },
|
|
46
46
|
# value: 750,
|
|
47
47
|
# attributes: { "category": "writing", "source": "mobile-app" }
|
|
48
48
|
# )
|
|
@@ -107,7 +107,7 @@ module TrophyApiClient
|
|
|
107
107
|
# api.metrics.event(
|
|
108
108
|
# idempotency_key: "e4296e4b-8493-4bd1-9c30-5a1a9ac4d78f",
|
|
109
109
|
# key: "words-written",
|
|
110
|
-
# user: { email: "user@example.com",
|
|
110
|
+
# user: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" }, id: "18" },
|
|
111
111
|
# value: 750,
|
|
112
112
|
# attributes: { "category": "writing", "source": "mobile-app" }
|
|
113
113
|
# )
|
|
@@ -17,9 +17,11 @@ module TrophyApiClient
|
|
|
17
17
|
attr_reader :achievements
|
|
18
18
|
# @return [TrophyApiClient::MetricEventStreakResponse] The user's current streak.
|
|
19
19
|
attr_reader :current_streak
|
|
20
|
-
# @return [Hash{String => TrophyApiClient::MetricEventPointsResponse}] A map of points systems by key.
|
|
20
|
+
# @return [Hash{String => TrophyApiClient::MetricEventPointsResponse}] A map of points systems by key. Only contains points systems that were affected
|
|
21
|
+
# by the event.
|
|
21
22
|
attr_reader :points
|
|
22
|
-
# @return [Hash{String => TrophyApiClient::MetricEventLeaderboardResponse}] A map of leaderboards by key.
|
|
23
|
+
# @return [Hash{String => TrophyApiClient::MetricEventLeaderboardResponse}] A map of leaderboards by key. Only contains leaderboards that were affected by
|
|
24
|
+
# the event.
|
|
23
25
|
attr_reader :leaderboards
|
|
24
26
|
# @return [String] The idempotency key used for the event, if one was provided.
|
|
25
27
|
attr_reader :idempotency_key
|
|
@@ -38,8 +40,10 @@ module TrophyApiClient
|
|
|
38
40
|
# @param total [Float] The user's new total progress against the metric.
|
|
39
41
|
# @param achievements [Array<TrophyApiClient::CompletedAchievementResponse>] Achievements completed as a result of this event.
|
|
40
42
|
# @param current_streak [TrophyApiClient::MetricEventStreakResponse] The user's current streak.
|
|
41
|
-
# @param points [Hash{String => TrophyApiClient::MetricEventPointsResponse}] A map of points systems by key.
|
|
42
|
-
#
|
|
43
|
+
# @param points [Hash{String => TrophyApiClient::MetricEventPointsResponse}] A map of points systems by key. Only contains points systems that were affected
|
|
44
|
+
# by the event.
|
|
45
|
+
# @param leaderboards [Hash{String => TrophyApiClient::MetricEventLeaderboardResponse}] A map of leaderboards by key. Only contains leaderboards that were affected by
|
|
46
|
+
# the event.
|
|
43
47
|
# @param idempotency_key [String] The idempotency key used for the event, if one was provided.
|
|
44
48
|
# @param idempotent_replayed [Boolean] Whether the event was replayed due to idempotency.
|
|
45
49
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
@@ -38,14 +38,14 @@ module TrophyApiClient
|
|
|
38
38
|
# up in the Trophy dashboard.
|
|
39
39
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
40
40
|
# @return [TrophyApiClient::UpdatedUser]
|
|
41
|
-
def initialize(email
|
|
41
|
+
def initialize(email: OMIT, name: OMIT, tz: OMIT, device_tokens: OMIT, subscribe_to_emails: OMIT, attributes: OMIT,
|
|
42
42
|
additional_properties: nil)
|
|
43
|
-
@email = email
|
|
44
|
-
@name = name
|
|
43
|
+
@email = email if email != OMIT
|
|
44
|
+
@name = name if name != OMIT
|
|
45
45
|
@tz = tz if tz != OMIT
|
|
46
|
-
@device_tokens = device_tokens
|
|
47
|
-
@subscribe_to_emails = subscribe_to_emails
|
|
48
|
-
@attributes = attributes
|
|
46
|
+
@device_tokens = device_tokens if device_tokens != OMIT
|
|
47
|
+
@subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
|
|
48
|
+
@attributes = attributes if attributes != OMIT
|
|
49
49
|
@additional_properties = additional_properties
|
|
50
50
|
@_field_set = {
|
|
51
51
|
"email": email,
|
|
@@ -97,12 +97,12 @@ module TrophyApiClient
|
|
|
97
97
|
# @param obj [Object]
|
|
98
98
|
# @return [Void]
|
|
99
99
|
def self.validate_raw(obj:)
|
|
100
|
-
obj.email
|
|
101
|
-
obj.name
|
|
100
|
+
obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
|
|
101
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
102
102
|
obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
|
|
103
|
-
obj.device_tokens
|
|
104
|
-
obj.subscribe_to_emails
|
|
105
|
-
obj.attributes
|
|
103
|
+
obj.device_tokens&.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
|
|
104
|
+
obj.subscribe_to_emails&.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
|
|
105
|
+
obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
end
|
|
@@ -41,15 +41,15 @@ module TrophyApiClient
|
|
|
41
41
|
# up in the Trophy dashboard.
|
|
42
42
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
43
43
|
# @return [TrophyApiClient::UpsertedUser]
|
|
44
|
-
def initialize(id:, email
|
|
45
|
-
additional_properties: nil)
|
|
44
|
+
def initialize(id:, email: OMIT, name: OMIT, tz: OMIT, device_tokens: OMIT, subscribe_to_emails: OMIT,
|
|
45
|
+
attributes: OMIT, additional_properties: nil)
|
|
46
46
|
@id = id
|
|
47
|
-
@email = email
|
|
48
|
-
@name = name
|
|
47
|
+
@email = email if email != OMIT
|
|
48
|
+
@name = name if name != OMIT
|
|
49
49
|
@tz = tz if tz != OMIT
|
|
50
|
-
@device_tokens = device_tokens
|
|
51
|
-
@subscribe_to_emails = subscribe_to_emails
|
|
52
|
-
@attributes = attributes
|
|
50
|
+
@device_tokens = device_tokens if device_tokens != OMIT
|
|
51
|
+
@subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
|
|
52
|
+
@attributes = attributes if attributes != OMIT
|
|
53
53
|
@additional_properties = additional_properties
|
|
54
54
|
@_field_set = {
|
|
55
55
|
"id": id,
|
|
@@ -105,12 +105,12 @@ module TrophyApiClient
|
|
|
105
105
|
# @return [Void]
|
|
106
106
|
def self.validate_raw(obj:)
|
|
107
107
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
108
|
-
obj.email
|
|
109
|
-
obj.name
|
|
108
|
+
obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
|
|
109
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
110
110
|
obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
|
|
111
|
-
obj.device_tokens
|
|
112
|
-
obj.subscribe_to_emails
|
|
113
|
-
obj.attributes
|
|
111
|
+
obj.device_tokens&.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
|
|
112
|
+
obj.subscribe_to_emails&.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
|
|
113
|
+
obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
116
|
end
|
|
@@ -7,29 +7,28 @@ require "json"
|
|
|
7
7
|
module TrophyApiClient
|
|
8
8
|
# A user of your application.
|
|
9
9
|
class User
|
|
10
|
-
# @return [Boolean] Whether the user is in the control group, meaning they do not receive emails or
|
|
11
|
-
# other communications from Trophy.
|
|
12
|
-
attr_reader :control
|
|
13
|
-
# @return [DateTime] The date and time the user was created, in ISO 8601 format.
|
|
14
|
-
attr_reader :created
|
|
15
|
-
# @return [DateTime] The date and time the user was last updated, in ISO 8601 format.
|
|
16
|
-
attr_reader :updated
|
|
17
10
|
# @return [String] The ID of the user in your database. Must be a string.
|
|
18
11
|
attr_reader :id
|
|
19
|
-
# @return [String] The user's email address.
|
|
12
|
+
# @return [String] The user's email address.
|
|
20
13
|
attr_reader :email
|
|
21
|
-
# @return [String] The name
|
|
14
|
+
# @return [String] The name of the user.
|
|
22
15
|
attr_reader :name
|
|
23
|
-
# @return [String] The user's timezone
|
|
16
|
+
# @return [String] The user's timezone.
|
|
24
17
|
attr_reader :tz
|
|
25
|
-
# @return [Array<String>] The user's device tokens
|
|
18
|
+
# @return [Array<String>] The user's device tokens.
|
|
26
19
|
attr_reader :device_tokens
|
|
27
|
-
# @return [Boolean] Whether the user
|
|
28
|
-
# store the user's email address.
|
|
20
|
+
# @return [Boolean] Whether the user is opted into receiving Trophy-powered emails.
|
|
29
21
|
attr_reader :subscribe_to_emails
|
|
30
22
|
# @return [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
|
|
31
23
|
# up in the Trophy dashboard.
|
|
32
24
|
attr_reader :attributes
|
|
25
|
+
# @return [Boolean] Whether the user is in the control group, meaning they do not receive emails or
|
|
26
|
+
# other communications from Trophy.
|
|
27
|
+
attr_reader :control
|
|
28
|
+
# @return [DateTime] The date and time the user was created, in ISO 8601 format.
|
|
29
|
+
attr_reader :created
|
|
30
|
+
# @return [DateTime] The date and time the user was last updated, in ISO 8601 format.
|
|
31
|
+
attr_reader :updated
|
|
33
32
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
34
33
|
attr_reader :additional_properties
|
|
35
34
|
# @return [Object]
|
|
@@ -38,45 +37,44 @@ module TrophyApiClient
|
|
|
38
37
|
|
|
39
38
|
OMIT = Object.new
|
|
40
39
|
|
|
40
|
+
# @param id [String] The ID of the user in your database. Must be a string.
|
|
41
|
+
# @param email [String] The user's email address.
|
|
42
|
+
# @param name [String] The name of the user.
|
|
43
|
+
# @param tz [String] The user's timezone.
|
|
44
|
+
# @param device_tokens [Array<String>] The user's device tokens.
|
|
45
|
+
# @param subscribe_to_emails [Boolean] Whether the user is opted into receiving Trophy-powered emails.
|
|
46
|
+
# @param attributes [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
|
|
47
|
+
# up in the Trophy dashboard.
|
|
41
48
|
# @param control [Boolean] Whether the user is in the control group, meaning they do not receive emails or
|
|
42
49
|
# other communications from Trophy.
|
|
43
50
|
# @param created [DateTime] The date and time the user was created, in ISO 8601 format.
|
|
44
51
|
# @param updated [DateTime] The date and time the user was last updated, in ISO 8601 format.
|
|
45
|
-
# @param id [String] The ID of the user in your database. Must be a string.
|
|
46
|
-
# @param email [String] The user's email address. Required if subscribeToEmails is true.
|
|
47
|
-
# @param name [String] The name to refer to the user by in emails.
|
|
48
|
-
# @param tz [String] The user's timezone (used for email scheduling).
|
|
49
|
-
# @param device_tokens [Array<String>] The user's device tokens, used for push notifications.
|
|
50
|
-
# @param subscribe_to_emails [Boolean] Whether the user should receive Trophy-powered emails. If false, Trophy will not
|
|
51
|
-
# store the user's email address.
|
|
52
|
-
# @param attributes [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
|
|
53
|
-
# up in the Trophy dashboard.
|
|
54
52
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
55
53
|
# @return [TrophyApiClient::User]
|
|
56
|
-
def initialize(
|
|
57
|
-
tz: OMIT, additional_properties: nil)
|
|
58
|
-
@control = control
|
|
59
|
-
@created = created
|
|
60
|
-
@updated = updated
|
|
54
|
+
def initialize(id:, device_tokens:, subscribe_to_emails:, attributes:, control:, created:, updated:, email: OMIT,
|
|
55
|
+
name: OMIT, tz: OMIT, additional_properties: nil)
|
|
61
56
|
@id = id
|
|
62
|
-
@email = email
|
|
63
|
-
@name = name
|
|
57
|
+
@email = email if email != OMIT
|
|
58
|
+
@name = name if name != OMIT
|
|
64
59
|
@tz = tz if tz != OMIT
|
|
65
60
|
@device_tokens = device_tokens
|
|
66
61
|
@subscribe_to_emails = subscribe_to_emails
|
|
67
62
|
@attributes = attributes
|
|
63
|
+
@control = control
|
|
64
|
+
@created = created
|
|
65
|
+
@updated = updated
|
|
68
66
|
@additional_properties = additional_properties
|
|
69
67
|
@_field_set = {
|
|
70
|
-
"control": control,
|
|
71
|
-
"created": created,
|
|
72
|
-
"updated": updated,
|
|
73
68
|
"id": id,
|
|
74
69
|
"email": email,
|
|
75
70
|
"name": name,
|
|
76
71
|
"tz": tz,
|
|
77
72
|
"deviceTokens": device_tokens,
|
|
78
73
|
"subscribeToEmails": subscribe_to_emails,
|
|
79
|
-
"attributes": attributes
|
|
74
|
+
"attributes": attributes,
|
|
75
|
+
"control": control,
|
|
76
|
+
"created": created,
|
|
77
|
+
"updated": updated
|
|
80
78
|
}.reject do |_k, v|
|
|
81
79
|
v == OMIT
|
|
82
80
|
end
|
|
@@ -89,9 +87,6 @@ module TrophyApiClient
|
|
|
89
87
|
def self.from_json(json_object:)
|
|
90
88
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
91
89
|
parsed_json = JSON.parse(json_object)
|
|
92
|
-
control = parsed_json["control"]
|
|
93
|
-
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
|
94
|
-
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
|
95
90
|
id = parsed_json["id"]
|
|
96
91
|
email = parsed_json["email"]
|
|
97
92
|
name = parsed_json["name"]
|
|
@@ -99,10 +94,10 @@ module TrophyApiClient
|
|
|
99
94
|
device_tokens = parsed_json["deviceTokens"]
|
|
100
95
|
subscribe_to_emails = parsed_json["subscribeToEmails"]
|
|
101
96
|
attributes = parsed_json["attributes"]
|
|
97
|
+
control = parsed_json["control"]
|
|
98
|
+
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
|
99
|
+
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
|
102
100
|
new(
|
|
103
|
-
control: control,
|
|
104
|
-
created: created,
|
|
105
|
-
updated: updated,
|
|
106
101
|
id: id,
|
|
107
102
|
email: email,
|
|
108
103
|
name: name,
|
|
@@ -110,6 +105,9 @@ module TrophyApiClient
|
|
|
110
105
|
device_tokens: device_tokens,
|
|
111
106
|
subscribe_to_emails: subscribe_to_emails,
|
|
112
107
|
attributes: attributes,
|
|
108
|
+
control: control,
|
|
109
|
+
created: created,
|
|
110
|
+
updated: updated,
|
|
113
111
|
additional_properties: struct
|
|
114
112
|
)
|
|
115
113
|
end
|
|
@@ -128,16 +126,16 @@ module TrophyApiClient
|
|
|
128
126
|
# @param obj [Object]
|
|
129
127
|
# @return [Void]
|
|
130
128
|
def self.validate_raw(obj:)
|
|
131
|
-
obj.control.is_a?(Boolean) != false || raise("Passed value for field obj.control is not the expected type, validation failed.")
|
|
132
|
-
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
|
133
|
-
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
|
134
129
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
135
|
-
obj.email
|
|
136
|
-
obj.name
|
|
130
|
+
obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
|
|
131
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
137
132
|
obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
|
|
138
133
|
obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
|
|
139
134
|
obj.subscribe_to_emails.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
|
|
140
135
|
obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
|
|
136
|
+
obj.control.is_a?(Boolean) != false || raise("Passed value for field obj.control is not the expected type, validation failed.")
|
|
137
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
|
138
|
+
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
|
141
139
|
end
|
|
142
140
|
end
|
|
143
141
|
end
|
|
@@ -45,7 +45,7 @@ module TrophyApiClient
|
|
|
45
45
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
46
46
|
# api_key: "YOUR_API_KEY"
|
|
47
47
|
# )
|
|
48
|
-
# api.users.create(request: {
|
|
48
|
+
# api.users.create(request: { id: "user-id" })
|
|
49
49
|
def create(request:, request_options: nil)
|
|
50
50
|
response = @request_client.conn.post do |req|
|
|
51
51
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -114,7 +114,7 @@ module TrophyApiClient
|
|
|
114
114
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
115
115
|
# api_key: "YOUR_API_KEY"
|
|
116
116
|
# )
|
|
117
|
-
# api.users.identify(id: "id", request: { email: "user@example.com",
|
|
117
|
+
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
|
118
118
|
def identify(id:, request:, request_options: nil)
|
|
119
119
|
response = @request_client.conn.put do |req|
|
|
120
120
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -151,7 +151,7 @@ module TrophyApiClient
|
|
|
151
151
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
152
152
|
# api_key: "YOUR_API_KEY"
|
|
153
153
|
# )
|
|
154
|
-
# api.users.update(id: "id", request: { email: "user@example.com",
|
|
154
|
+
# api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
|
155
155
|
def update(id:, request:, request_options: nil)
|
|
156
156
|
response = @request_client.conn.patch do |req|
|
|
157
157
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -525,7 +525,7 @@ module TrophyApiClient
|
|
|
525
525
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
526
526
|
# api_key: "YOUR_API_KEY"
|
|
527
527
|
# )
|
|
528
|
-
# api.users.create(request: {
|
|
528
|
+
# api.users.create(request: { id: "user-id" })
|
|
529
529
|
def create(request:, request_options: nil)
|
|
530
530
|
Async do
|
|
531
531
|
response = @request_client.conn.post do |req|
|
|
@@ -598,7 +598,7 @@ module TrophyApiClient
|
|
|
598
598
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
599
599
|
# api_key: "YOUR_API_KEY"
|
|
600
600
|
# )
|
|
601
|
-
# api.users.identify(id: "id", request: { email: "user@example.com",
|
|
601
|
+
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
|
602
602
|
def identify(id:, request:, request_options: nil)
|
|
603
603
|
Async do
|
|
604
604
|
response = @request_client.conn.put do |req|
|
|
@@ -637,7 +637,7 @@ module TrophyApiClient
|
|
|
637
637
|
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
638
638
|
# api_key: "YOUR_API_KEY"
|
|
639
639
|
# )
|
|
640
|
-
# api.users.update(id: "id", request: { email: "user@example.com",
|
|
640
|
+
# api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
|
641
641
|
def update(id:, request:, request_options: nil)
|
|
642
642
|
Async do
|
|
643
643
|
response = @request_client.conn.patch do |req|
|