def parse_response(response, format = 'json')
      result = nil

      if format == 'json'
        result = JSON.parse(response)
      elsif format == 'xml'
        result = Nokogiri::XML(response)
      end

      return result
    end
def parse_response(response, format = 'json')
      result = nil

      if format == 'json'
        result = JSON.parse(response)
      elsif format == 'xml'
        result = Nokogiri::XML(response)
      end

      return result
    end
Private: Parse the API response

 response - The response string
 format - The format of the response to parse

 Returns the parsed response as a data hash