Skip to content

Latest commit

 

History

History
79 lines (64 loc) · 5.9 KB

5.0-Upgrade.md

File metadata and controls

79 lines (64 loc) · 5.9 KB

5.0 Upgrade

  • Make sure you are running Ruby 2.0+ (Ruby 1.9 is no longer supported).

  • If you are explicitly specifying the Nexmo::Client key option: rename it to api_key.

  • If you are explicitly specifying the Nexmo::Client secret option: rename it to api_secret.

  • If you are explicitly generating JWT tokens: rename Nexmo::JWT.auth_token calls to Nexmo::JWT.generate.

  • Change client method calls to use namespaces, as follows:

    New v5 method Old v4 method
    client.sms.send(params) client.send_message(params)
    client.calls.create(params) client.create_call(params)
    client.calls.list(params) client.get_calls(params)
    client.calls.get(id) client.get_call(id)
    client.calls.update(id, params) client.update_call(id, params)
    client.calls.stream.start(id, params) client.send_audio(id, params)
    client.calls.stream.stop(id) client.stop_audio(id)
    client.calls.talk.start(id, params) client.send_speech(id, params)
    client.calls.talk.stop(id) client.stop_speech(id)
    client.calls.dtmf.send(id, params) client.send_dtmf(id, params)
    client.verify.request(params) client.start_verification(params)
    client.verify.check(params) client.check_verification(request_id, params)
    client.verify.search(params) client.get_verification(request_id)
    client.verify.cancel(request_id) client.cancel_verification(request_id)
    client.verify.trigger_next_event(request_id) client.trigger_next_verification_event(request_id)
    client.number_insight.basic(params) client.get_basic_number_insight(params)
    client.number_insight.standard(params) client.get_standard_number_insight(params)
    client.number_insight.advanced(params) client.get_advanced_number_insight(params)
    client.number_insight.advanced_async(params) client.get_advanced_async_number_insight(params)
    client.account.balance client.get_balance
    client.account.update(params) client.update_settings(params)
    client.account.topup(params) client.topup(params)
    client.messages.get(id) client.get_message(id)
    client.messages.search(params) client.search_messages(params)
    client.messages.rejections(params) client.get_message_rejections(params)
    client.numbers.list(params) client.get_account_numbers(params)
    client.numbers.search(params) client.get_available_numbers(country, params)
    client.numbers.buy(params) client.buy_number(params)
    client.numbers.cancel(params) client.cancel_number(params)
    client.numbers.update(params) client.update_number(params)
    client.pricing.voice.get(country) client.get_country_pricing(country)
    client.pricing.voice.list client.get_voice_pricing(number)
    client.pricing.voice.prefix(prefix) client.get_prefix_pricing(prefix)
    client.pricing.sms.list client.get_sms_pricing(number)
    client.applications.create(params) client.create_application(params)
    client.applications.list(params) client.get_applications(params)
    client.applications.get(id) client.get_application(id)
    client.applications.update(id, params) client.update_application(id, params)
    client.applications.delete(id) client.delete_application(id)
    client.files.get(id) client.get_file(id)
    client.files.save(id, filename) client.save_file(id, filename)
    client.conversions.track_sms(params) client.track_message_conversion(id, params)
    client.conversions.track_voice(params) client.track_voice_conversion(id, params)
    client.signature.check(params) client.check_signature(params)
    client.alerts.list client.get_event_alert_numbers
    client.alerts.resubscribe(params) client.resubscribe_event_alert_number(params)
    client.alerts.send(params) client.send_event_alert_message(params)
  • Change code that handles response objects to use entity methods instead of key lookups.

    Old v4 code: response['messages'].first['status']

    New v5 code: response.messages.first.status

  • Change any hyphenated param keys for the SMS API and Conversion API.

    Old v4 code: 'status-report-req' => 1

    New v5 code: status_report_req: 1

  • Change any camelcased param keys for the Number API.

    Old v4 code: voiceCallbackType: 'app'

    New v5 code: voice_callback_type: 'app'