class Noaaish::Fetch
Constants
- CURL_TEMPLATE
- URL_TEMPLATE
Attributes
station_id[R]
year[R]
Public Class Methods
new(station_id, year)
click to toggle source
# File lib/noaaish/fetch.rb, line 11 def initialize(station_id, year) @station_id = station_id @year = year end
Public Instance Methods
call()
click to toggle source
# File lib/noaaish/fetch.rb, line 16 def call result = system(curl_command) raise "Failed calling #{curl_command}" unless result destination end
curl_command()
click to toggle source
# File lib/noaaish/fetch.rb, line 32 def curl_command sprintf CURL_TEMPLATE, :url => ftp_path, :destination => destination.path end
destination()
click to toggle source
# File lib/noaaish/fetch.rb, line 24 def destination @destination ||= Tempfile.new("noaaish-fetch-#{station_id}") end
ftp_path()
click to toggle source
# File lib/noaaish/fetch.rb, line 28 def ftp_path sprintf URL_TEMPLATE, :station_id => station_id, :year => year end