Class: Lita::Handlers::Amesh::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/handlers/amesh/downloader.rb

Constant Summary collapse

BASE_URL =
'http://tokyo-ame.jwa.or.jp/'.freeze
TIME_FORMAT =
'%Y%m%d%H%M'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fetch_amesh_imageObject



13
14
15
# File 'lib/lita/handlers/amesh/downloader.rb', line 13

def self.fetch_amesh_image
  new.fetch_amesh_image
end

Instance Method Details

#fetch_amesh_imageObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/lita/handlers/amesh/downloader.rb', line 17

def fetch_amesh_image
  result = MiniMagick::Image.open("#{BASE_URL}/map/map000.jpg")
  image = MiniMagick::Image.open("#{BASE_URL}/map/msk000.png")
  result = result.composite(image) do |c|
    c.compose 'Over'
  end

  rain_gif = fetch_rain_gif
  result = result.composite(rain_gif) do |c|
    c.compose 'Over'
  end

  result
end