class Fab::Book

Constants

SLEEP_TIME

Public Instance Methods

book_get_params() click to toggle source
# File lib/fab.rb, line 75
def book_get_params()
  @books = Hash.new { | h , k | h[k] = {} }
  count = 0
  @libraries.each_value do | library |
    temp_send_param = @book_send_param+"&systemid=#{library["systemid"]}"
    encode_uri = URI.encode(temp_send_param)
    result = nil
    loop do
      get_xml = open(encode_uri).read
      convert_json = Hash.from_xml(get_xml).to_json
      result = JSON.load(convert_json)
      break if result["result"]["continue"].to_i == 0
      sleep(SLEEP_TIME.to_i)
    end
    @books[count]["situation"] = result["result"]["books"]["book"]["system"]["libkeys"]
    count += 1
  end
end
book_set_param(isbn) click to toggle source
# File lib/fab.rb, line 67
def book_set_param(isbn)
  @book_send_param = "http://api.calil.jp/check?"
  @book_send_param << "appkey=#{Fab::Apikey::APIKEY}"
  @book_send_param << "&isbn=#{isbn}"
  @book_send_param << "&format=xml"
end