Class: NasaApi::ResponseHandler::Epic
- Inherits:
-
Object
- Object
- NasaApi::ResponseHandler::Epic
- Defined in:
- lib/nasa_api/response_handler.rb
Instance Attribute Summary collapse
-
#attitude_quaternions ⇒ Object
Returns the value of attribute attitude_quaternions.
-
#caption ⇒ Object
Returns the value of attribute caption.
-
#centroid_coordinates ⇒ Object
Returns the value of attribute centroid_coordinates.
-
#coords ⇒ Object
Returns the value of attribute coords.
-
#date ⇒ Object
Returns the value of attribute date.
-
#dscovr_j2000_position ⇒ Object
Returns the value of attribute dscovr_j2000_position.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#image ⇒ Object
Returns the value of attribute image.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#lunar_j2000_position ⇒ Object
Returns the value of attribute lunar_j2000_position.
-
#response ⇒ Object
Returns the value of attribute response.
-
#sun_j2000_position ⇒ Object
Returns the value of attribute sun_j2000_position.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(response = {}) ⇒ Epic
constructor
A new instance of Epic.
Constructor Details
#initialize(response = {}) ⇒ Epic
Returns a new instance of Epic.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/nasa_api/response_handler.rb', line 101 def initialize(response = {}) @response = response response.each do |values| (@identifier ||= []) << values['identifier'] (@caption ||= []) << values['caption'] (@image ||= []) << values['image'] (@version ||= []) << values['version'] (@centroid_coordinates ||= []) << values['centroid_coordinates'] (@dscovr_j2000_position ||= []) << values['dscovr_j2000_position'] (@lunar_j2000_position ||= []) << values['lunar_j2000_position'] (@sun_j2000_position ||= []) << values['sun_j2000_position'] (@attitude_quaternions ||= []) << values['attitude_quaternions'] (@date ||= []) << values['date'] (@coords ||= []) << values['coords'] # Images are stored in an archive by YYYY/DD/MM url # Requires a little extra logic to retrieve image_url date_parsed = @date[-1].split(' ')[0] parts = date_parsed.split('-') (@image_url ||= []) << "https://epic.gsfc.nasa.gov/archive/natural/#{parts[0]}/#{parts[1]}/#{parts[2]}/png/#{@image[-1].to_s}.png" end end |
Instance Attribute Details
#attitude_quaternions ⇒ Object
Returns the value of attribute attitude_quaternions.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def attitude_quaternions @attitude_quaternions end |
#caption ⇒ Object
Returns the value of attribute caption.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def caption @caption end |
#centroid_coordinates ⇒ Object
Returns the value of attribute centroid_coordinates.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def centroid_coordinates @centroid_coordinates end |
#coords ⇒ Object
Returns the value of attribute coords.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def coords @coords end |
#date ⇒ Object
Returns the value of attribute date.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def date @date end |
#dscovr_j2000_position ⇒ Object
Returns the value of attribute dscovr_j2000_position.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def dscovr_j2000_position @dscovr_j2000_position end |
#identifier ⇒ Object
Returns the value of attribute identifier.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def identifier @identifier end |
#image ⇒ Object
Returns the value of attribute image.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def image @image end |
#image_url ⇒ Object
Returns the value of attribute image_url.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def image_url @image_url end |
#lunar_j2000_position ⇒ Object
Returns the value of attribute lunar_j2000_position.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def lunar_j2000_position @lunar_j2000_position end |
#response ⇒ Object
Returns the value of attribute response.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def response @response end |
#sun_j2000_position ⇒ Object
Returns the value of attribute sun_j2000_position.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def sun_j2000_position @sun_j2000_position end |
#version ⇒ Object
Returns the value of attribute version.
99 100 101 |
# File 'lib/nasa_api/response_handler.rb', line 99 def version @version end |