class TenkiJp::Forecast

Attributes

data[R]

Public Class Methods

new(location) click to toggle source
# File lib/tenkijp.rb, line 9
def initialize(location)
  @location = Jisx0402.search(location).first
  @data = Client.get(@location.code[0..-2].to_i)
end

Public Instance Methods

to_s() click to toggle source
# File lib/tenkijp.rb, line 14
    def to_s
      return <<EOB
■ #{@location.full}の天気
#{week.to_s}

#{two_days.map(&:index).join("\n")}
EOB
    end
two_days() click to toggle source
# File lib/tenkijp.rb, line 23
def two_days
  @data['days']['entries'].map do |day|
    Data::Day.new(day)
  end
end
week() click to toggle source
# File lib/tenkijp.rb, line 29
def week
  Data::Week.new(@data['days']['entries'], @data['tenweek']['entries'])
end