Class: TrophyApiClient::Admin::AsyncStreaksClient
- Inherits:
-
Object
- Object
- TrophyApiClient::Admin::AsyncStreaksClient
- Defined in:
- lib/trophy_api_client/admin/streaks/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #initialize(request_client:) ⇒ TrophyApiClient::Admin::AsyncStreaksClient constructor
-
#restore(users:, request_options: nil) ⇒ TrophyApiClient::RestoreStreaksResponse
Restore streaks for multiple users to the maximum length in the last 90 days (in the case of daily streaks), one year (in the case of weekly streaks), or two years (in the case of monthly streaks).
Constructor Details
#initialize(request_client:) ⇒ TrophyApiClient::Admin::AsyncStreaksClient
60 61 62 |
# File 'lib/trophy_api_client/admin/streaks/client.rb', line 60 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ TrophyApiClient::AsyncRequestClient (readonly)
56 57 58 |
# File 'lib/trophy_api_client/admin/streaks/client.rb', line 56 def request_client @request_client end |
Instance Method Details
#restore(users:, request_options: nil) ⇒ TrophyApiClient::RestoreStreaksResponse
Restore streaks for multiple users to the maximum length in the last 90 days (in
the case of daily streaks), one year (in the case of weekly streaks), or two
years (in the case of monthly streaks).
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/trophy_api_client/admin/streaks/client.rb', line 79 def restore(users:, request_options: nil) Async do response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X-API-KEY"] = .api_key unless &.api_key.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), users: users }.compact req.url "#{@request_client.get_url(environment: admin, request_options: )}/streaks/restore" end TrophyApiClient::RestoreStreaksResponse.from_json(json_object: response.body) end end |