diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5ca8d1c..ad79fa1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - ruby-version: [ "2.7.3", "3.0.1" ] + ruby-version: [ "3.0.3", "3.1.1" ] steps: - uses: actions/checkout@v2 diff --git a/.rubocop.yml b/.rubocop.yml index d4db141..17c3448 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,6 @@ AllCops: - TargetRubyVersion: 2.6.7 + NewCops: enable + TargetRubyVersion: 3.0.3 # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop # to ignore them, so only the ones explicitly set in this file are enabled. # DisabledByDefault: true @@ -11,7 +12,7 @@ Metrics/ClassLength: Enabled: false Metrics/MethodLength: Enabled: false -Metrics/LineLength: +Layout/LineLength: Enabled: false Metrics/AbcSize: Enabled: false @@ -35,5 +36,3 @@ Style/PercentLiteralDelimiters: Enabled: false Style/SymbolArray: Enabled: false -Style/BracesAroundHashParameters: - Enabled: false diff --git a/examples/balance.rb b/examples/balance.rb index 0201efb..a45873a 100755 --- a/examples/balance.rb +++ b/examples/balance.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'test_gshuPaZoeEG6ovbc8M79w0QyM' diff --git a/examples/call.rb b/examples/call.rb index 2feea25..1c8179e 100755 --- a/examples/call.rb +++ b/examples/call.rb @@ -2,7 +2,7 @@ # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'YOUR ACCESS KEY HERE' diff --git a/examples/call_leg_recordings.rb b/examples/call_leg_recordings.rb index 288b451..d403585 100755 --- a/examples/call_leg_recordings.rb +++ b/examples/call_leg_recordings.rb @@ -2,7 +2,7 @@ # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/call_legs.rb b/examples/call_legs.rb index b46139e..f85816b 100755 --- a/examples/call_legs.rb +++ b/examples/call_legs.rb @@ -2,7 +2,7 @@ # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'YOUR ACCESS KEY HERE' diff --git a/examples/contact_create.rb b/examples/contact_create.rb index bd6a4a9..2bdda8c 100755 --- a/examples/contact_create.rb +++ b/examples/contact_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/contact_list.rb b/examples/contact_list.rb index 22ce004..a8c4af3 100755 --- a/examples/contact_list.rb +++ b/examples/contact_list.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/conversation.rb b/examples/conversation.rb index 0dbff2e..6aed36b 100755 --- a/examples/conversation.rb +++ b/examples/conversation.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_list.rb b/examples/conversation_list.rb index 4655d97..dc96351 100755 --- a/examples/conversation_list.rb +++ b/examples/conversation_list.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_message.rb b/examples/conversation_message.rb index aa93e73..14d4018 100755 --- a/examples/conversation_message.rb +++ b/examples/conversation_message.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_messages_list.rb b/examples/conversation_messages_list.rb index b981c62..ac8f81c 100755 --- a/examples/conversation_messages_list.rb +++ b/examples/conversation_messages_list.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_reply.rb b/examples/conversation_reply.rb index 0ba94c1..9f369f2 100755 --- a/examples/conversation_reply.rb +++ b/examples/conversation_reply.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_update.rb b/examples/conversation_update.rb index fc09791..399b617 100755 --- a/examples/conversation_update.rb +++ b/examples/conversation_update.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_webhook.rb b/examples/conversation_webhook.rb index f7b6cbb..09cd6b8 100755 --- a/examples/conversation_webhook.rb +++ b/examples/conversation_webhook.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_webhook_create.rb b/examples/conversation_webhook_create.rb index 87a8c5a..ea57bbf 100755 --- a/examples/conversation_webhook_create.rb +++ b/examples/conversation_webhook_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_webhook_delete.rb b/examples/conversation_webhook_delete.rb index e248151..5c7d5b3 100755 --- a/examples/conversation_webhook_delete.rb +++ b/examples/conversation_webhook_delete.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_webhook_update.rb b/examples/conversation_webhook_update.rb index 08d4f06..bd16005 100755 --- a/examples/conversation_webhook_update.rb +++ b/examples/conversation_webhook_update.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/conversation_webhooks_list.rb b/examples/conversation_webhooks_list.rb index 1476fb8..6c6b109 100755 --- a/examples/conversation_webhooks_list.rb +++ b/examples/conversation_webhooks_list.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/group_create.rb b/examples/group_create.rb index aa14e20..8c72812 100755 --- a/examples/group_create.rb +++ b/examples/group_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/group_list.rb b/examples/group_list.rb index aee3f34..3741f81 100755 --- a/examples/group_list.rb +++ b/examples/group_list.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/hlr.rb b/examples/hlr.rb index d276c1a..ecd38f9 100755 --- a/examples/hlr.rb +++ b/examples/hlr.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/hlr_create.rb b/examples/hlr_create.rb index 9bbe526..c2e3e07 100755 --- a/examples/hlr_create.rb +++ b/examples/hlr_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'test_gshuPaZoeEG6ovbc8M79w0QyM' diff --git a/examples/lookup.rb b/examples/lookup.rb index 094501f..3c63913 100755 --- a/examples/lookup.rb +++ b/examples/lookup.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/lookup_hlr.rb b/examples/lookup_hlr.rb index 7083af7..49d7b41 100755 --- a/examples/lookup_hlr.rb +++ b/examples/lookup_hlr.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/lookup_hlr_create.rb b/examples/lookup_hlr_create.rb index c34fad1..d8ba9d1 100755 --- a/examples/lookup_hlr_create.rb +++ b/examples/lookup_hlr_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/message.rb b/examples/message.rb index d9a83ea..2364002 100755 --- a/examples/message.rb +++ b/examples/message.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/message_create.rb b/examples/message_create.rb index 7350762..3f66f8c 100755 --- a/examples/message_create.rb +++ b/examples/message_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'test_gshuPaZoeEG6ovbc8M79w0QyM' diff --git a/examples/message_list.rb b/examples/message_list.rb index 6d3d6d2..127a70b 100755 --- a/examples/message_list.rb +++ b/examples/message_list.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/number_cancel.rb b/examples/number_cancel.rb index 0be9764..30f2296 100755 --- a/examples/number_cancel.rb +++ b/examples/number_cancel.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/number_fetch.rb b/examples/number_fetch.rb index 188faa2..19349b4 100755 --- a/examples/number_fetch.rb +++ b/examples/number_fetch.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/number_fetch_all.rb b/examples/number_fetch_all.rb index 45874f4..63c154a 100755 --- a/examples/number_fetch_all.rb +++ b/examples/number_fetch_all.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/number_purchase.rb b/examples/number_purchase.rb index 1e566d3..6e00432 100755 --- a/examples/number_purchase.rb +++ b/examples/number_purchase.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/number_search.rb b/examples/number_search.rb index 07813ab..a198dcb 100755 --- a/examples/number_search.rb +++ b/examples/number_search.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/number_update.rb b/examples/number_update.rb index 82fc30c..845f199 100755 --- a/examples/number_update.rb +++ b/examples/number_update.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = 'YOUR KEY HERE' diff --git a/examples/send_conversation_message.rb b/examples/send_conversation_message.rb index 3ebc72f..e90c356 100755 --- a/examples/send_conversation_message.rb +++ b/examples/send_conversation_message.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/signed_request_validation.rb b/examples/signed_request_validation.rb index 7518ffb..21fe884 100755 --- a/examples/signed_request_validation.rb +++ b/examples/signed_request_validation.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' SIGNING_KEY = 'PlLrKaqvZNRR5zAjm42ZT6q1SQxgbbGd' diff --git a/examples/start_conversation.rb b/examples/start_conversation.rb index 6eedd56..896ad15 100755 --- a/examples/start_conversation.rb +++ b/examples/start_conversation.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/start_hsm_conversation.rb b/examples/start_hsm_conversation.rb index 5eae298..3d71407 100755 --- a/examples/start_hsm_conversation.rb +++ b/examples/start_hsm_conversation.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/verify.rb b/examples/verify.rb index b5feda1..363a847 100755 --- a/examples/verify.rb +++ b/examples/verify.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/verify_create.rb b/examples/verify_create.rb index 9de3b7a..12eb488 100755 --- a/examples/verify_create.rb +++ b/examples/verify_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/verify_create_email.rb b/examples/verify_create_email.rb index db80ad6..fa128a9 100755 --- a/examples/verify_create_email.rb +++ b/examples/verify_create_email.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/verify_delete.rb b/examples/verify_delete.rb index 32564f6..fd00c12 100755 --- a/examples/verify_delete.rb +++ b/examples/verify_delete.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/verify_email_message.rb b/examples/verify_email_message.rb index e60f393..872f355 100755 --- a/examples/verify_email_message.rb +++ b/examples/verify_email_message.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/verify_token.rb b/examples/verify_token.rb index 8c90ea4..84d5449 100755 --- a/examples/verify_token.rb +++ b/examples/verify_token.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/voice_message.rb b/examples/voice_message.rb index 61d6d0c..c2f3499 100755 --- a/examples/voice_message.rb +++ b/examples/voice_message.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/voice_message_create.rb b/examples/voice_message_create.rb index a8af255..b9f050e 100755 --- a/examples/voice_message_create.rb +++ b/examples/voice_message_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'test_gshuPaZoeEG6ovbc8M79w0QyM' diff --git a/examples/voice_transcription.rb b/examples/voice_transcription.rb index ddb436d..fb75bf9 100755 --- a/examples/voice_transcription.rb +++ b/examples/voice_transcription.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' ACCESS_KEY = 'test_gshuPaZoeEG6ovbc8M79w0QyM' diff --git a/examples/voice_webhook_create.rb b/examples/voice_webhook_create.rb index b27262f..9a9859a 100755 --- a/examples/voice_webhook_create.rb +++ b/examples/voice_webhook_create.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/voice_webhook_delete.rb b/examples/voice_webhook_delete.rb index d2b4b06..fb05df4 100755 --- a/examples/voice_webhook_delete.rb +++ b/examples/voice_webhook_delete.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/voice_webhook_update.rb b/examples/voice_webhook_update.rb index 5a06076..4e87cca 100755 --- a/examples/voice_webhook_update.rb +++ b/examples/voice_webhook_update.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/examples/voice_webhooks_list.rb b/examples/voice_webhooks_list.rb index 4b555e4..f63e7f6 100755 --- a/examples/voice_webhooks_list.rb +++ b/examples/voice_webhooks_list.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/') +$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib/") require 'messagebird' # ACCESS_KEY = '' diff --git a/lib/messagebird/callflow.rb b/lib/messagebird/callflow.rb index b0b3acf..937d2f3 100644 --- a/lib/messagebird/callflow.rb +++ b/lib/messagebird/callflow.rb @@ -26,7 +26,8 @@ def updated_at=(value) end class CallFlowList < List - attr_accessor :perPage, :currentPage, :pageCount, :totalCount + attr_accessor :per_page, :current_page, :page_count, :total_count + PER_PAGE = 20 CURRENT_PAGE = 1 @@ -53,8 +54,8 @@ def options=(json) class CallFlowStepOption < MessageBird::Base attr_accessor :destination, :payload, :language, :voice, :repeat, - :media, :length, :maxLength, :timeout, :finishOnKey, :transcribe, - :transcribeLanguage, :record, :url, :ifMachine, :machineTimeout, - :onFinish, :mask + :media, :length, :max_length, :timeout, :finish_on_key, :transcribe, + :transcribe_language, :record, :url, :if_machine, :machine_timeout, + :on_finish, :mask end end diff --git a/lib/messagebird/client.rb b/lib/messagebird/client.rb index 2b833cd..75fe530 100644 --- a/lib/messagebird/client.rb +++ b/lib/messagebird/client.rb @@ -30,13 +30,13 @@ require 'messagebird/voice/call_leg' require 'messagebird/voice/call_leg_recording' require 'messagebird/voice/transcription' -require 'messagebird/voice/list' module MessageBird class ErrorException < StandardError attr_reader :errors def initialize(errors) + super() @errors = errors end end @@ -47,7 +47,8 @@ class InvalidFeatureException < StandardError class Client attr_reader :access_key, :http_client, :conversation_client, :voice_client - def initialize(access_key = nil, http_client = nil, conversation_client = nil, voice_client = nil) + def initialize(access_key = nil, http_client = nil, conversation_client = nil, voice_client = nil) # rubocop:disable Metrics/ParameterLists + super() @access_key = access_key || ENV['MESSAGEBIRD_ACCESS_KEY'] @http_client = http_client || HttpClient.new(@access_key) @conversation_client = conversation_client || ConversationClient.new(@access_key) @@ -490,7 +491,7 @@ def add_contacts_query(contact_ids) # JSON by default. See also: # https://developers.messagebird.com/docs/alternatives. - '_method=PUT&' + contact_ids.map { |id| "ids[]=#{id}" }.join('&') + contact_ids.map { |id| "ids[]=#{id}" }.join('&').prepend('_method=PUT&') end def add_querystring(path, params) diff --git a/lib/messagebird/http_client.rb b/lib/messagebird/http_client.rb index 647b842..038d054 100644 --- a/lib/messagebird/http_client.rb +++ b/lib/messagebird/http_client.rb @@ -33,7 +33,7 @@ def build_http_client(uri) http end - def request(method, path, params = {}, check_json = true) + def request(method, path, params = {}, check_json: true) uri = URI.join(endpoint, path) http = build_http_client(uri) request = build_request(method, uri, params) diff --git a/lib/messagebird/message.rb b/lib/messagebird/message.rb index fa9fc46..11957f6 100644 --- a/lib/messagebird/message.rb +++ b/lib/messagebird/message.rb @@ -6,7 +6,7 @@ module MessageBird class Message < MessageBird::Base attr_accessor :id, :href, :direction, :type, :originator, :body, :reference, - :validity, :gateway, :typeDetails, :datacoding, :mclass + :validity, :gateway, :type_details, :datacoding, :mclass attr_reader :scheduled_date_time, :created_datetime, :recipients def scheduled_date_time=(value) diff --git a/lib/messagebird/request_validator.rb b/lib/messagebird/request_validator.rb index 4b7887e..e1955a2 100644 --- a/lib/messagebird/request_validator.rb +++ b/lib/messagebird/request_validator.rb @@ -20,7 +20,7 @@ class RequestValidator # # @param [string] signature_key customer signature key. Can be retrieved through Developer Settings. This is NOT your API key. # @param [bool] skip_url_validation whether url_hash claim validation should be skipped. Note that when true, no query parameters should be trusted. - def initialize(signature_key, skip_url_validation = false) + def initialize(signature_key, skip_url_validation: false) @signature_key = signature_key @skip_url_validation = skip_url_validation end diff --git a/lib/messagebird/voice/call_leg_recording.rb b/lib/messagebird/voice/call_leg_recording.rb index 4006a2a..b0d6dc0 100644 --- a/lib/messagebird/voice/call_leg_recording.rb +++ b/lib/messagebird/voice/call_leg_recording.rb @@ -11,6 +11,7 @@ class CallLegRecording < MessageBird::Voice::Base # further processed attributes for convenience attr_accessor :_links, :uri + # Grab the URI to the downloadable file and provide it as a direct attribute def handle_links(links_object) @uri = links_object['file'] diff --git a/lib/messagebird/voice/list.rb b/lib/messagebird/voice/list.rb index 9cda249..b1a0414 100644 --- a/lib/messagebird/voice/list.rb +++ b/lib/messagebird/voice/list.rb @@ -6,6 +6,7 @@ module MessageBird module Voice class List < List attr_accessor :per_page, :current_page, :page_count, :total_count + PER_PAGE = 20 CURRENT_PAGE = 1 def data=(value) diff --git a/messagebird-rest.gemspec b/messagebird-rest.gemspec index 4ae55b2..e7976d3 100644 --- a/messagebird-rest.gemspec +++ b/messagebird-rest.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.name = 'messagebird-rest' s.version = MessageBird::Version::STRING s.platform = Gem::Platform::RUBY - s.required_ruby_version = '>= 2.0' + s.required_ruby_version = '>= 3.0' s.date = Time.now s.summary = "MessageBird's REST API" s.description = 'A simple REST API for MessageBird in Ruby' @@ -23,9 +23,9 @@ Gem::Specification.new do |s| s.files = Dir.glob('lib/**/*') + %w(LICENSE README.md) s.require_path = 'lib' - s.add_dependency "jwt", "~> 2.2.3" + s.add_dependency "jwt", "~> 2.3.0" - s.add_development_dependency "rspec", "~> 3.10.0" - s.add_development_dependency "rubocop", "~> 0.77.0" - s.add_development_dependency 'webmock', '~> 3.7.5' + s.add_development_dependency "rspec", "~> 3.11.0" + s.add_development_dependency "rubocop", "~> 1.26.1" + s.add_development_dependency 'webmock', '~> 3.14.0' end diff --git a/spec/call_flow_spec.rb b/spec/call_flow_spec.rb index 0ee59e4..6920fe1 100644 --- a/spec/call_flow_spec.rb +++ b/spec/call_flow_spec.rb @@ -89,17 +89,24 @@ createdAt: '2019-11-07T12:37:59Z', updatedAt: '2019-11-07T12:37:59Z' } - ] + ], + perPage: 2, + currentPage: 1, + totalCount: 111 } expect(voice_client) .to receive(:request) .with(:get, 'call-flows?perPage=2&page=1', {}) .and_return(mock_data.to_json) + list = client.call_flow_list(2, 1) expect(list.items.count).to eq 2 expect(list.items[0].id).to eq 'cfid-0000' + expect(list.per_page).to eq 2 + expect(list.current_page).to eq 1 + expect(list.total_count).to eq 111 end it 'view a call flow' do diff --git a/spec/call_spec.rb b/spec/call_spec.rb index 6384f17..248a36d 100644 --- a/spec/call_spec.rb +++ b/spec/call_spec.rb @@ -39,7 +39,7 @@ expect(voice_client) .to receive(:request) .with(:post, 'calls', { source: source, destination: destination, callFlow: call_flow.to_json }) - .and_return('{"data":[{"id":"' + call_id + '","status":"queued","source":"' + source + '","destination":"' + destination + '","createdAt":"2019-10-11T13:02:19Z","updatedAt":"2019-10-11T13:02:19Z","endedAt":null}],"_links":{"self":"/calls/' + call_id + '"},"pagination":{"total_count":0,"pageCount":0,"currentPage":0,"perPage":0}}') + .and_return(%({"data":[{"id":"#{call_id}","status":"queued","source":"#{source}","destination":"#{destination}","createdAt":"2019-10-11T13:02:19Z","updatedAt":"2019-10-11T13:02:19Z","endedAt":null}],"_links":{"self":"/calls/#{call_id}"},"pagination":{"total_count":0,"pageCount":0,"currentPage":0,"perPage":0}})) call = client.call_create(source, destination, call_flow) expect(call.id).to eq call_id end @@ -48,7 +48,7 @@ expect(voice_client) .to receive(:request) .with(:post, 'calls', { source: source, destination: destination, callFlow: call_flow.to_json, webhook: webhook.to_json }) - .and_return('{"data":[{"id":"' + call_id + '","status":"queued","source":"' + source + '","destination":"' + destination + '","createdAt":"2019-10-11T13:02:19Z","updatedAt":"2019-10-11T13:02:19Z","endedAt":null, "webhook":' + webhook.to_json + '}],"_links":{"self":"/calls/' + call_id + '"},"pagination":{"total_count":0,"pageCount":0,"currentPage":0,"perPage":0}}') + .and_return("{\"data\":[{\"id\":\"#{call_id}\",\"status\":\"queued\",\"source\":\"#{source}\",\"destination\":\"#{destination}\",\"createdAt\":\"2019-10-11T13:02:19Z\",\"updatedAt\":\"2019-10-11T13:02:19Z\",\"endedAt\":null, \"webhook\":#{webhook.to_json}}],\"_links\":{\"self\":\"/calls/#{call_id}\"},\"pagination\":{\"total_count\":0,\"pageCount\":0,\"currentPage\":0,\"perPage\":0}}") call = client.call_create(source, destination, call_flow, webhook) expect(call.id).to eq call_id expect(call.webhook.url).to eq webhook[:url] @@ -58,7 +58,7 @@ expect(voice_client) .to receive(:request) .with(:get, 'calls?perPage=20¤tPage=1', {}) - .and_return('{ "data": [ { "id": "f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58", "status": "ended", "source": "' + source + '", "destination": "31612345678", "createdAt": "2017-02-16T10:52:00Z", "updatedAt": "2017-02-16T10:59:04Z", "endedAt": "2017-02-16T10:59:04Z", "_links": { "self": "/calls/f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58" } }, { "id": "ac07a602-dbc1-11e6-bf26-cec0c932ce01", "status": "ended", "source": "' + source + '", "destination": "31612345678", "createdAt": "2017-01-16T07:51:56Z", "updatedAt": "2017-01-16T07:55:56Z", "endedAt": "2017-01-16T07:55:56Z", "webhook": ' + webhook.to_json + ',"_links": { "self": "/calls/ac07a602-dbc1-11e6-bf26-cec0c932ce01" } } ], "_links": { "self": "/calls?page=1" }, "pagination": { "total_count": 2, "pageCount": 1, "currentPage": 1, "perPage": 10 } }') + .and_return("{ \"data\": [ { \"id\": \"f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58\", \"status\": \"ended\", \"source\": \"#{source}\", \"destination\": \"31612345678\", \"createdAt\": \"2017-02-16T10:52:00Z\", \"updatedAt\": \"2017-02-16T10:59:04Z\", \"endedAt\": \"2017-02-16T10:59:04Z\", \"_links\": { \"self\": \"/calls/f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58\" } }, { \"id\": \"ac07a602-dbc1-11e6-bf26-cec0c932ce01\", \"status\": \"ended\", \"source\": \"#{source}\", \"destination\": \"31612345678\", \"createdAt\": \"2017-01-16T07:51:56Z\", \"updatedAt\": \"2017-01-16T07:55:56Z\", \"endedAt\": \"2017-01-16T07:55:56Z\", \"webhook\": #{webhook.to_json},\"_links\": { \"self\": \"/calls/ac07a602-dbc1-11e6-bf26-cec0c932ce01\" } } ], \"_links\": { \"self\": \"/calls?page=1\" }, \"pagination\": { \"total_count\": 2, \"pageCount\": 1, \"currentPage\": 1, \"perPage\": 10 } }") list = client.call_list expect(list.items).not_to be_nil @@ -102,14 +102,14 @@ expect(voice_client) .to receive(:request) .with(:get, "calls/#{call_id}/legs?perPage=#{MessageBird::Voice::List::PER_PAGE}¤tPage=#{MessageBird::Voice::List::CURRENT_PAGE}", {}) - .and_return(' + .and_return(%( { "data": [ { - "id": "' + leg_id + '", - "callId": "' + call_id + '", - "source": "' + source + '", - "destination": "' + destination + '", + "id": "#{leg_id}", + "callId": "#{call_id}", + "source": "#{source}", + "destination": "#{destination}", "service": 1, "status": "hangup", "direction": "outgoing", @@ -121,12 +121,12 @@ "answeredAt": "2019-12-03T14:50:50Z", "endedAt": "2019-12-03T14:51:00Z", "_links": { - "self": "/calls/' + call_id + '/legs/' + leg_id + '" + "self": "/calls/#{call_id}/legs/#{leg_id}" } } ], "_links": { - "self": "/calls/' + call_id + '/legs?page=1" + "self": "/calls/#{call_id}/legs?page=1" }, "pagination": { "totalCount": 1, @@ -134,7 +134,7 @@ "currentPage": 1, "perPage": 10 } - }') + })) legs = client.call_leg_list(call_id) expect(legs[0].id).to eq leg_id @@ -144,13 +144,13 @@ expect(voice_client) .to receive(:request) .with(:get, "calls/#{call_id}/legs/#{leg_id}/recordings", {}) - .and_return(' + .and_return(%( { "data": [ { - "id": "' + recording_id + '", + "id": "#{recording_id}", "format": "wav", - "legId": "' + leg_id + '", + "legId": "#{leg_id}", "status": "done", "duration": 5, "type": "ivr", @@ -158,13 +158,13 @@ "updatedAt": "2019-12-03T14:51:00Z", "deletedAt": null, "_links": { - "file": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '.wav", - "self": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '" + "file": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}.wav", + "self": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}" } } ], "_links": { - "self": "/calls/' + call_id + '/legs/' + leg_id + '/recordings?page=1" + "self": "/calls/#{call_id}'/legs/#{leg_id}/recordings?page=1" }, "pagination": { "totalCount": 1, @@ -172,23 +172,23 @@ "currentPage": 1, "perPage": 10 } - }') + })) records = client.call_leg_recording_list(call_id, leg_id) - expect(records[0].uri).to eq '/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '.wav' + expect(records[0].uri).to eq "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}.wav" end it 'view a call recording' do expect(voice_client) .to receive(:request) .with(:get, "calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}", {}) - .and_return(' + .and_return(%( { "data": [ { - "id": "' + recording_id + '", + "id": "#{recording_id}", "format": "wav", - "legId": "' + leg_id + '", + "legId": "#{leg_id}", "status": "done", "duration": 12, "type": "call", @@ -198,8 +198,8 @@ } ], "_links": { - "file": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '.wav", - "self": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '" + "file": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}.wav", + "self": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}" }, "pagination": { "totalCount": 0, @@ -207,15 +207,15 @@ "currentPage": 0, "perPage": 0 } - }') + })) recording = client.call_leg_recording_view(call_id, leg_id, recording_id) - expect(recording.uri).to eq '/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '.wav' + expect(recording.uri).to eq "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}.wav" end it 'download a call recording' do mock_response = double(Net::HTTPResponse) - recording_uri = '/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '.wav' + recording_uri = "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}.wav" expect(voice_client) .to receive(:request_block) @@ -245,23 +245,23 @@ expect(voice_client) .to receive(:request) .with(:post, "calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions", language.to_json) - .and_return(' + .and_return(%( { "data": [ { - "id":"' + transcription_id + '", - "recordingId":"' + recording_id + '", - "error": null,"destination":"' + destination + '", + "id":"#{transcription_id}", + "recordingId":"#{recording_id}", + "error": null,"destination":"#{destination}", "createdAt":"2017-06-20T10:03:14Z", "updatedAt": "2017-06-20T10:03:14Z" } ], "_links": { - "file": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '.txt", - "self": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '" + "file": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}.txt", + "self": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}" }, "pagination":{"total_count":0,"pageCount":0,"currentPage":0,"perPage":0} - }') + })) transcription = client.voice_transcription_create(call_id, leg_id, recording_id, language.to_json) expect(transcription.id).to eq transcription_id end @@ -270,20 +270,20 @@ expect(voice_client) .to receive(:request) .with(:get, "calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}", {}) - .and_return(' + .and_return(%( { "data": [ { - "id": "' + transcription_id + '", - "recordingId": "' + recording_id + '", + "id": "#{transcription_id}", + "recordingId": "#{recording_id}", "error": null, "createdAt": "2017-06-20T10:03:14Z", "updatedAt": "2017-06-20T10:03:14Z" } ], "_links": { - "file": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '.txt", - "self": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '" + "file": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}.txt", + "self": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}" }, "pagination": { "totalCount": 1, @@ -291,34 +291,34 @@ "currentPage": 1, "perPage": 10 } - }') + })) transcription = client.voice_transcription_view(call_id, leg_id, recording_id, transcription_id) - expect(transcription.uri).to eq '/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '.txt' + expect(transcription.uri).to eq "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}.txt" end it 'list transcriptions' do expect(voice_client) .to receive(:request) .with(:get, "calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions", {}) - .and_return(' + .and_return(%( { "data": [ { - "id":"' + transcription_id + '", - "recordingId": "' + recording_id + '", + "id":"#{transcription_id}", + "recordingId": "#{recording_id}", "status":"done", "createdAt":"2019-12-04T16:52:51Z", "updatedAt":"2019-12-04T16:53:02Z", "legId":"00000000-0000-0000-0000-000000000000", "_links": { - "file":"/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '.txt", - "self":"/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '" + "file":"/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}.txt", + "self":"/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}" } } ], "_links": { - "self": "/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '" + "self": "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}" }, "pagination": { "totalCount": 1, @@ -326,15 +326,15 @@ "currentPage": 1, "perPage": 10 } - }') + })) records = client.voice_transcriptions_list(call_id, leg_id, recording_id) - expect(records[0].uri).to eq '/calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '.txt' + expect(records[0].uri).to eq "/calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}.txt" end it 'download a transcription' do mock_response = double(Net::HTTPResponse) - transcription_uri = 'calls/' + call_id + '/legs/' + leg_id + '/recordings/' + recording_id + '/transcriptions/' + transcription_id + '.txt' + transcription_uri = "calls/#{call_id}/legs/#{leg_id}/recordings/#{recording_id}/transcriptions/#{transcription_id}.txt" expect(voice_client) .to receive(:request_block)