class NHK::Easy::Client
Public Instance Methods
news_list()
click to toggle source
# File lib/nhk-easy-ruby.rb, line 10 def news_list # Encode ascii -> utf-8 and remove bom data = Net::HTTP .get(BASE_URI+"news-list.json") .force_encoding('UTF-8') .gsub("\xEF\xBB\xBF", '') json = Parser.new(data).parse! news_list = NewsList.new json.map do |list| list.keys.each do |date| list[date].each do |item| news_list.entries << News.new(date: date, item: item) end end end return news_list end