How can I use Ruby to access third party JSON on checkout.liquid?

I want to get the data from json to checkout.liquid. And I get a CORS error:

has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource

And it’s logical, I read that it should be done on the backend side. But I have a question:

Can I allow access to third party json by writing a script through a script-editor, in ruby language?

If so, please show a simple example, or point a resource to that example. I am not familiar with the ruby language.

Thanks.