Getting Started with the httparty Gem

    Table of contents

    HTTParty is a Ruby library for making HTTP requests and integrates easily with QuotaGuard.

    If you’re looking to make HTTP requests in your Ruby application, the httparty gem is a great tool to have in your toolkit. With httparty, you can easily make GET, POST, PUT, and DELETE requests, as well as handle basic authentication and response parsing. Whether you’re building a web scraper, consuming an API, or just need to make HTTP requests in your Ruby code, the httparty gem can help simplify the process. With great documentation and a strong community, it is a reliable choice for your HTTP needs.

    The following code snippet will print out one of your Static IP addresses.

    require 'httparty'
    
    proxy = URI(ENV["QUOTAGUARDSTATIC_URL"])
    
    options = {
      http_proxyaddr: proxy.host,
      http_proxyport:proxy.port,
      http_proxyuser:proxy.user,
      http_proxypass:proxy.password
    }
    
    response = HTTParty.get('https://ip.quotaguard.com/',options)
    
    puts response.body, response.code, response.message, response.headers.inspect
    

    We have examples for other common libraries as well, but if you can’t find what you are looking for just send us a Support ticket and we’ll get the right one sent to you.


    Ready to Get Started?

    Get in touch or create a free trial account