Class: PullReview::Coverage::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/pullreview/coverage/config.rb

Overview

PullReview api coverage settings, allow overwriting via ENV for dev/testing

Instance Method Summary collapse

Instance Method Details

#api_hostObject



6
7
8
# File 'lib/pullreview/coverage/config.rb', line 6

def api_host
  ENV['PULLREVIEW_HOST'] || 'www.pullreview.com'
end

#api_https_cacertObject



30
31
32
# File 'lib/pullreview/coverage/config.rb', line 30

def api_https_cacert
  File.expand_path('../../../../config/cacert.pem', __FILE__)
end

#api_open_timeout_in_secondsObject



26
27
28
# File 'lib/pullreview/coverage/config.rb', line 26

def api_open_timeout_in_seconds
  ENV['PULLREVIEW_OPEN_TIMEOUT_S'] || 5
end

#api_portObject



14
15
16
# File 'lib/pullreview/coverage/config.rb', line 14

def api_port
  ENV['PULLREVIEW_PORT'] || '443'
end

#api_protocolObject



10
11
12
# File 'lib/pullreview/coverage/config.rb', line 10

def api_protocol
  ENV['PULLREVIEW_PROTOCOL'] || 'https'
end

#api_read_timeout_in_secondsObject



22
23
24
# File 'lib/pullreview/coverage/config.rb', line 22

def api_read_timeout_in_seconds
  ENV['PULLREVIEW_READ_TIMEOUT_S'] || 5
end

#api_to_file?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/pullreview/coverage/config.rb', line 18

def api_to_file?
  !!ENV['PULLREVIEW_COVERAGE_TO_FILE']
end

#api_uriObject



50
51
52
# File 'lib/pullreview/coverage/config.rb', line 50

def api_uri
  URI("#{api_protocol}://#{api_host}:#{api_port}/api/coverage")
end

#prefix_filenameObject



42
43
44
# File 'lib/pullreview/coverage/config.rb', line 42

def prefix_filename
  ENV['PULLREVIEW_PREFIX_FILENAME']
end

#repo_tokenObject



38
39
40
# File 'lib/pullreview/coverage/config.rb', line 38

def repo_token
  ENV['PULLREVIEW_REPO_TOKEN']
end

#should_run?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/pullreview/coverage/config.rb', line 46

def should_run?
  !!repo_token
end

#user_agentObject



34
35
36
# File 'lib/pullreview/coverage/config.rb', line 34

def user_agent
  "PullReview::Coverage.#{VERSION}"
end