Class: NewDemoApiClient::AsyncProductClient

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/product/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ NewDemoApiClient::AsyncProductClient

Parameters:



219
220
221
# File 'lib/test_sdk/product/client.rb', line 219

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientNewDemoApiClient::AsyncRequestClient (readonly)



215
216
217
# File 'lib/test_sdk/product/client.rb', line 215

def request_client
  @request_client
end

Instance Method Details

#get_cohorts(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::CohortsResponse>

Get the product cohorts for the company associated with the deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.product.get_cohorts(
  group_id: 1,
  deal_id: 1,
  user_type: BUSINESS,
  metric: "metric"
)

Parameters:

Returns:



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/test_sdk/product/client.rb', line 344

def get_cohorts(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "user_type": user_type,
        "metric": metric,
        "freq": freq
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/cohorts"
    end
    parsed_json = JSON.parse(response.body)
    parsed_json&.map do |item|
      item = item.to_json
      NewDemoApiClient::CohortsResponse.from_json(json_object: item)
    end
  end
end

#get_concentration(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ NewDemoApiClient::ConcentrationResponse

Get the product concentration for the company associated with the deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.product.get_concentration(
  group_id: 1,
  deal_id: 1,
  user_type: BUSINESS,
  metric: "metric"
)

Parameters:

Returns:



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/test_sdk/product/client.rb', line 394

def get_concentration(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "user_type": user_type,
        "metric": metric,
        "freq": freq
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/concentration"
    end
    NewDemoApiClient::ConcentrationResponse.from_json(json_object: response.body)
  end
end

#get_growth_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::GrowthAccountingResponse>

Get the product growth accounting for the company associated with the deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.product.get_growth_accounting(
  group_id: 1,
  deal_id: 1,
  user_type: BUSINESS,
  metric: "metric"
)

Parameters:

Returns:



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/test_sdk/product/client.rb', line 294

def get_growth_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "user_type": user_type,
        "metric": metric,
        "freq": freq
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/growth-accounting"
    end
    parsed_json = JSON.parse(response.body)
    parsed_json&.map do |item|
      item = item.to_json
      NewDemoApiClient::GrowthAccountingResponse.from_json(json_object: item)
    end
  end
end

#get_user_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::UserAccountingResponse>

Get the product user accounting for the company associated with the deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.product.get_user_accounting(
  group_id: 1,
  deal_id: 1,
  user_type: BUSINESS,
  metric: "metric"
)

Parameters:

Returns:



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/test_sdk/product/client.rb', line 244

def get_user_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "user_type": user_type,
        "metric": metric,
        "freq": freq
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/user-accounting"
    end
    parsed_json = JSON.parse(response.body)
    parsed_json&.map do |item|
      item = item.to_json
      NewDemoApiClient::UserAccountingResponse.from_json(json_object: item)
    end
  end
end