Class: ExploreMars::DateQuery

Inherits:
Call
  • Object
show all
Defined in:
lib/explore_mars/date_query.rb

Constant Summary

Constants inherited from Call

Call::BASE_URI, Call::CAMERAS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Call

#get

Constructor Details

#initialize(rover, date, camera = nil) ⇒ DateQuery

Returns a new instance of DateQuery.



5
6
7
8
9
# File 'lib/explore_mars/date_query.rb', line 5

def initialize(rover, date, camera=nil)
  @date = date
  @camera = camera.to_s.upcase
  @rover = rover
end

Instance Attribute Details

#cameraObject

Returns the value of attribute camera.



3
4
5
# File 'lib/explore_mars/date_query.rb', line 3

def camera
  @camera
end

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/explore_mars/date_query.rb', line 3

def date
  @date
end

#roverObject

Returns the value of attribute rover.



3
4
5
# File 'lib/explore_mars/date_query.rb', line 3

def rover
  @rover
end

Instance Method Details

#build_uriObject



11
12
13
14
15
16
17
# File 'lib/explore_mars/date_query.rb', line 11

def build_uri
  if !@camera.empty?
    URI.parse(BASE_URI + "#{@rover}/" + "photos?earth_date=#{@date}&camera=#{@camera}")
  else
    URI.parse(BASE_URI + "#{@rover}/" + "photos?earth_date=#{@date}")
  end
end