lib/jss/api_object.rb
# Given initialization args, perform an API lookup for an object.
#
# @param args[Hash] The args passed to #initialize, which must have either
#  key :id or key :fetch_rsrc
#
# @return [Hash] The parsed JSON data for the object from the API
#
Given initialization args, perform an API lookup for an object.
Given initialization args perform an API lookup for an object .
def look_up_object_data(args)
      rsrc = args[:fetch_rsrc]
      rsrc ||= "#{self.class::RSRC_BASE}/id/#{args[:id]}"
      args[:rsrc_object_key] ||= self.class::RSRC_OBJECT_KEY
      raw_json =
        if defined? self.class::USE_XML_WORKAROUND
          JSS::XMLWorkaround.data_via_xml rsrc, self.class::USE_XML_WORKAROUND, @api
        else
          @api.get_rsrc(rsrc)
        end
      raw_json[args[:rsrc_object_key]]
    end
def look_up_object_data ( args ) rsrc = args [ :fetch_rsrc ] rsrc ||= "#{self.class::RSRC_BASE}/id/#{args[:id]}" args [ :rsrc_object_key ] ||= self . class :: RSRC_OBJECT_KEY raw_json = if defined? self . class :: USE_XML_WORKAROUND JSS :: XMLWorkaround . data_via_xml rsrc , self . class :: USE_XML_WORKAROUND , @api else @api . get_rsrc ( rsrc ) end raw_json [ args [ :rsrc_object_key ] ] end
Given initialization args, perform an API lookup for an object.
Given initialization args perform an API lookup for an object .
# if needed, a non-standard object key can be passed by a subclass. # e.g. User when loookup is by email. # if we're here, the API JSON is borked, so use the XML # otherwise
The parsed JSON data for the object from the API
The parsed JSON data for the object from the API
Hash
args
The args passed to #initialize, which must have either key :id or key :fetch_rsrc
The args passed to #initialize which must have either key : id or key : fetch_rsrc