Class: KnapsackPro::Client::API::V1::BuildDistributions

Inherits:
Base
  • Object
show all
Defined in:
lib/knapsack_pro/client/api/v1/build_distributions.rb

Constant Summary collapse

TEST_SUITE_SPLIT_CACHE_MISS_CODE =
'TEST_SUITE_SPLIT_CACHE_MISS'

Class Method Summary collapse

Methods inherited from Base

action_class

Class Method Details

.last(request_hash) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/knapsack_pro/client/api/v1/build_distributions.rb', line 38

def last(request_hash)
  action_class.new(
    endpoint_path: '/v1/build_distributions/last',
    http_method: :get,
    request_hash: request_hash
  )
end

.subset(args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/knapsack_pro/client/api/v1/build_distributions.rb', line 11

def subset(args)
  request_hash = {
    :fixed_test_suite_split => KnapsackPro::Config::Env.fixed_test_suite_split,
    :cache_read_attempt => args.fetch(:cache_read_attempt),
    :commit_hash => args.fetch(:commit_hash),
    :branch => args.fetch(:branch),
    :node_total => args.fetch(:node_total),
    :node_index => args.fetch(:node_index),
    :ci_build_id => KnapsackPro::Config::Env.ci_node_build_id,
    :user_seat => KnapsackPro::Config::Env.masked_user_seat,
    :build_author => KnapsackPro::RepositoryAdapters::GitAdapter.new.build_author,
    :commit_authors => KnapsackPro::RepositoryAdapters::GitAdapter.new.commit_authors,
  }

  unless request_hash[:cache_read_attempt]
    request_hash.merge!({
      :test_files => args.fetch(:test_files)
    })
  end

  action_class.new(
    endpoint_path: '/v1/build_distributions/subset',
    http_method: :post,
    request_hash: request_hash
  )
end