Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol String.Chars not implemented for %{"mms" => false, "sms" => false, "voice" => true} #57

Closed
laibulle opened this issue Oct 6, 2016 · 1 comment

Comments

@laibulle
Copy link

laibulle commented Oct 6, 2016

Hi,

I am trying to update a phone number:

{:ok, phone} = ExTwilio.IncomingPhoneNumber.find(phone_sid, account: user.twilio_sid)

{:ok, updated_phone} = ExTwilio.IncomingPhoneNumber.update(
      phone.sid,
      %{ phone | voice_method: "GET", voice_url: @incoming_url}
 )

But I get this error.

** (exit) an exception was raised:
    ** (Protocol.UndefinedError) protocol String.Chars not implemented for %{"mms" => false, "sms" => false, "voice" => true}
        (elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
        (elixir) lib/string/chars.ex:17: String.Chars.to_string/1
        (elixir) lib/uri.ex:105: URI.encode_kv_pair/1
        (elixir) lib/enum.ex:1216: anonymous fn/4 in Enum.map_join/3
        (elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
        (elixir) lib/enum.ex:1214: Enum.map_join/3
        (ex_twilio) lib/ex_twilio/api.ex:90: ExTwilio.Api.do_update/4
        (kokokog) web/controllers/api/incoming_phone_controller.ex:30: Kokokog.Api.IncomingPhonesController.create/2
        (kokokog) web/controllers/api/incoming_phone_controller.ex:1: Kokokog.Api.IncomingPhonesController.action/2
        (kokokog) web/controllers/api/incoming_phone_controller.ex:1: Kokokog.Api.IncomingPhonesController.phoenix_controller_pipeline/2
        (kokokog) lib/kokokog/endpoint.ex:1: Kokokog.Endpoint.instrument/4
        (kokokog) lib/phoenix/router.ex:261: Kokokog.Router.dispatch/2
        (kokokog) web/router.ex:1: Kokokog.Router.do_call/2
        (kokokog) lib/kokokog/endpoint.ex:1: Kokokog.Endpoint.phoenix_pipeline/1
        (kokokog) lib/plug/debugger.ex:122: Kokokog.Endpoint."call (overridable 3)"/2
        (kokokog) lib/kokokog/endpoint.ex:1: Kokokog.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

Am I doing something wrong ?

Best regards

@danielberkompas
Copy link
Owner

danielberkompas commented Jan 14, 2017

You should update like this:

{:ok, phone} = ExTwilio.IncomingPhoneNumber.find(phone_sid, account: user.twilio_sid)

{:ok, updated_phone} = ExTwilio.IncomingPhoneNumber.update(
      phone.sid,
      %{voice_method: "GET", voice_url: @incoming_url}
 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants