Class: USNO::Imagery::View

Inherits:
PayDirt::Base
  • Object
show all
Defined in:
lib/usno/imagery.rb

Direct Known Subclasses

Callisto, Europa, Ganymede, Io, Jupiter, Mars, Mercury, Moon, Venus

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ View

Returns a new instance of View.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/usno/imagery.rb', line 19

def initialize(options = {})
  options = {
    time:     Time.now,
    root_url: "http://api.usno.navy.mil/",
    resource: self.class.name.downcase.split("::")[1..-1].join("/") + ".png"
  }.merge(options)

  # sets instance variables from key value pairs,
  # will fail if any keys given before options aren't in options
  load_options(:time, :root_url, :resource, options)
end

Instance Method Details

#callObject



31
32
33
# File 'lib/usno/imagery.rb', line 31

def call
  result(true, query_for(@root_url + @resource))
end