Here's your problem. Constant names in Ruby have to be capitalized. Change this to:

```ruby
enclosing_module = @submodule == nil ? (Twilio::REST) : (Twilio::REST.const_get(@submodule).capitalize)
```

And that should work (haven't tested).