Class: Misc

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/modules/vca-be.rb

Instance Method Summary collapse

Instance Method Details

#customquery(token, serviceroot, customapicall, acceptcontentspecific) ⇒ Object

debug_output $stderr



183
184
185
186
187
188
189
190
191
192
# File 'lib/modules/vca-be.rb', line 183

def customquery(token, serviceroot, customapicall, acceptcontentspecific)
  if acceptcontentspecific != nil 
    acceptcontent = "application/xml" + ";class=" + acceptcontentspecific + ";version=5.7"
  end
  self.class.base_uri serviceroot
  puts acceptcontent
  self.class.default_options[:headers] = { "Accept" => acceptcontent, "Authorization" => "Bearer " + token }
  customresult = self.class.get(customapicall)
  return customresult
end

#extractendpoint(instanceattributes) ⇒ Object



195
196
197
198
199
200
# File 'lib/modules/vca-be.rb', line 195

def extractendpoint(instanceattributes) 
   #I turn the string into a hash 
   attributes = JSON.parse(instanceattributes)
   #I return the orgname and sessionuri values in the hash (note that I clean the uri to only provide the FQDN)
   return attributes["orgName"], attributes["sessionUri"][0..-14]
end