Sha256: 98cdc2fb608efd7595076c4e67dd1fc6a958664e36acf8bf4e8a3f4704add4ac
Contents?: true
Size: 661 Bytes
Versions: 1
Compression:
Stored size: 661 Bytes
Contents
module Calil class Check *@@check_infos = %w(session books continue).map{|str| str.to_sym} attr_accessor *@@check_infos POLLING_URL = 'http://api.calil.jp/check' def initialize(hash = nil) hash ||= {} hash.each do |k,v| self.send("#{k}=", v) if respond_to? "#{k}=" end end def polling if @continue == 1 url = "#{POLLING_URL}?session=#{@session}&format=jsonjson&callback=no" Check.new(open(url) {|f| JSON.load(f)}) else nil end end def to_h Hash[*@@check_infos.map{|v| [v, send(v)] }.flatten] end def to_a to_h.to_a end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
calilen-0.1.1 | lib/calil/check.rb |