There be a website
This commit is contained in:
parent
64fb080e96
commit
af0907c7c3
65 changed files with 708 additions and 14 deletions
21
app/components/wah_component.rb
Normal file
21
app/components/wah_component.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
require "net/http"
|
||||
require "json"
|
||||
|
||||
class WahComponent < ViewComponent::Base
|
||||
def initialize(legacy:)
|
||||
if legacy then
|
||||
else
|
||||
uri = URI.parse('https://api.tinyfox.dev/img.json?animal=wah')
|
||||
req = Net::HTTP::Get.new(uri.to_s)
|
||||
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) {|http|
|
||||
http.request(req)
|
||||
}
|
||||
data = JSON.parse(res.body)
|
||||
url = "https://tinyfox.dev" + data["loc"]
|
||||
|
||||
@wah_url = url
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue