Method: Narou::API#request_api
- Defined in:
- lib/narou/api.rb
#request_api(of) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/narou/api.rb', line 25 def request_api(of) url = "#{@api_url}?ncode=#{@ncode}&of=#{of}" open(url) do |fp| result = YAML.load(fp.read) if result[0]["allcount"] == 1 @api_result = result[1] if of.length > 0 @api_result["novel_type"] = @api_result["noveltype"] end else error "なろうAPIから情報が取得出来ませんでした" exit 1 end end end |