class ArcServer::REST::Identify

Public Class Methods

new(attr={}) click to toggle source

debug_output $stdout

# File lib/arcserver/rest/identify.rb, line 11
def initialize(attr={})
  defaults = {
    f: "json",
    geometry: "",
    geometryType: "esriGeometryEnvelope",
    sr: "",
    layerDefs: "",
    time: "",
    layerTimeOptions: "",
    layers: "all",
    tolerance: "2",
    mapExtent: "",
    imageDisplay: "",
    returnGeometry: true,
    maxAllowableOffset: ""
  }.merge(attr)
  defaults.each { |k,v| instance_variable_set("@#{k}",v) }
end

Public Instance Methods

execute(url) click to toggle source
# File lib/arcserver/rest/identify.rb, line 40
def execute(url)
  response = self.class.get("#{url}/identify", query: params)
  response.with_indifferent_access[:results].map { |r| IdentifyResult.new(r) }
end
params() click to toggle source
# File lib/arcserver/rest/identify.rb, line 30
def params
  hash = Hash[instance_variables.map { |name| [name.to_s[1..-1].to_sym, instance_variable_get(name)] } ]
  if hash[:geometry]
    hash[:geometryType] = hash[:geometry].geometryType
    hash[:geometry] = hash[:geometry].to_json
  end
  hash[:mapExtent] = hash[:mapExtent].join(',') if hash[:mapExtent]
  hash
end