@@ -21,12 +21,17 @@ class RequestClient
2121 # @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
2222 # @param timeout_in_seconds [Long]
2323 # @param api_key [String]
24+ # @param tenant_id [String] The tenant identifier for multi-tenant organisations. Required when the
25+ # organisation has multi-tenancy enabled. The value should be your internal ID for
26+ # the tenant. Ignored for single-tenant organisations.
2427 # @return [TrophyApiClient::RequestClient]
2528 def initialize ( api_key :, base_url : nil , environment : TrophyApiClient ::Environment ::PRODUCTION , max_retries : nil ,
26- timeout_in_seconds : nil )
29+ timeout_in_seconds : nil , tenant_id : nil )
2730 @default_environment = environment
2831 @api_key = api_key
29- @conn = Faraday . new do |faraday |
32+ @headers = { }
33+ @headers [ "Tenant-ID" ] = tenant_id unless tenant_id . nil?
34+ @conn = Faraday . new ( headers : @headers ) do |faraday |
3035 faraday . request :json
3136 faraday . response :raise_error , include_request : true
3237 faraday . request :retry , { max : max_retries } unless max_retries . nil?
@@ -64,12 +69,17 @@ class AsyncRequestClient
6469 # @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
6570 # @param timeout_in_seconds [Long]
6671 # @param api_key [String]
72+ # @param tenant_id [String] The tenant identifier for multi-tenant organisations. Required when the
73+ # organisation has multi-tenancy enabled. The value should be your internal ID for
74+ # the tenant. Ignored for single-tenant organisations.
6775 # @return [TrophyApiClient::AsyncRequestClient]
6876 def initialize ( api_key :, base_url : nil , environment : TrophyApiClient ::Environment ::PRODUCTION , max_retries : nil ,
69- timeout_in_seconds : nil )
77+ timeout_in_seconds : nil , tenant_id : nil )
7078 @default_environment = environment
7179 @api_key = api_key
72- @conn = Faraday . new do |faraday |
80+ @headers = { }
81+ @headers [ "Tenant-ID" ] = tenant_id unless tenant_id . nil?
82+ @conn = Faraday . new ( headers : @headers ) do |faraday |
7383 faraday . request :json
7484 faraday . response :raise_error , include_request : true
7585 faraday . adapter :async_http
@@ -100,6 +110,10 @@ class RequestOptions
100110 attr_reader :base_url
101111 # @return [String]
102112 attr_reader :api_key
113+ # @return [String] The tenant identifier for multi-tenant organisations. Required when the
114+ # organisation has multi-tenancy enabled. The value should be your internal ID for
115+ # the tenant. Ignored for single-tenant organisations.
116+ attr_reader :tenant_id
103117 # @return [Hash{String => Object}]
104118 attr_reader :additional_headers
105119 # @return [Hash{String => Object}]
@@ -111,15 +125,19 @@ class RequestOptions
111125
112126 # @param base_url [String]
113127 # @param api_key [String]
128+ # @param tenant_id [String] The tenant identifier for multi-tenant organisations. Required when the
129+ # organisation has multi-tenancy enabled. The value should be your internal ID for
130+ # the tenant. Ignored for single-tenant organisations.
114131 # @param additional_headers [Hash{String => Object}]
115132 # @param additional_query_parameters [Hash{String => Object}]
116133 # @param additional_body_parameters [Hash{String => Object}]
117134 # @param timeout_in_seconds [Long]
118135 # @return [TrophyApiClient::RequestOptions]
119- def initialize ( base_url : nil , api_key : nil , additional_headers : nil , additional_query_parameters : nil ,
120- additional_body_parameters : nil , timeout_in_seconds : nil )
136+ def initialize ( base_url : nil , api_key : nil , tenant_id : nil , additional_headers : nil ,
137+ additional_query_parameters : nil , additional_body_parameters : nil , timeout_in_seconds : nil )
121138 @base_url = base_url
122139 @api_key = api_key
140+ @tenant_id = tenant_id
123141 @additional_headers = additional_headers
124142 @additional_query_parameters = additional_query_parameters
125143 @additional_body_parameters = additional_body_parameters
@@ -134,6 +152,10 @@ class IdempotencyRequestOptions
134152 attr_reader :base_url
135153 # @return [String]
136154 attr_reader :api_key
155+ # @return [String] The tenant identifier for multi-tenant organisations. Required when the
156+ # organisation has multi-tenancy enabled. The value should be your internal ID for
157+ # the tenant. Ignored for single-tenant organisations.
158+ attr_reader :tenant_id
137159 # @return [Hash{String => Object}]
138160 attr_reader :additional_headers
139161 # @return [Hash{String => Object}]
@@ -145,15 +167,19 @@ class IdempotencyRequestOptions
145167
146168 # @param base_url [String]
147169 # @param api_key [String]
170+ # @param tenant_id [String] The tenant identifier for multi-tenant organisations. Required when the
171+ # organisation has multi-tenancy enabled. The value should be your internal ID for
172+ # the tenant. Ignored for single-tenant organisations.
148173 # @param additional_headers [Hash{String => Object}]
149174 # @param additional_query_parameters [Hash{String => Object}]
150175 # @param additional_body_parameters [Hash{String => Object}]
151176 # @param timeout_in_seconds [Long]
152177 # @return [TrophyApiClient::IdempotencyRequestOptions]
153- def initialize ( base_url : nil , api_key : nil , additional_headers : nil , additional_query_parameters : nil ,
154- additional_body_parameters : nil , timeout_in_seconds : nil )
178+ def initialize ( base_url : nil , api_key : nil , tenant_id : nil , additional_headers : nil ,
179+ additional_query_parameters : nil , additional_body_parameters : nil , timeout_in_seconds : nil )
155180 @base_url = base_url
156181 @api_key = api_key
182+ @tenant_id = tenant_id
157183 @additional_headers = additional_headers
158184 @additional_query_parameters = additional_query_parameters
159185 @additional_body_parameters = additional_body_parameters
0 commit comments