Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
An easy to use Ruby wrapper around the NASA Open APIs
Currently supports: APOD, EPIC, Earth, Neo, Insight, Mars Rover Photos, TechTransfer and TechPort
Add this line to your application's Gemfile:
gem 'nasa_api'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install nasa_api
Similar APIs are grouped into clients, as seen below
This means that planetary_client = NasaApi::Planetary.new()
can be used for APOD, Earth and EPIC calls
If no API key is provided, a default 'DEMO_KEY' is used and is limited to 30 calls an hour from an IP
Visit NASA Open APIs to register for your own API key.
Once you have your key, pass it in when creating clients: mars_client = NasaApi::Mars.new(api_key: 'YOUR_KEY')
All parameters for every API call are supported and matches the parameters from NASA Open APIs
Don't pass api_key directly to a method call, only pass it when creating a client
Ruby Date and Time objects can be passed and will be converted to the 'YYYY-MM-DD' format that the API expects
These 2 calls are identical:
planetary_client.apod(date: '2021-01-01')
planetary_client.apod(date: Date.new(2021, 1, 1))
Create a client: planetary_client = NasaApi::Planetary.new(api_key: 'YOUR_KEY')
Get the APOD for today
apod_today = planetary_client.apod()
apod_today.url # image url
apod_today.hd_url
apod_today.explanation
# get the entire response, useful if you want to parse it directly
# every api call returns the entire response through call.response
apod_today.response
Get a range of APOD's
apod_range = planetary_client.apod(start_date: Date.new(2021, 1, 1), end_date: Date.new(2021, 1, 5))
apod_today.url # array of image urls for these dates
apod_today.date # array of dates
Note: There are other parameters available, check the docs and pass them as parameter: value
to the apod
method
Get Satellite image URL of place at this latitude/longitude on this date
image = planetary_client.earth_imagery(lon: 100.75, lat: 1.5, date: '2014-02-01')
image.url
image.response # To view the entire response
Get date-times and closest available imagery for a supplied location and date
assets = planetary_client.earth_assets(lon: 100.75, lat: 1.5, date: Time.new(2014, 02, 01))
assets.date
assets.url
Note: There are more results available like assets.resource
, not all options are listed here, check ResponseHandler::EarthAssets if looking for all possible results
Often when no date is passed the Nasa API will default to today
Get a range of pictures and information for today
epic = planetary_client.epic()
epic.date # array of date+time when images taken
epic.image_url # array of all images taken today
# much more availabe, use epic.response or check ResponseHandler::Epic to see more
Create a client: mars_client = NasaApi::Mars.new(api_key 'YOUR_KEY')
Get photos from Mars Rovers
rover_data = mars_client.photos(rover: 'curiosity', sol: 1000, camera: 'fhaz')
rover_data.photos # Array of hashes for each photo, dates and extra information
Nasa Docs state that due to sensor problems on Mars missing data is common
Get latest weather data from Mars at Elysium Planitia, near Mar's equator
weather_data = mars_client.insight()
weather_data.sol_keys
weather_data.validity_checks
weather_data.response
Create a client: tech_client = NasaApi::Tech.new(api_key: 'YOUR_KEY')
type and item parameters are required
Available types: patent, patent_issued, software and spinoff
Get technology and development information for Nasa Engines
engine_data = tech_client.transfer(type: 'patent', item: 'engine')
engine_data.results
engine_data.count
id parameter is required
Get data on Nasa project ID 17792
project_data = tech_client.port(id: 17792)
project_data.project # for one project
Often when providing no parameters Nasa will return everything by default
Get data on all Nasa projects through TechPort
projects_data = tech_client.port()
projects_data.projects # for an array of projects
Create a client: neo_client = NasaApi::Neo.new(api_key: 'YOUR_KEY')
Lookup a specific asteroid (asteroid_id required)
asteroid_data = neo_client.lookup(asteroid_id: 3542519)
asteroid_data.name
asteroid_data.is_potentially_hazardous_asteroid
# check ResponseHandler::NeoLookup for more output data
Get data on Neo's over a range of dates
neo_data = neo_client.feed(start_date: Date.new(2021, 1, 1), end_date: '2021-01-05')
neo_data.near_earth_objects
neo_data.element_count
neo_data.links
Browse the overall asteroid data-set
neo_data = neo_client.browse()
neo_data.near_earth_objects
neo_data.response
To run the specs first visit lib/nasa_api.rb
and provide your API key as the default, as described in the comment
This is due to the specs rate-limiting 'DEMO_KEY' quickly while testing API calls
Issue reports and pull requests are highly appreciated, this gem is in early development and has a lot of room for improvement
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that nasa_api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.