Class: NewDemoApiClient::AsyncDealClient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ NewDemoApiClient::AsyncDealClient

Parameters:



298
299
300
# File 'lib/test_sdk/deal/client.rb', line 298

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientNewDemoApiClient::AsyncRequestClient (readonly)



294
295
296
# File 'lib/test_sdk/deal/client.rb', line 294

def request_client
  @request_client
end

Instance Method Details

#create(group_id:, name:, round_name:, status:, company_id:, notes: nil, priority: nil, round_amount: nil, round_target: nil, tags: nil, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse

Create a new deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.deal.create(
  group_id: 1,
  name: "name",
  round_name: "round_name",
  status: QUEUED,
  company_id: 1
)

Parameters:

  • group_id (Integer)
  • name (String)
  • round_name (String)

    The name of the round

  • status (NewDemoApiClient::Status)

    The status of the deal

  • notes (String) (defaults to: nil)

    Notes about the deal

  • priority (NewDemoApiClient::Priority) (defaults to: nil)

    The priority of the deal

  • round_amount (Integer) (defaults to: nil)

    The dollar amount to be raised of the round

  • round_target (Integer) (defaults to: nil)

    The target post-money dollar amount of the round

  • tags (Array<String>) (defaults to: nil)

    The tags associated with the deal

  • company_id (Integer)
  • request_options (NewDemoApiClient::RequestOptions) (defaults to: nil)

Returns:



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/test_sdk/deal/client.rb', line 329

def create(group_id:, name:, round_name:, status:, company_id:, notes: nil, priority: nil, round_amount: nil, round_target: nil,
           tags: nil, request_options: nil)
  Async do
    response = @request_client.conn.post 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
      unless request_options.nil? || request_options&.additional_query_parameters.nil?
        req.params = { **(request_options&.additional_query_parameters || {}) }.compact
      end
      req.body = {
        **(request_options&.additional_body_parameters || {}),
        name: name,
        round_name: round_name,
        status: status,
        notes: notes,
        priority: priority,
        round_amount: round_amount,
        round_target: round_target,
        tags: tags,
        company_id: company_id
      }.compact
      req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal"
    end
    NewDemoApiClient::DealWithFilesResponse.from_json(json_object: response.body)
  end
end

#delete(deal_id:, group_id:, archive: nil, request_options: nil) ⇒ Hash{String => String}

Delete a deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.deal.delete(deal_id: 1, group_id: 1)

Parameters:

Returns:

  • (Hash{String => String})


563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/test_sdk/deal/client.rb', line 563

def delete(deal_id:, group_id:, archive: nil, request_options: nil)
  Async do
    response = @request_client.conn.delete 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 || {}), "archive": archive }.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/#{deal_id}/deal/#{group_id}"
    end
    parsed_json = JSON.parse(response.body)
    parsed_json
  end
end

#get(group_id:, deal_id:, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse

Retrieve a deal by its ID.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.deal.get(group_id: 1, deal_id: 1)

Parameters:

Returns:



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/test_sdk/deal/client.rb', line 473

def get(group_id:, deal_id:, 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
      unless request_options.nil? || request_options&.additional_query_parameters.nil?
        req.params = { **(request_options&.additional_query_parameters || {}) }.compact
      end
      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}"
    end
    NewDemoApiClient::DealWithFilesResponse.from_json(json_object: response.body)
  end
end

#list(group_id:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse

Get all deals for a group.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.deal.list(group_id: 1)

Parameters:

  • group_id (Integer)
  • sort_by (String) (defaults to: nil)
  • sort_order (String) (defaults to: nil)
  • page (Integer) (defaults to: nil)
  • page_size (Integer) (defaults to: nil)
  • request_options (NewDemoApiClient::RequestOptions) (defaults to: nil)

Returns:



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/test_sdk/deal/client.rb', line 377

def list(group_id:, sort_by: nil, sort_order: nil, page: nil, page_size: 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 || {}),
        "sort_by": sort_by,
        "sort_order": sort_order,
        "page": page,
        "page_size": page_size
      }.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/all"
    end
    NewDemoApiClient::PaginatedResponseDealWithFilesResponse.from_json(json_object: response.body)
  end
end

#search(group_id:, name: nil, round_name: nil, notes: nil, tags: nil, company_name: nil, company_domain: nil, ignore_archived: nil, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse

Search deals within a group.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.deal.search(group_id: 1)

Parameters:

  • group_id (Integer)
  • name (String) (defaults to: nil)
  • round_name (String) (defaults to: nil)
  • notes (String) (defaults to: nil)
  • tags (String) (defaults to: nil)
  • company_name (String) (defaults to: nil)
  • company_domain (String) (defaults to: nil)
  • ignore_archived (Boolean) (defaults to: nil)
  • sort_by (String) (defaults to: nil)
  • sort_order (String) (defaults to: nil)
  • page (Integer) (defaults to: nil)
  • page_size (Integer) (defaults to: nil)
  • request_options (NewDemoApiClient::RequestOptions) (defaults to: nil)

Returns:



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/test_sdk/deal/client.rb', line 426

def search(group_id:, name: nil, round_name: nil, notes: nil, tags: nil, company_name: nil, company_domain: nil,
           ignore_archived: nil, sort_by: nil, sort_order: nil, page: nil, page_size: 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 || {}),
        "name": name,
        "round_name": round_name,
        "notes": notes,
        "tags": tags,
        "company_name": company_name,
        "company_domain": company_domain,
        "ignore_archived": ignore_archived,
        "sort_by": sort_by,
        "sort_order": sort_order,
        "page": page,
        "page_size": page_size
      }.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/search"
    end
    NewDemoApiClient::PaginatedResponseDealWithFilesResponse.from_json(json_object: response.body)
  end
end

#update(group_id:, deal_id:, name: nil, round_name: nil, status: nil, notes: nil, priority: nil, round_amount: nil, round_target: nil, tags: nil, company_id: nil, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse

Update a deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.deal.update(group_id: 1, deal_id: 1)

Parameters:

  • group_id (Integer)
  • deal_id (Integer)
  • name (String) (defaults to: nil)
  • round_name (String) (defaults to: nil)
  • status (NewDemoApiClient::Status) (defaults to: nil)
  • notes (String) (defaults to: nil)

    Notes about the deal

  • priority (NewDemoApiClient::Priority) (defaults to: nil)

    The priority of the deal

  • round_amount (Integer) (defaults to: nil)

    The dollar amount to be raised of the round

  • round_target (Integer) (defaults to: nil)

    The target post-money dollar amount of the round

  • tags (Array<String>) (defaults to: nil)

    The tags associated with the deal

  • company_id (Integer) (defaults to: nil)
  • request_options (NewDemoApiClient::RequestOptions) (defaults to: nil)

Returns:



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/test_sdk/deal/client.rb', line 517

def update(group_id:, deal_id:, name: nil, round_name: nil, status: nil, notes: nil, priority: nil,
           round_amount: nil, round_target: nil, tags: nil, company_id: nil, request_options: nil)
  Async do
    response = @request_client.conn.put 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
      unless request_options.nil? || request_options&.additional_query_parameters.nil?
        req.params = { **(request_options&.additional_query_parameters || {}) }.compact
      end
      req.body = {
        **(request_options&.additional_body_parameters || {}),
        name: name,
        round_name: round_name,
        status: status,
        notes: notes,
        priority: priority,
        round_amount: round_amount,
        round_target: round_target,
        tags: tags,
        company_id: company_id
      }.compact
      req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}"
    end
    NewDemoApiClient::DealWithFilesResponse.from_json(json_object: response.body)
  end
end