Over the past week, I’ve created a couple custom validators for my Elixir projects which use Ecto. Since validators are just functions that take a changeset and return a changeset, they’re very easy to write.[Read More]
Testing Ecto Validations
I recently was playing around with Phoenix and Ecto, Elixir’s database library, and I wanted to test my validations. In the process, I wrote a little library along the lines of Shoulda from Ruby. However, when José Valim saw it, he suggested a much better approach which I think illustrates what makes Elixir great.[Read More]
Telephonist: State Machines for Twilio
On Keeping Your ETS Tables Alive
In my ongoing quest to make Elixir libraries that integrate with Twilio, I found that I needed a lookup table to store the state of ongoing calls in.
In Rails, this table would probably be a Postgres table or a list key in Redis. But before jumping to one of these familiar solutions, I thought, “What does Elixir/Erlang already have that would meet this need?”[Read More]
Build Dialyzer PLTs on Travis CI
Run Dialyzer on Elixir on Travis CI
Contracts: Type Checking for Ruby
Stream Paginated APIs in Elixir
_This article was recently featured in Elixir Radar. Since it was written, I’ve found a simpler way to implement this kind of Stream. I’ll be writing an updated tutorial in the future, but if you’re interested, you should also check out the current state of ExTwilio.ResultStream._
Twilio paginates its “list” APIs, requiring multiple requests to fetch all of a given resource. However, users of my API library will expect to be able to fetch all of a resource and perform operations on it, like this:
calls = ExTwilio.Call.all Enum.each calls, fn(call) -> # perform some operation end
Users won’t want to mess with the details of pagination. They want to get a collection containing everything and then operate on it.
I find that there are two basic ways to achieve this, a blocking way and a non-blocking way.[Read More]
Manage Environment Variables in Elixir
I love how the Elixir build tool,
Mix, has built-in support for configuration settings. It makes configuring packages much simpler by providing a standard interface for config settings.
I’m currently developing a Twilio API client for Elixir. While I develop and test it, I need to store an “Account SID” and “Auth token” to make requests. Naturally, I turned to Mix config.[Read More]
I’ve been toying recently ideas on how to bring next-generation Erlang (Elixir) and next-generation telephony (Twilio) together. Toward that end, I made a little library this week to make generating TwiML from Elixir easy.[Read More]