DEV Community

Discussion on: Interesting naming you have come across?

Collapse
 
ben profile image
Ben Halpern

I sort of like that the popular HTTP client for Ruby is called HTTP "Party"

GitHub logo jnunemaker / httparty

πŸŽ‰ Makes http fun again!

httparty

Build Status

Makes http fun again! Ain't no party like a httparty, because a httparty don't stop.

Install

gem install httparty

Requirements

  • Ruby 2.0.0 or higher
  • multi_xml
  • You like to party!

Examples

# Use the class methods to get down to business quickly
response = HTTParty.get('http://api.stackexchange.com/2.2/questions?site=stackoverflow')
puts response.body, response.code, response.message, response.headers.inspect
# Or wrap things up in your own class
class StackExchange
  include HTTParty
  base_uri 'api.stackexchange.com'
  def initialize(service, page)
    @options = { query: { site: service, page: page } }
  end
  def questions
    self.class.get("/2.2/questions", @options)
  end

  def users
    self.class.get("/2.2/users", @options)
  end
end

stack_exchange = StackExchange.new("stackoverflow", 1)
puts stack_exchange.questions
puts stack_exchange.
…

I do think that enhances my enjoyment typing it compared to if it were "HTTPClient" or something generic or boring.