Class: Miteru::Feeds::Ayashige

Inherits:
Feed
  • Object
show all
Defined in:
lib/miteru/feeds/ayashige.rb

Constant Summary collapse

HOST =
"ayashige.herokuapp.com"
URL =
"https://#{HOST}"

Instance Method Summary collapse

Instance Method Details

#urlsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/miteru/feeds/ayashige.rb', line 12

def urls
  url = url_for("/api/v1/domains/")
  res = JSON.parse(get(url))

  domains = res.map { |item| item["fqdn"] }
  domains.map do |domain|
    [
      "https://#{domain}",
      "http://#{domain}"
    ]
  end.flatten
rescue HTTPResponseError, HTTP::Error, JSON::ParserError => e
  puts "Failed to load ayashige feed (#{e})"
  []
end