Class: Asterank::API::Skymorph
- Inherits:
-
Object
- Object
- Asterank::API::Skymorph
- Includes:
- HTTParty
- Defined in:
- lib/asterank-ruby/api/skymorph.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #image(key, filename, fast = true) ⇒ Object
-
#initialize ⇒ Skymorph
constructor
A new instance of Skymorph.
- #search(target) ⇒ Object
- #search_orbit(params) ⇒ Object
- #search_position ⇒ Object
Constructor Details
#initialize ⇒ Skymorph
Returns a new instance of Skymorph.
8 9 10 |
# File 'lib/asterank-ruby/api/skymorph.rb', line 8 def initialize @results = nil end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
6 7 8 |
# File 'lib/asterank-ruby/api/skymorph.rb', line 6 def results @results end |
Instance Method Details
#image(key, filename, fast = true) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/asterank-ruby/api/skymorph.rb', line 28 def image(key, filename, fast = true) if fast endpoint = '/fast_image' else endpoint = '/image' end @results = self.class.get(endpoint, query: {key: key}) File.open(filename, 'wb') {|f| f.write @results.parsed_response } end |
#search(target) ⇒ Object
16 17 18 |
# File 'lib/asterank-ruby/api/skymorph.rb', line 16 def search(target) @results = self.class.get('/search', query: {target: target}) end |
#search_orbit(params) ⇒ Object
20 21 22 |
# File 'lib/asterank-ruby/api/skymorph.rb', line 20 def search_orbit(params) @results = self.class.get('/search_orbit', query: cleanup_orbit_params(params)) end |
#search_position ⇒ Object
24 25 26 |
# File 'lib/asterank-ruby/api/skymorph.rb', line 24 def search_position @results = self.class.get('/search_orbit', query: cleanup_position_params(params)) end |