Class: Airdata::DataDownloader

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ DataDownloader

Returns a new instance of DataDownloader.



9
10
11
12
13
14
# File 'lib/airdata.rb', line 9

def initialize(name)
  @name = name
  @local = "#{Dir.tmpdir}/#{@name}.airdata"
  @remote = "http://files.rubystudio.net/airdata/#{@name}.airdata"
  create_local_file
end

Instance Attribute Details

#localObject

Returns the value of attribute local.



7
8
9
# File 'lib/airdata.rb', line 7

def local
  @local
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/airdata.rb', line 7

def name
  @name
end

#remoteObject

Returns the value of attribute remote.



7
8
9
# File 'lib/airdata.rb', line 7

def remote
  @remote
end

Class Method Details

.cycleObject



16
17
18
# File 'lib/airdata.rb', line 16

def self.cycle
  Airdata::Airoption.last.value
end

.latest_cycleObject



20
21
22
23
# File 'lib/airdata.rb', line 20

def self.latest_cycle
  txt = "http://files.rubystudio.net/airdata/cycle.airdata"
  Curl::Easy.perform(txt).body_str[0..3]
end