def look_up_object_data(args)
      rsrc =
        if args[:fetch_rsrc]
          args[:fetch_rsrc]
        else
          # what lookup key are we using?
          # TODO: simplify this, see the notes at #find_rsrc_keys
          rsrc_key, lookup_value = find_rsrc_keys(args)
          "#{self.class::RSRC_BASE}/#{rsrc_key}/#{lookup_value}"
        end

      # if needed, a non-standard object key can be passed by a subclass.
      # e.g. User when loookup is by email.
      args[:rsrc_object_key] ||= self.class::RSRC_OBJECT_KEY

      raw_json =
        if defined? self.class::USE_XML_WORKAROUND
          # if we're here, the API JSON is borked, so use the XML
          JSS::XMLWorkaround.data_via_xml rsrc, self.class::USE_XML_WORKAROUND, @api
        else
          # otherwise
          @api.get_rsrc(rsrc)
        end
      raw_json[args[:rsrc_object_key]]
    rescue RestClient::ResourceNotFound
      raise NoSuchItemError, "No #{self.class::RSRC_OBJECT_KEY} found matching resource #{rsrc}"
    end
def look_up_object_data(args)
      rsrc =
        if args[:fetch_rsrc]
          args[:fetch_rsrc]
        else
          # what lookup key are we using?
          # TODO: simplify this, see the notes at #find_rsrc_keys
          rsrc_key, lookup_value = find_rsrc_keys(args)
          "#{self.class::RSRC_BASE}/#{rsrc_key}/#{lookup_value}"
        end

      # if needed, a non-standard object key can be passed by a subclass.
      # e.g. User when loookup is by email.
      args[:rsrc_object_key] ||= self.class::RSRC_OBJECT_KEY

      raw_json =
        if defined? self.class::USE_XML_WORKAROUND
          # if we're here, the API JSON is borked, so use the XML
          JSS::XMLWorkaround.data_via_xml rsrc, self.class::USE_XML_WORKAROUND, @api
        else
          # otherwise
          @api.get_rsrc(rsrc)
        end
      raw_json[args[:rsrc_object_key]]
    rescue RestClient::ResourceNotFound
      raise NoSuchItemError, "No #{self.class::RSRC_OBJECT_KEY} found matching resource #{rsrc}"
    end
Given initialization args, perform an API lookup for an object.

 @param args[Hash] The args passed to #initialize

 @return [Hash] The parsed JSON data for the object from the API