Class: Zypper::Upgraderepo::Requests::DownloadOpensuseOrgRequest

Inherits:
HttpRequest show all
Defined in:
lib/zypper/upgraderepo/requests/http.rb

Overview

Custom scraping methods for the specific download.opensuse.org search engine.

Constant Summary

Constants inherited from PageRequest

PageRequest::USER_AGENT

Instance Attribute Summary

Attributes inherited from PageRequest

#page

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HttpRequest

#evaluate_alternative, #max_drop_back, register_protocol

Methods included from Traversable

#traverse_url

Methods inherited from PageRequest

#available?, #cache!, #forbidden?, #initialize, #not_found?, #redirected?, #redirected_to, #status, #timeout?

Constructor Details

This class inherits a constructor from Zypper::Upgraderepo::PageRequest

Class Method Details

.domainObject



143
144
145
# File 'lib/zypper/upgraderepo/requests/http.rb', line 143

def self.domain
  "download.opensuse.org"
end

Instance Method Details

#subfolders(uri) ⇒ Object



147
148
149
150
151
152
153
# File 'lib/zypper/upgraderepo/requests/http.rb', line 147

def subfolders(uri)
  u = URI(uri.to_s)
  u.path = "/download#{u.path}"
  u.query = "jsontable"
  require "json"
  JSON.parse(ping(u, head: false).body.to_s)["data"].map { |x| x["name"] }
end