Class: Syobocalite::DbClient
- Inherits:
-
Object
- Object
- Syobocalite::DbClient
- Defined in:
- lib/syobocalite/db_client.rb
Overview
API client for cal.syoboi.jp/db.php
Instance Method Summary collapse
-
#get_program_flag(tid:, pid:) ⇒ Integer
Get program’s flag.
Instance Method Details
#get_program_flag(tid:, pid:) ⇒ Integer
Get program’s flag
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/syobocalite/db_client.rb', line 10 def get_program_flag(tid:, pid:) params = { "Command" => "ProgLookup", "Fields" => "Flag", "TID" => tid, "PID" => pid, } headers = { "User-Agent" => Syobocalite.user_agent, } xml = URI.open("https://cal.syoboi.jp/db.php?#{params.to_param}", headers).read response = MultiXml.parse(xml) response["ProgLookupResponse"]["ProgItems"]["ProgItem"]["Flag"].to_i end |