Class: VORuby::Simple::ImageAccess
- Includes:
- HTTPGetQuery, VOTableMarshaller
- Defined in:
- lib/voruby/simple/sap.rb
Overview
Instance Attribute Summary collapse
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#parser ⇒ Object
Returns the value of attribute parser.
-
#query_timeout ⇒ Object
Returns the value of attribute query_timeout.
-
#response ⇒ Object
Returns the value of attribute response.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(uri, pos, size, parameters = {}, query_timeout = 30, parser = 'rexml') ⇒ ImageAccess
constructor
right now are ‘rexml’ and ‘libxml’.
-
#pos(pos = nil) ⇒ Object
Set or get the value of the position.
-
#required_parameters ⇒ Object
Retrieve the list of required parameters.
-
#size(size = nil) ⇒ Object
Set or get the value of the angular size.
-
#to_s ⇒ Object
Convert the query into a valid URL.
Methods included from VOTableMarshaller
Methods included from HTTPGetQuery
Constructor Details
#initialize(uri, pos, size, parameters = {}, query_timeout = 30, parser = 'rexml') ⇒ ImageAccess
right now are ‘rexml’ and ‘libxml’. rexml ships with Ruby, but is
slow. libxml is much faster, but of course must be installed
separately.
378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/voruby/simple/sap.rb', line 378 def initialize(uri, pos, size, parameters={}, query_timeout=30, parser='rexml') parameters ||= {} @uri = uri pos(pos) size(size) @parameters = parameters @query_timeout = query_timeout @parser = parser @response = nil end |
Instance Attribute Details
#parameters ⇒ Object
Returns the value of attribute parameters.
359 360 361 |
# File 'lib/voruby/simple/sap.rb', line 359 def parameters @parameters end |
#parser ⇒ Object
Returns the value of attribute parser.
359 360 361 |
# File 'lib/voruby/simple/sap.rb', line 359 def parser @parser end |
#query_timeout ⇒ Object
Returns the value of attribute query_timeout.
359 360 361 |
# File 'lib/voruby/simple/sap.rb', line 359 def query_timeout @query_timeout end |
#response ⇒ Object
Returns the value of attribute response.
359 360 361 |
# File 'lib/voruby/simple/sap.rb', line 359 def response @response end |
#uri ⇒ Object
Returns the value of attribute uri.
359 360 361 |
# File 'lib/voruby/simple/sap.rb', line 359 def uri @uri end |
Instance Method Details
#pos(pos = nil) ⇒ Object
Set or get the value of the position. Allows a lazy mode where a string representing the position like ‘53.084, -27.873’is passed in instead of a full Position object.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/voruby/simple/sap.rb', line 395 def pos(pos=nil) if pos == nil return @pos else # Position. Allow a lazy mode where a string representing # the position is passed in instead of a full Position object. if pos.instance_of?(Parameters::Position) @pos = pos elsif pos.instance_of?(String) ra_dec, dec_dec = pos.split(/\s*,\s*/) @pos = Parameters::Position.new(ra_dec, dec_dec) else raise "Position must be a Position object or a string like " + "'ra_in_decimal_degrees, dec_in_decimal_degrees'" end end end |
#required_parameters ⇒ Object
Retrieve the list of required parameters. In this case: pos and size.
435 436 437 |
# File 'lib/voruby/simple/sap.rb', line 435 def required_parameters [@pos.to_s(), @size.to_s()] end |
#size(size = nil) ⇒ Object
Set or get the value of the angular size. Allows a lazy mode where a floating point number representing the size is passed in instead of a full Size object.
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/voruby/simple/sap.rb', line 416 def size(size=nil) if size == nil return @size else if size.instance_of?(Parameters::Size) @size = size elsif size.instance_of?(String) ra_width, dec_width = size.split(/\s*,\s*/) @size = Parameters::Size.new(ra_width, dec_width) elsif size.instance_of?(Float) or size.instance_of?(Fixnum) @size = Parameters::Size.new(size.to_f()) else raise "Size must be a Size object or a string like " + "'ra_width_in_decimal_degrees, dec_width_in_decimal_degrees'" end end end |
#to_s ⇒ Object
Convert the query into a valid URL.
440 441 442 |
# File 'lib/voruby/simple/sap.rb', line 440 def to_s query_uri() end |