Class: Relaton::Ogc::Hit

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

Instance Method Summary collapse

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