class Airbrake::RemoteSettings::SettingsData

@api private
@since v5.0.0
settings_data.interval #=> 600
settings_data = SettingsData.new({})
# Create the object and pass initial data (empty hash).
@example
value would be returned instead.
also ensures that in case some data from the payload is missing, a default
remote settings API. It exposes the payload via convenient methods and
SettingsData is a container, which wraps JSON payload returned by the

def apm_host

Returns:
  • (String, nil) - the host, which provides the API endpoint to which
def apm_host
  return unless (s = find_setting(SETTINGS[:apm]))
  s['endpoint']
end

def config_route(remote_config_host)

Returns:
  • (String) - where the config is stored on S3.

Parameters:
  • remote_config_host (String) --
def config_route(remote_config_host)
  if @data['config_route'] && !@data['config_route'].empty?
    return "#{remote_config_host.chomp('/')}/#{@data['config_route']}"
  end
  format(
    CONFIG_ROUTE_PATTERN,
    host: remote_config_host.chomp('/'),
    project_id: @project_id,
  )
end

def error_host

Returns:
  • (String, nil) - the host, which provides the API endpoint to which
def error_host
  return unless (s = find_setting(SETTINGS[:errors]))
  s['endpoint']
end

def error_notifications?

Returns:
  • (Boolean) - whether error notifications are enabled
def error_notifications?
  return true unless (s = find_setting(SETTINGS[:errors]))
  s['enabled']
end

def find_setting(name)

def find_setting(name)
  return unless @data.key?('settings')
  @data['settings'].find { |s| s['name'] == name }
end

def initialize(project_id, data)

Parameters:
  • data (Hash{String=>Object}) --
  • project_id (Integer) --
def initialize(project_id, data)
  @project_id = project_id
  @data = data
end

def interval

Returns:
  • (Integer) - how frequently we should poll for the config
def interval
  return DEFAULT_INTERVAL if !@data.key?('poll_sec') || !@data['poll_sec']
  @data['poll_sec'] > 0 ? @data['poll_sec'] : DEFAULT_INTERVAL
end

def merge!(hash)

Returns:
  • (self) -

Parameters:
  • hash (Hash{String=>Object}) --
def merge!(hash)
  @data.merge!(hash)
  self
end

def performance_stats?

Returns:
  • (Boolean) - whether APM is enabled
def performance_stats?
  return true unless (s = find_setting(SETTINGS[:apm]))
  s['enabled']
end

def to_h

Returns:
  • (Hash{String=>Object}) - raw representation of JSON payload
def to_h
  @data.dup
end