You [Gerald Bauer¹] have been permanently banned [for life] from participating in r/ruby (because of your writing off / outside of r/ruby). I do not see your participation adding anything to this [ruby] community.

-- Richard Schneeman (r/ruby mod and fanatic illiberal ultra leftie on a cancel culture mission)

¹: I know. Who cares? Who is this Gerald Bauer anyway. A random nobody for sure. It just happens that I am the admin among other things of Planet Ruby.

Case Studies of Code of Conduct "Cancel Culture" Out-Of-Control Power Abuse - Ruby - A Call for Tolerance On Ruby-Talk Results In Ban On Reddit Ruby

Update (August, 2022) - A Call for More Tolerance And Call For No-Ban Policy Results In Ban On Ruby-Talk (With No Reason Given)

>  I just banned gerald.bauer@gmail.com.
>
>  -- SHIBATA Hiroshi
>
>> THANK YOU
>> 
>>  -- Ryan Davis
>>
>>
>> My full support to moderators.
>>
>> -- Xavier Noria
>> 
>> My full support to moderators.
>>
>>  -- Carlo E. Prelz
>>
>>  That's fun.
>>
>>  -- Alice

Read the full story »


« Ruby Gem of the Week Series

Get a free wiener lager, welsh red ale or kriek lambic beer delivered to your home (computer) in JSON and much much more

webservice library - Script HTTP JSON APIs (Web Services); Load (Micro) Web Services At-Runtime and More.

github: rubylibs/webservice, rubygems: webservice, rdoc: webservice

What’s the webservice library?

The webservice library lets you script HTTP JSON APIs also known as web services or microservices in classy Sinatra 2.0-style get / post methods with Mustermann 1.0 route / url pattern matching.

Dynamic Example

You can load web services at-runtime from files using Webservice.load_file. Example:

# service.rb

get '/' do
  'Hello, world!'
end

and

# server.rb

require 'webservice'

App = Webservice.load_file( './service.rb' )
App.run!

and to run type

$ ruby ./server.rb

Classic Example

# server.rb

require 'webservice'

class App < Webservice::Base
  get '/' do
    'Hello, world!'
  end
end

App.run!

and to run type

$ ruby ./server.rb

Rackup Example

Use config.ru and rackup. Example:

# config.ru

require `webservice`

class App < Webservice::Base
  get '/' do
    'Hello, world!'
  end
end

run App

and to run type

$ rackup      # will (auto-)load config.ru

Note: config.ru is a shortcut (inline) version of Rack::Builder.new do ... end:

# server.rb

require 'webservice'

class App < Webservice::Base
  get '/' do
    'Hello, world!'
  end
end

builder = Rack::Builder.new do
  run App
end

Rack::Server.start builder.to_app

and to run type

$ ruby ./server.rb

Bonus - “Real World” Examples

See

beerkit / beer.db.service - beer.db HTTP JSON API (web service) scripts e.g.

get '/beer/(r|rnd|rand|random)' do    # special keys for random beer
  Beer.rnd
end

get '/beer/:key'
  Beer.find_by! key: params['key']
end

get '/brewery/(r|rnd|rand|random)' do    # special keys for random brewery
  Brewery.rnd
end

get '/brewery/:key'
  Brewery.find_by! key: params['key']
end

...

worlddb / world.db.service - world.db HTTP JSON API (web service) scripts

get '/countries(.:format)?' do
  Country.by_key.all    # sort/order by key
end

get '/cities(.:format)?' do
  City.by_key.all       # sort/order by key
end

get '/tag/:slug(.:format)?' do   # e.g. /tag/north_america.csv
  Tag.find_by!( slug: params['slug'] ).countries
end

...

sportdb / sport.db.service - sport.db (football.db) HTTP JSON API (web service) scripts

Built with Ruby (running Jekyll) on 2023-01-25 18:05:39 +0000 in 0.371 seconds.
Hosted on GitHub Pages. </> Source on GitHub. (0) Dedicated to the public domain.