class Fab::Library
Constants
- NONE_APIKEY_TEMPLATE
Public Class Methods
new()
click to toggle source
# File lib/fab.rb, line 96 def initialize() @library_send_param = "http://api.calil.jp/library?" end
Public Instance Methods
library_get_params()
click to toggle source
# File lib/fab.rb, line 115 def library_get_params() encode_uri = URI.encode(@library_send_param) get_xml = open(encode_uri).read convert_json = Hash.from_xml(get_xml).to_json result = JSON.load(convert_json) @libraries = Hash.new { | h , k | h[k] = {} } count_id(result) for i in 0..@id_count @libraries[i]["systemid"] = result["Libraries"]["Library"][i]["systemid"] @libraries[i]["formal"] = result["Libraries"]["Library"][i]["formal"] end end
library_set_param(pref,city)
click to toggle source
# File lib/fab.rb, line 104 def library_set_param(pref,city) begin @library_send_param << "appkey=#{Fab::Apikey::APIKEY}" rescue puts NONE_APIKEY_TEMPLATE exit end @library_send_param << "&pref=#{pref}" @library_send_param << "&city=#{city}" end
Private Instance Methods
count_id(target)
click to toggle source
# File lib/fab.rb, line 129 def count_id(target) @id_count = target.to_s.scan(/sys[a-z]*d/).size - 1 end