Class: Relaton::Ogc::Hit

Inherits:
Core::Hit show all
Defined in:
lib/relaton/ogc/hit.rb

Instance Attribute Summary

Attributes inherited from Core::Hit

#hit, #hit_collection

Instance Method Summary collapse

Methods inherited from Core::Hit

#fetched?, #initialize, #inspect, #to_s, #to_xml

Constructor Details

This class inherits a constructor from Relaton::Core::Hit

Instance Method Details

#itemRelaton::Ogc::ItemData



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/relaton/ogc/hit.rb', line 5

def item
  @item ||= begin
    url = "#{HitCollection::ENDPOINT}#{hit[:file]}"
    resp = Faraday.get(url) { |req| req.options.timeout = 10 }
    return unless resp.status == 200

    item = Item.from_yaml resp.body
    item.fetched = Date.today.to_s
    item
  end
end