Class: RelatonUn::HitCollection
- Inherits:
-
RelatonBib::HitCollection
- Object
- RelatonBib::HitCollection
- RelatonUn::HitCollection
- Defined in:
- lib/relaton_un/hit_collection.rb
Overview
Page of hit collection.
Constant Summary collapse
- AGENT =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 " \ "(KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"
- DOMAIN =
"https://documents.un.org"
- BOUNDARY =
"----WebKitFormBoundaryVarT9Z7AFUzw2lma"
Instance Method Summary collapse
-
#initialize(text) ⇒ HitCollection
constructor
A new instance of HitCollection.
Constructor Details
#initialize(text) ⇒ HitCollection
Returns a new instance of HitCollection.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/relaton_un/hit_collection.rb', line 15 def initialize(text) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength super @uri = URI.parse DOMAIN @jar = HTTP::CookieJar.new @http = Net::HTTP.new @uri.host, @uri.port # , "localhost", "8000" @http.use_ssl = true # @http.verify_mode = OpenSSL::SSL::VERIFY_PEER # @http.cert_store = OpenSSL::X509::Store.new # ca_file = "/Users/andrej/Library/Preferences/httptoolkit/ca.pem" # @http.cert_store.set_default_paths # @http.cert_store.add_file ca_file if RUBY_VERSION.to_f > 3.0 @http.ssl_version = :TLSv1_2 # rubocop:disable Naming/VariableNumber end @http.read_timeout = 120 if (form_resp = get_page) # doc = Nokogiri::HTML page_resp(form_resp, text).body doc = Nokogiri::HTML page_resp(form_resp, text).body @array = doc.css("div.viewHover").map { |item| hit item } end end |