Class: Geoblacklight::WebServicesComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/geoblacklight/web_services_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(ref:, document:) ⇒ WebServicesComponent

Returns a new instance of WebServicesComponent.



7
8
9
10
11
12
# File 'app/components/geoblacklight/web_services_component.rb', line 7

def initialize(ref:, document:)
  @ref = ref
  @document = document
  @type = ref.type.to_s
  super()
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/components/geoblacklight/web_services_component.rb', line 14

def render?
  Settings.WEBSERVICES_SHOWN.include? @type
end

#render_web_servicesObject



18
19
20
21
22
23
24
# File 'app/components/geoblacklight/web_services_component.rb', line 18

def render_web_services
  component_class_name = "Geoblacklight::WebServices#{@type.camelize}Component"
  component_class = component_class_name.constantize
  render component_class.new(reference: @ref, document: @document)
rescue
  render Geoblacklight::WebServicesDefaultComponent.new(reference: @ref)
end