class NasaApi::Mars

Constants

INSIGHT_URL
PHOTOS_URL

Public Instance Methods

insight(params = {}) click to toggle source
# File lib/nasa_api/mars.rb, line 6
def insight(params = {})
  params[:feedtype] ||= 'json'
  params[:ver] ||= '1.0'
  params.merge!(@options)

  response = HTTParty.get(INSIGHT_URL, query: params)
  if response.code == 200
    ResponseHandler::MarsInsight.new(response)
  else
    Error.new(response)
  end
end
photos(params = {}) click to toggle source
# File lib/nasa_api/mars.rb, line 19
def photos(params = {})
  params[:rover] ||= 'curiosity' 
  photo_rover_url = PHOTOS_URL + params[:rover].to_s + '/photos'
  params.merge!(@options)
  response = HTTParty.get(photo_rover_url, query: params)
  if response.code == 200
    ResponseHandler::MarsPhotos.new(response)
  else
    Error.new(response)
  end
end