twilio / twilio-ruby

A Ruby gem for communicating with the Twilio API and generating TwiML
MIT License
1.35k stars 462 forks source link

TwimL SSML: Code doesn't match public Twilio Docs #637

Closed AxelTheGerman closed 1 year ago

AxelTheGerman commented 1 year ago

Issue Summary

The public documentation does not match the implementation:

https://github.com/twilio/twilio-ruby/blob/e8d50b8694f021e4c38570e49b1a022fc7a1abd7/lib/twilio-ruby/twiml/voice_response.rb#L601

I think the docs are more consistent with how Say works but either way, as long as they match it would save folks time trying to figure out what they did wrong. Unfortunately Ruby can't give a more descriptive error message in this case.

Code snippets

response = Twilio::TwiML::VoiceResponse.new
response.say(voice: 'Polly.Joanna', message: 'Hi') do |say|
  say.prosody('Words to speak', pitch: '-10%', rate: '85%', volume: '-6dB')
end

=> raises an error: ArgumentError: wrong number of arguments (given 1, expected 0)

response = Twilio::TwiML::VoiceResponse.new
response.say(voice: 'Polly.Joanna', message: 'Hi') do |say|
  say.prosody(words: 'Words to speak', pitch: '-10%', rate: '85%', volume: '-6dB')
end

=> works as expected

Exception/Log

ArgumentError: wrong number of arguments (given 1, expected 0)

Technical details:

sbansla commented 1 year ago

Thank you bringing this to our notice. We will be creating ticket with documentation team shortly.

sbansla commented 1 year ago

Doc team has been notified.

stern-shawn commented 1 year ago

Thanks for pointing this out! I was on PTO otherwise I would've addressed this sooner.

I've got a PR open to fix the documentation for now.

@sbansla I know it might be a breaking change, but inconsistencies in the API like this really should not be so common, and they seem to arise in the ruby library more than others.

edit: @sbansla even more inconsistencies that required a fix in the doc: https://github.com/TwilioDevEd/api-snippets/pull/1011/files

kridai commented 1 year ago

Issue is fixed now, The Doc is updated.