To improve a function

Quite possibly!
Here are a couple of questions for you, that might help you:

  • Are the URLs in the two function clauses the same? If they are, you could extract this out to either another function, or to a module attribute.
  • Instead of using Kernel.inspect (which is meant to only be used for logging/introspection), you probably want to use to_string, or string interpolation. Also, there is no reason to use Kernel. in front of a function, because the Kernel module is always (unless explicitly overridden) imported into a module.
  • Why have the get_ in the name of the function? Depending on the context, this might matter for the meaning of the function name but maybe it is fluff that does not add extra meaning.