Here we have put together a handful of ruby examples to help get you started. Please read through the official API Documentation to get a complete sense of what to expect from each endpoint. As always, feel free to contact us directly if you have any questions on implementation. Thank you for using Lob!
To run these example commands, make sure you have a supported version of Ruby installed, including all the necessary gems.
An example showing how to dynamically create checks from a CSV using HTML, merge variables, and Lob's Checks API.
bundle exec ruby examples/csv_checks/create_checks.rb
An example showing how to dynamically create letters from a CSV using HTML, a custom font, merge variables, and Lob's Letters API.
bundle exec ruby examples/csv_letters/create_letters.rb
An example showing how to dynamically create postcards from a CSV using HTML, a custom font, merge variables, and Lob's Postcards API.
bundle exec ruby examples/csv_postcards/create_postcards.rb
An example showing how to validate and cleanse a CSV spreadsheet full of shipping addresses using Lob's US Verification API.
Please note that if you are running this with a Test API Key, the verification API will always return a dummy address.
bundle exec ruby examples/csv_verify/verify.rb
An example showing how to create a card using Lob's Cards API.
bundle exec ruby examples/cards.rb
An example showing how to create a check using Lob's Checks API.
bundle exec ruby examples/checks.rb
An example showing how to create a letter using Lob's Letters API.
bundle exec ruby examples/letters.rb
An example showing how to create a postcard using Lob's Postcards API.
bundle exec ruby examples/postcards.rb
An example showing how to create an idempotent postcard request using Lob's Postcards API.
bundle exec ruby examples/postcards_idempotent.rb
An example showing how to create an international postcard using Lob's Postcards API.
bundle exec ruby examples/postcards_intl.rb
An example showing how to create a postcard with remote files, using Lob's Postcards API.
bundle exec ruby examples/postcards_remote.rb
An example showing how to create a postcard with a specified send date, using Lob's Postcards API.
bundle exec ruby examples/postcards_send_date.rb
An example showing how to create a postcard with a saved template, using Lob's Postcards API.
bundle exec ruby examples/postcards_template.rb
An example showing how to create a self mailer using Lob's Self Mailers API.
bundle exec ruby examples/self_mailers.rb