Sha256: 9b3437ae357505a65e507d4a75d5453329457ca241baebf2598f20d7a01e4e7a

Contents?: true

Size: 705 Bytes

Versions: 9

Compression:

Stored size: 705 Bytes

Contents

module RelatonCcsds
  class HitCollection < RelatonBib::HitCollection
    GHURL = "https://raw.githubusercontent.com/relaton/relaton-data-ccsds/main/".freeze
    INDEX_FILE = "index-v1.yaml".freeze

    #
    # Search his in index.
    #
    # @return [<Type>] <description>
    #
    def fetch
      rows = index.search text
      @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 RelatonBib::RequestError, e.message
    end

    def index
      @index ||= Relaton::Index.find_or_create :ccsds, url: "#{GHURL}index-v1.zip", file: INDEX_FILE
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
relaton-ccsds-1.19.0 lib/relaton_ccsds/hit_collection.rb
relaton-ccsds-1.18.1 lib/relaton_ccsds/hit_collection.rb
relaton-ccsds-1.18.0 lib/relaton_ccsds/hit_collection.rb
relaton-ccsds-1.17.0 lib/relaton_ccsds/hit_collection.rb
relaton-ccsds-1.16.3 lib/relaton_ccsds/hit_collection.rb
relaton-ccsds-1.16.2 lib/relaton_ccsds/hit_collection.rb
relaton-ccsds-1.16.1 lib/relaton_ccsds/hit_collection.rb
relaton-ccsds-1.16.0 lib/relaton_ccsds/hit_collection.rb
relaton-ccsds-1.14.0 lib/relaton_ccsds/hit_collection.rb