Class: SnowNasa::Neobjects

Inherits:
Object
  • Object
show all
Includes:
SnowNasa
Defined in:
lib/SnowNasa/neobjects.rb

Constant Summary

Constants included from SnowNasa

VERSION

Instance Attribute Summary

Attributes included from SnowNasa

#nasa_api_key

Class Method Summary collapse

Methods included from SnowNasa

get_nasa_api_key, nasa_api_key

Class Method Details

.getNeo(options = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/SnowNasa/neobjects.rb', line 5

def self.getNeo(options = {})
  start_date = (options[:start_date].to_date).strftime("%Y-%m-%d")
  end_date = (options[:end_date].to_date).strftime("%Y-%m-%d")
  base_url = "https://api.nasa.gov/neo/rest/v1/feed?start_date=#{start_date}&end_date=#{end_date}&api_key=#{@@nasa_api_key}"
  data = open(base_url).read
  JSON.parse(data)
end