trophy_api_client 1.0.12 → 1.0.13

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: 1552058b8e26bb11794e4add9f690522878779c123c84343f0a5091954596202
4
- data.tar.gz: fe75b53fd1ddf0dc6f1479ca75060ac6d36665a07380fd7cb6575269cb0f9d74
3
+ metadata.gz: ae270f201bb634d2b667a263aaec23c186e6f50d1f03cfbf4cf5a6cda57fab4a
4
+ data.tar.gz: eb947bbd65c3241cd686c6c9e7840e3e1607b2895a428ff2687bfc60b66d2718
5
5
  SHA512:
6
- metadata.gz: c911e99071d6e1b6bcb4d30e9fd72d1a2385f0731137d96eb00fd357d64f93374b4fd77a5942f2c97cb23f2d7e12777ac0b30e422919861fcbbaa31d25d7e7a3
7
- data.tar.gz: b96e3770f2d53ae133fcb651656db80a7a6b9e099255ccd1db064aec5dd862979a99c0ab83fea0d0aca8bfa64361ce2ca5e389f0d6922752223fac3fb1ef4054
6
+ metadata.gz: 94d63223fd90452a552ea85ef1422fdb0405c8cbb5919b0ff7b07fdc678a56045884c6e977af2c804c3587c1a5abd67e4c6ef7754de96869e1fd1646d626e8fc
7
+ data.tar.gz: 82959fe745e88392886c27581412814789a71a25a3d23696b8c89a5a1d089387ca6ebc50c0daafe3279a1be1d10391b3db9152faac929655141184aa20ec6254
data/lib/gemconfig.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  module Gemconfig
5
- VERSION = "1.0.12"
5
+ VERSION = "1.0.13"
6
6
  AUTHORS = ["Trophy Labs, Inc"].freeze
7
7
  EMAIL = ""
8
8
  SUMMARY = "Ruby library for the Trophy API."
@@ -93,6 +93,41 @@ module TrophyApiClient
93
93
  TrophyApiClient::User.from_json(json_object: response.body)
94
94
  end
95
95
 
96
+ # Upsert a user (create or update).
97
+ #
98
+ # @param id [String] ID of the user to upsert.
99
+ # @param request [Hash] The user object.Request of type TrophyApiClient::UpdatedUser, as a Hash
100
+ # * :email (String)
101
+ # * :name (String)
102
+ # * :tz (String)
103
+ # * :subscribe_to_emails (Boolean)
104
+ # @param request_options [TrophyApiClient::RequestOptions]
105
+ # @return [TrophyApiClient::User]
106
+ # @example
107
+ # api = TrophyApiClient::Client.new(
108
+ # base_url: "https://api.example.com",
109
+ # environment: TrophyApiClient::Environment::DEFAULT,
110
+ # api_key: "YOUR_API_KEY"
111
+ # )
112
+ # api.users.upsert(id: "id", request: { email: "user@example.com", tz: "Europe/London" })
113
+ def upsert(id:, request:, request_options: nil)
114
+ response = @request_client.conn.put do |req|
115
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
116
+ req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
117
+ req.headers = {
118
+ **(req.headers || {}),
119
+ **@request_client.get_headers,
120
+ **(request_options&.additional_headers || {})
121
+ }.compact
122
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
123
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
124
+ end
125
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
126
+ req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}"
127
+ end
128
+ TrophyApiClient::User.from_json(json_object: response.body)
129
+ end
130
+
96
131
  # Update a user.
97
132
  #
98
133
  # @param id [String] ID of the user to update.
@@ -481,6 +516,43 @@ module TrophyApiClient
481
516
  end
482
517
  end
483
518
 
519
+ # Upsert a user (create or update).
520
+ #
521
+ # @param id [String] ID of the user to upsert.
522
+ # @param request [Hash] The user object.Request of type TrophyApiClient::UpdatedUser, as a Hash
523
+ # * :email (String)
524
+ # * :name (String)
525
+ # * :tz (String)
526
+ # * :subscribe_to_emails (Boolean)
527
+ # @param request_options [TrophyApiClient::RequestOptions]
528
+ # @return [TrophyApiClient::User]
529
+ # @example
530
+ # api = TrophyApiClient::Client.new(
531
+ # base_url: "https://api.example.com",
532
+ # environment: TrophyApiClient::Environment::DEFAULT,
533
+ # api_key: "YOUR_API_KEY"
534
+ # )
535
+ # api.users.upsert(id: "id", request: { email: "user@example.com", tz: "Europe/London" })
536
+ def upsert(id:, request:, request_options: nil)
537
+ Async do
538
+ response = @request_client.conn.put do |req|
539
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
540
+ req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
541
+ req.headers = {
542
+ **(req.headers || {}),
543
+ **@request_client.get_headers,
544
+ **(request_options&.additional_headers || {})
545
+ }.compact
546
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
547
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
548
+ end
549
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
550
+ req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}"
551
+ end
552
+ TrophyApiClient::User.from_json(json_object: response.body)
553
+ end
554
+ end
555
+
484
556
  # Update a user.
485
557
  #
486
558
  # @param id [String] ID of the user to update.
@@ -1,3 +1,3 @@
1
1
  module MyGem
2
- VERSION = "1.0.12"
2
+ VERSION = "1.0.13"
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.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trophy Labs, Inc
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.6.7
159
+ rubygems_version: 3.6.9
160
160
  specification_version: 4
161
161
  summary: Ruby library for the Trophy API.
162
162
  test_files: []