The proc gem lets you call codeless web functions through the proc.dev service.

Getting Started

Install proc using the gem command from the command line:

gem install proc

You will also need a proc.dev account. Create a free account in seconds at proc.dev.

Connecting

Sign in to your proc.dev account and locate your secret key. Use the secret to create a client connection:

client = Proc.connect("secret-key")

Calling Procs

You can call available procs through a connected client:

client.core.string.reverse.call("hello")
=> "olleh"

Requests are sent to proc.dev anytime the call method is invoked.

Callable Contexts

Proc lookups create contexts that can be called later:

string = client.core.string

string.reverse.call("hello")
=> "olleh"

string.truncate.call("hello", length: 3)
=> "hel"

Contexts can be configured with default input and arguments using the with method:

truncate = client.core.string.truncate.with("default", length: 1)

truncate.call
=> "d"

Default input and/or arguments can be overidden for a specific call:

truncate.call(length: 3)
=> "def"

Procs can also be looked up using the hash key syntax:

client["core.string.truncate"].call("hello", length: 3)
=> "hel"

Compositions

Procs can be composed together to build more complex behavior:

composition = client.core.string.reverse >> client.core.string.truncate(length: 3) >> client.core.string.capitalize

composition.call("hello")
=> "Oll"

Compositions are sent to proc.dev in a single request.