Class: Ramesh::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ramesh/client.rb

Constant Summary collapse

MESHES_INDEX_URL =
"http://tokyo-ame.jwa.or.jp/scripts/mesh_index.js"

Instance Method Summary collapse

Instance Method Details

#download_image(minute, save_dir, filename = nil) ⇒ Object



5
6
7
# File 'lib/ramesh/client.rb', line 5

def download_image(minute, save_dir, filename = nil)
  _download_image(minute, save_dir, filename, :small)
end

#download_large_image(minute, save_dir, filename = nil) ⇒ Object



9
10
11
# File 'lib/ramesh/client.rb', line 9

def download_large_image(minute, save_dir, filename = nil)
  _download_image(minute, save_dir, filename, :large)
end

#download_sequential_images(from, to, save_dir) ⇒ Object

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
# File 'lib/ramesh/client.rb', line 13

def download_sequential_images(from, to, save_dir)
  raise ArgumentError, "minutes must be a number; 0, 5, 10, ... 120" unless valid_minutes?(from) && valid_minutes?(to)

  [].tap do |image_names|
    (from..to).step(5) { |minute| image_names << download_image(minute, save_dir) }
  end
end