Class: WebValve::FakeServiceConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/webvalve/fake_service_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_class_name:, url: nil) ⇒ FakeServiceConfig

Returns a new instance of FakeServiceConfig.



5
6
7
8
# File 'lib/webvalve/fake_service_config.rb', line 5

def initialize(service_class_name:, url: nil)
  @service_class_name = service_class_name
  @custom_service_url = url
end

Instance Attribute Details

#service_class_nameObject (readonly)

Returns the value of attribute service_class_name.



3
4
5
# File 'lib/webvalve/fake_service_config.rb', line 3

def service_class_name
  @service_class_name
end

Instance Method Details

#explicitly_disabled?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/webvalve/fake_service_config.rb', line 14

def explicitly_disabled?
  value_from_env.present? && WebValve::DISABLED_VALUES.include?(value_from_env.to_s)
end

#explicitly_enabled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/webvalve/fake_service_config.rb', line 10

def explicitly_enabled?
  value_from_env.present? && WebValve::ENABLED_VALUES.include?(value_from_env.to_s)
end

#full_urlObject



18
19
20
# File 'lib/webvalve/fake_service_config.rb', line 18

def full_url
  @full_url ||= custom_service_url || default_service_url
end

#path_prefixObject



29
30
31
# File 'lib/webvalve/fake_service_config.rb', line 29

def path_prefix
  @path_prefix ||= URI::parse(service_url).path
end

#service_urlObject



22
23
24
25
26
27
# File 'lib/webvalve/fake_service_config.rb', line 22

def service_url
  @service_url ||= begin
    raise missing_url_message if full_url.blank?
    strip_basic_auth full_url
  end
end