lib/kindai/util/database.rb in kindai-1.7.1 vs lib/kindai/util/database.rb in kindai-1.7.2

- old
+ new

@@ -7,11 +7,11 @@ module Kindai::Util::Database ENDPOINT = URI.parse 'http://gigaschema.appspot.com/hitode909/kindai.json' # XXX: deprecated, page 1 only def self.items - @items ||= JSON.parse(open(ENDPOINT).read)['data'].map{|item| + @items ||= JSON.parse(Kindai::Util.fetch_uri(ENDPOINT))['data'].map{|item| begin hash = JSON.parse(item['value']) self.validate(hash) OpenStruct.new(hash) rescue => error @@ -21,10 +21,10 @@ }.compact end def self.item_for_book(book) path = ENDPOINT + "?group=#{book.key}" - JSON.parse(open(path).read)['data'].map{|item| + JSON.parse(Kindai::Util.fetch_uri(path))['data'].map{|item| begin hash = JSON.parse(item['value']) self.validate(hash) OpenStruct.new(hash) rescue => error