Module: Ecfr::DefaultStatusSetup::ClassMethods

Defined in:
lib/ecfr/default_status_setup.rb

Constant Summary collapse

STATUS_PATH =
"status.json"

Instance Method Summary collapse

Instance Method Details

#statusObject



6
7
8
9
10
11
# File 'lib/ecfr/default_status_setup.rb', line 6

def status
  perform(
    status_config[:method],
    STATUS_PATH
  )
end

#status_configObject

.status_config is provided to support use cases in which the user wants to construct their own handling of status checks, e.g. to wrap in custom errors or run in parallel



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ecfr/default_status_setup.rb', line 17

def status_config
  url = [
    base_url,
    service_path,
    STATUS_PATH
  ].reject(&:blank?)
    .join("/")
    .gsub(/(?<!:)\/\//, "/") # remove extraneous double slashes '//'

  {
    url: url,
    method: :get
  }
end