trophy_api_client 1.0.22 → 1.0.23

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: cab733c24577e49524eb7899160b7c172195e0d2e84b3b6cd11cadb32342ee9a
4
- data.tar.gz: a3999029f59148a4208edf380c131f9c9539c51fd9512e3f7f9fdd5e58270b06
3
+ metadata.gz: 39897ab7658149ab5f3bf2a97e23eb07e0f2a2e2e5efc65e44b3aa70ca4ca36b
4
+ data.tar.gz: c202d22246b40b860ea0e201b8f90df0379fbb2c0330913c89b44d969ddafc3c
5
5
  SHA512:
6
- metadata.gz: dcb1a2eab70038ac53d6d85ef7f8267a17b29dbba682f4fd44d2af7bb7d88243c85d34adf337775b24d494ee7124e8cdf77d3cba64492908eb03293374821d0a
7
- data.tar.gz: c173eacb9c7c5be6cd6cc540c055ecb3f7bfb1c811f20c3f143e838f3a01dd1bd287d2fc920b9e5f2a73547494b6e22b7e28fd6e78339dcdd279acde449c1940
6
+ metadata.gz: b1716545b54c6ba34b2e33306d3ee3a6a2f638597898527c3df0ddeb200bd2a5686801661d41542bd36ebbf4cc005807bdcc81ab8c39f3cfc8de6dfccb423ae5
7
+ data.tar.gz: 5f6a490904fb8842edc52c718c3e1559d5c3d048a920cfa5e0d4255f8dce0d9c83b4d4ae3d199513f25cee5c52e38c101fc62b5887b8a6ce58f713a950b7e4aa
data/lib/gemconfig.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  module Gemconfig
5
- VERSION = "1.0.22"
5
+ VERSION = "1.0.23"
6
6
  AUTHORS = ["Trophy Labs, Inc"].freeze
7
7
  EMAIL = ""
8
8
  SUMMARY = "Ruby library for the Trophy API."
@@ -18,6 +18,7 @@ module TrophyApiClient
18
18
 
19
19
  # Increment or decrement the value of a metric for a user.
20
20
  #
21
+ # @param idempotency_key [String]
21
22
  # @param key [String] Unique reference of the metric as set when created.
22
23
  # @param user [Hash] The user that triggered the event.Request of type TrophyApiClient::UpsertedUser, as a Hash
23
24
  # * :id (String)
@@ -39,19 +40,21 @@ module TrophyApiClient
39
40
  # api_key: "YOUR_API_KEY"
40
41
  # )
41
42
  # api.metrics.event(
43
+ # idempotency_key: "e4296e4b-8493-4bd1-9c30-5a1a9ac4d78f",
42
44
  # key: "words-written",
43
45
  # user: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" }, id: "18" },
44
46
  # value: 750,
45
47
  # attributes: { "category": "writing", "source": "mobile-app" }
46
48
  # )
47
- def event(key:, user:, value:, attributes: nil, request_options: nil)
49
+ def event(key:, user:, value:, idempotency_key: nil, attributes: nil, request_options: nil)
48
50
  response = @request_client.conn.post do |req|
49
51
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
50
52
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
51
53
  req.headers = {
52
- **(req.headers || {}),
53
- **@request_client.get_headers,
54
- **(request_options&.additional_headers || {})
54
+ **(req.headers || {}),
55
+ **@request_client.get_headers,
56
+ **(request_options&.additional_headers || {}),
57
+ "Idempotency-Key": idempotency_key
55
58
  }.compact
56
59
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
57
60
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
@@ -80,6 +83,7 @@ module TrophyApiClient
80
83
 
81
84
  # Increment or decrement the value of a metric for a user.
82
85
  #
86
+ # @param idempotency_key [String]
83
87
  # @param key [String] Unique reference of the metric as set when created.
84
88
  # @param user [Hash] The user that triggered the event.Request of type TrophyApiClient::UpsertedUser, as a Hash
85
89
  # * :id (String)
@@ -101,20 +105,22 @@ module TrophyApiClient
101
105
  # api_key: "YOUR_API_KEY"
102
106
  # )
103
107
  # api.metrics.event(
108
+ # idempotency_key: "e4296e4b-8493-4bd1-9c30-5a1a9ac4d78f",
104
109
  # key: "words-written",
105
110
  # user: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" }, id: "18" },
106
111
  # value: 750,
107
112
  # attributes: { "category": "writing", "source": "mobile-app" }
108
113
  # )
109
- def event(key:, user:, value:, attributes: nil, request_options: nil)
114
+ def event(key:, user:, value:, idempotency_key: nil, attributes: nil, request_options: nil)
110
115
  Async do
111
116
  response = @request_client.conn.post do |req|
112
117
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
113
118
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
114
119
  req.headers = {
115
- **(req.headers || {}),
116
- **@request_client.get_headers,
117
- **(request_options&.additional_headers || {})
120
+ **(req.headers || {}),
121
+ **@request_client.get_headers,
122
+ **(request_options&.additional_headers || {}),
123
+ "Idempotency-Key": idempotency_key
118
124
  }.compact
119
125
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
120
126
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
@@ -1,3 +1,3 @@
1
1
  module MyGem
2
- VERSION = "1.0.22"
2
+ VERSION = "1.0.23"
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.0.22
4
+ version: 1.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trophy Labs, Inc