Method: ElsevierCover#handle

Defined in:
app/service_adaptors/elsevier_cover.rb

#handle(request) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/service_adaptors/elsevier_cover.rb', line 18

def handle(request)
  issn = request.referent.issn

  # We need an ISSN
  return request.dispatched(self, true) unless issn 

  # No hyphens please
  issn = issn.gsub(/[^0-9X]/, '')
  
  check_url = @base_url + issn + '.gif'

  # does it exist?
  if ( url_resolves(check_url)   )
     request.add_service_response(:service => self,
                                  :service_type_value => ServiceTypeValue[:cover_image] ,
                                  :url => check_url, 
                                  :size => "medium" )
  end   
  
  return request.dispatched(self, true)
end