Class: Diffend::Config

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

Overview

Diffend config object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command: nil, severity: nil, build_path: nil) ⇒ Diffend::Config

Build diffend config object



11
12
13
14
15
# File 'lib/diffend/config.rb', line 11

def initialize(command: nil, severity: nil, build_path: nil)
  @log_level = severity
  build(command, build_path)
  validate
end

Instance Attribute Details

#build_pathObject (readonly)

Returns the value of attribute build_path.



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

def build_path
  @build_path
end

#commandObject (readonly)

Returns the value of attribute command.



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

def command
  @command
end

#envObject (readonly)

Returns the value of attribute env.



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

def env
  @env
end

#project_idObject (readonly)

Returns the value of attribute project_id.



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

def project_id
  @project_id
end

#shareable_idObject (readonly)

Returns the value of attribute shareable_id.



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

def shareable_id
  @shareable_id
end

#shareable_keyObject (readonly)

Returns the value of attribute shareable_key.



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

def shareable_key
  @shareable_key
end

Instance Method Details

#commands_urlString

Provides diffend commands endpoint url

Returns:

  • (String)


32
33
34
35
36
# File 'lib/diffend/config.rb', line 32

def commands_url
  return ENV['DIFFEND_COMMANDS_URL'] if ENV.key?('DIFFEND_COMMANDS_URL')

  "https://my.diffend.io/api/projects/#{project_id}/bundle/#{command}"
end

#development?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/diffend/config.rb', line 25

def development?
  @development
end

#errors_urlString

Provides diffend errors endpoint url

Returns:

  • (String)


41
42
43
44
45
# File 'lib/diffend/config.rb', line 41

def errors_url
  return ENV['DIFFEND_ERRORS_URL'] if ENV.key?('DIFFEND_ERRORS_URL')

  "https://my.diffend.io/api/projects/#{project_id}/errors"
end

#ignore_errors?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/diffend/config.rb', line 21

def ignore_errors?
  @ignore_errors
end

#loggerObject



17
18
19
# File 'lib/diffend/config.rb', line 17

def logger
  @logger ||= Diffend::Logger.new(@log_level)
end

#track_url(request_id) ⇒ String

Parameters:

  • request_id (String)

Returns:

  • (String)


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

def track_url(request_id)
  "https://my.diffend.io/api/projects/#{project_id}/bundle/#{request_id}/track"
end