Class: SnowNasa::Earthimg
- Inherits:
-
Object
- Object
- SnowNasa::Earthimg
- Includes:
- SnowNasa
- Defined in:
- lib/SnowNasa/earthimg.rb
Constant Summary
Constants included from SnowNasa
Instance Attribute Summary
Attributes included from SnowNasa
Class Method Summary collapse
Methods included from SnowNasa
get_nasa_api_key, nasa_api_key
Class Method Details
.getEarthImages(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/SnowNasa/earthimg.rb', line 5 def self.getEarthImages( = {}) lat = [:lat] lon = [:lon] dim = [:dim] date = ([:date].to_date).strftime("%Y-%m-%d") cloud_score = [:cloud_score] if cloud_score.nil? base_url = "https://api.nasa.gov/planetary/earth/imagery?lon=#{lon}&lat=#{lat}&date=#{date}&api_key=#{@@nasa_api_key}" else base_url = "https://api.nasa.gov/planetary/earth/imagery?lon=#{lon}&lat=#{lat}&date=#{date}&cloud_score=True&api_key=#{@@nasa_api_key}" end data = open(base_url).read JSON.parse(data) end |