This commit is contained in:
2026-02-01 03:14:30 -08:00
commit b55ef0245a
10 changed files with 610 additions and 0 deletions

17
main.rb Executable file
View File

@@ -0,0 +1,17 @@
#! /bin/env ruby
require "sinatra"
require "json"
require "http"
require "active_support/all"
# USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
USER_AGENT = "MoxProx 0.1.0"
get "/deck_xml" do
deck_id = params['id']
api_url = "https://api2.moxfield.com/v3/decks/all/" + deck_id
content = HTTP.headers({"User-Agent" => USER_AGENT, 'Accept' => 'application/json'}).get(api_url)
puts content
JSON.parse(content).to_xml(:root => :deck)
end