Class: Relaton::Ccsds::HitCollection
- Inherits:
-
Relaton::Core::HitCollection
- Object
- Relaton::Core::HitCollection
- Relaton::Ccsds::HitCollection
- Defined in:
- lib/relaton/ccsds/hit_collection.rb
Constant Summary collapse
- GHURL =
"https://raw.githubusercontent.com/relaton/relaton-data-ccsds/refs/heads/v2/".freeze
Instance Method Summary collapse
-
#fetch ⇒ <Type>
Search his in index.
- #index ⇒ Object
- #pubid ⇒ Object
- #rows ⇒ Object
Instance Method Details
#fetch ⇒ <Type>
Search his in index.
13 14 15 16 17 18 |
# File 'lib/relaton/ccsds/hit_collection.rb', line 13 def fetch @array = rows.map { |row| Hit.new code: row[:id], url: "#{GHURL}#{row[:file]}" } self rescue SocketError, OpenURI::HTTPError, OpenSSL::SSL::SSLError, Errno::ECONNRESET => e raise Relaton::RequestError, e. end |
#index ⇒ Object
20 21 22 23 24 |
# File 'lib/relaton/ccsds/hit_collection.rb', line 20 def index @index ||= Relaton::Index.find_or_create( :ccsds, url: "#{GHURL}#{INDEXFILE}.zip", file: "#{INDEXFILE}.yaml", pubid_class: Pubid::Ccsds::Identifier ) end |
#pubid ⇒ Object
26 27 28 |
# File 'lib/relaton/ccsds/hit_collection.rb', line 26 def pubid @pubid ||= Pubid::Ccsds::Identifier.parse(ref) end |
#rows ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/relaton/ccsds/hit_collection.rb', line 30 def rows if pubid.edition index.search(pubid) # index.search { |r| Pubid::Ccsds::Identifier.create(**r[:id]) == pubid } else index.search { |r| r[:id].exclude(:edition) == pubid } end end |