bandwidth-sdk 18.1.1 → 18.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,8 @@ describe Bandwidth::RbmSuggestionResponse do
3
3
  let(:rbm_suggestion_response_default) { Bandwidth::RbmSuggestionResponse.new }
4
4
  let(:rbm_suggestion_response_values) { Bandwidth::RbmSuggestionResponse.new({
5
5
  text: 'Yes',
6
- postback_data: 'reply_yes'
6
+ postback_data: 'reply_yes',
7
+ paired_message_id: 'paired_message_123'
7
8
  }) }
8
9
 
9
10
  describe '#initialize' do
@@ -28,7 +29,7 @@ describe Bandwidth::RbmSuggestionResponse do
28
29
 
29
30
  describe '#openapi_nullable' do
30
31
  it 'expects nullable attributes to be an empty set' do
31
- expect(Bandwidth::RbmSuggestionResponse.openapi_nullable).to eq(Set.new([]))
32
+ expect(Bandwidth::RbmSuggestionResponse.openapi_nullable).to eq(Set.new([:paired_message_id]))
32
33
  end
33
34
  end
34
35
 
@@ -36,17 +37,19 @@ describe Bandwidth::RbmSuggestionResponse do
36
37
  it 'validates instance of RbmSuggestionResponse created by the build_from_hash method' do
37
38
  rbm_suggestion_response_from_hash = Bandwidth::RbmSuggestionResponse.build_from_hash({
38
39
  text: 'Yes',
39
- postbackData: 'reply_yes'
40
+ postbackData: 'reply_yes',
41
+ pairedMessageId: 'paired_message_123'
40
42
  })
41
43
  expect(rbm_suggestion_response_from_hash).to be_instance_of(Bandwidth::RbmSuggestionResponse)
42
44
  expect(rbm_suggestion_response_from_hash.text).to eq('Yes')
43
45
  expect(rbm_suggestion_response_from_hash.postback_data).to eq('reply_yes')
46
+ expect(rbm_suggestion_response_from_hash.paired_message_id).to eq('paired_message_123')
44
47
  end
45
48
  end
46
49
 
47
50
  describe '#to_s' do
48
51
  it 'returns a string representation of the object' do
49
- expect(rbm_suggestion_response_values.to_s).to eq('{:text=>"Yes", :postbackData=>"reply_yes"}')
52
+ expect(rbm_suggestion_response_values.to_s).to eq('{:text=>"Yes", :postbackData=>"reply_yes", :pairedMessageId=>"paired_message_123"}')
50
53
  end
51
54
  end
52
55
 
@@ -61,7 +64,8 @@ describe Bandwidth::RbmSuggestionResponse do
61
64
  it 'returns a hash representation of the object' do
62
65
  expect(rbm_suggestion_response_values.to_body).to eq({
63
66
  text: 'Yes',
64
- postbackData: 'reply_yes'
67
+ postbackData: 'reply_yes',
68
+ pairedMessageId: 'paired_message_123'
65
69
  })
66
70
  end
67
71
  end
@@ -0,0 +1,96 @@
1
+ # Unit tests for Bandwidth::RecordingTranscriptionClip
2
+ describe Bandwidth::RecordingTranscriptionClip do
3
+ let(:recording_transcription_clip_default) { Bandwidth::RecordingTranscriptionClip.new }
4
+ let(:recording_transcription_clip_values) { Bandwidth::RecordingTranscriptionClip.new({
5
+ speaker: 0,
6
+ text: 'Hello world',
7
+ confidence: 0.9,
8
+ start_time_seconds: 1.5,
9
+ end_time_seconds: 3.2
10
+ }) }
11
+
12
+ describe '#initialize' do
13
+ it 'causes an ArgumentError by passing an Array to the initialize method' do
14
+ expect {
15
+ Bandwidth::RecordingTranscriptionClip.new([])
16
+ }.to raise_error(ArgumentError)
17
+ end
18
+
19
+ it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
20
+ expect {
21
+ Bandwidth::RecordingTranscriptionClip.new({ invalid: true })
22
+ }.to raise_error(ArgumentError)
23
+ end
24
+ end
25
+
26
+ describe '#acceptable_attributes' do
27
+ it 'expects acceptable JSON attributes to be those in the attribute map' do
28
+ expect(Bandwidth::RecordingTranscriptionClip.acceptable_attributes).to eq(Bandwidth::RecordingTranscriptionClip.attribute_map.values)
29
+ end
30
+ end
31
+
32
+ describe '#openapi_nullable' do
33
+ it 'expects nullable attributes to be an empty set' do
34
+ expect(Bandwidth::RecordingTranscriptionClip.openapi_nullable).to eq(Set.new([]))
35
+ end
36
+ end
37
+
38
+ describe '#build_from_hash' do
39
+ it 'validates instance of RecordingTranscriptionClip created by the build_from_hash method' do
40
+ recording_transcription_clip_from_hash = Bandwidth::RecordingTranscriptionClip.build_from_hash({
41
+ speaker: 0,
42
+ text: 'Hello world',
43
+ confidence: 0.9,
44
+ startTimeSeconds: 1.5,
45
+ endTimeSeconds: 3.2
46
+ })
47
+ expect(recording_transcription_clip_from_hash).to be_instance_of(Bandwidth::RecordingTranscriptionClip)
48
+ expect(recording_transcription_clip_from_hash.speaker).to eq(0)
49
+ expect(recording_transcription_clip_from_hash.text).to eq('Hello world')
50
+ expect(recording_transcription_clip_from_hash.confidence).to eq(0.9)
51
+ expect(recording_transcription_clip_from_hash.start_time_seconds).to eq(1.5)
52
+ expect(recording_transcription_clip_from_hash.end_time_seconds).to eq(3.2)
53
+ end
54
+ end
55
+
56
+ describe '#to_s' do
57
+ it 'returns a string representation of the object' do
58
+ expect(recording_transcription_clip_values.to_s).to eq('{:speaker=>0, :text=>"Hello world", :confidence=>0.9, :startTimeSeconds=>1.5, :endTimeSeconds=>3.2}')
59
+ end
60
+ end
61
+
62
+ describe '#eq? #==' do
63
+ it 'returns true/false when comparing objects' do
64
+ expect(recording_transcription_clip_default.eql?(Bandwidth::RecordingTranscriptionClip.new)).to be true
65
+ expect(recording_transcription_clip_default.eql?(recording_transcription_clip_values)).to be false
66
+ end
67
+ end
68
+
69
+ describe '#to_body #to_hash' do
70
+ it 'returns a hash representation of the object' do
71
+ expect(recording_transcription_clip_values.to_body).to eq({
72
+ speaker: 0,
73
+ text: 'Hello world',
74
+ confidence: 0.9,
75
+ startTimeSeconds: 1.5,
76
+ endTimeSeconds: 3.2
77
+ })
78
+ end
79
+ end
80
+
81
+ describe 'custom attribute writers' do
82
+ it '#confidence=' do
83
+ expect {
84
+ Bandwidth::RecordingTranscriptionClip.new({ confidence: nil })
85
+ }.to raise_error(ArgumentError, 'confidence cannot be nil')
86
+
87
+ expect {
88
+ Bandwidth::RecordingTranscriptionClip.new({ confidence: 1.5 })
89
+ }.to raise_error(ArgumentError, 'invalid value for "confidence", must be smaller than or equal to 1.')
90
+
91
+ expect {
92
+ Bandwidth::RecordingTranscriptionClip.new({ confidence: -0.5 })
93
+ }.to raise_error(ArgumentError, 'invalid value for "confidence", must be greater than or equal to 0.')
94
+ end
95
+ end
96
+ end
@@ -3,7 +3,20 @@ describe Bandwidth::RecordingTranscriptions do
3
3
  let(:recording_transcriptions_default) { Bandwidth::RecordingTranscriptions.new }
4
4
  let(:recording_transcriptions_values) { Bandwidth::RecordingTranscriptions.new({
5
5
  transcripts: [
6
- Bandwidth::Transcription.new({ text: 'Hello World! Thank you for calling.', confidence: 0.9 })
6
+ Bandwidth::Transcription.new({
7
+ speaker: 1,
8
+ text: 'Hello World! Thank you for calling.',
9
+ confidence: 0.9
10
+ })
11
+ ],
12
+ clips: [
13
+ Bandwidth::RecordingTranscriptionClip.new({
14
+ speaker: 1,
15
+ text: 'Hello World! Thank you for calling.',
16
+ confidence: 0.9,
17
+ start_time_seconds: 1.0,
18
+ end_time_seconds: 5.0
19
+ })
7
20
  ]
8
21
  }) }
9
22
 
@@ -36,19 +49,28 @@ describe Bandwidth::RecordingTranscriptions do
36
49
  describe '#build_from_hash' do
37
50
  it 'validates instance of RecordingTranscriptions created by the build_from_hash method' do
38
51
  recording_transcriptions_from_hash = Bandwidth::RecordingTranscriptions.build_from_hash({
39
- transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9 }]
52
+ transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9, speaker: 1 }],
53
+ clips: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9, speaker: 1, startTimeSeconds: 1.0, endTimeSeconds: 5.0 }]
40
54
  })
41
55
  expect(recording_transcriptions_from_hash).to be_instance_of(Bandwidth::RecordingTranscriptions)
42
56
  expect(recording_transcriptions_from_hash.transcripts).to be_instance_of(Array)
43
57
  expect(recording_transcriptions_from_hash.transcripts.first).to be_instance_of(Bandwidth::Transcription)
58
+ expect(recording_transcriptions_from_hash.transcripts.first.speaker).to eq(1)
44
59
  expect(recording_transcriptions_from_hash.transcripts.first.text).to eq('Hello World! Thank you for calling.')
45
60
  expect(recording_transcriptions_from_hash.transcripts.first.confidence).to eq(0.9)
61
+ expect(recording_transcriptions_from_hash.clips).to be_instance_of(Array)
62
+ expect(recording_transcriptions_from_hash.clips.first).to be_instance_of(Bandwidth::RecordingTranscriptionClip)
63
+ expect(recording_transcriptions_from_hash.clips.first.speaker).to eq(1)
64
+ expect(recording_transcriptions_from_hash.clips.first.text).to eq('Hello World! Thank you for calling.')
65
+ expect(recording_transcriptions_from_hash.clips.first.confidence).to eq(0.9)
66
+ expect(recording_transcriptions_from_hash.clips.first.start_time_seconds).to eq(1.0)
67
+ expect(recording_transcriptions_from_hash.clips.first.end_time_seconds).to eq(5.0)
46
68
  end
47
69
  end
48
70
 
49
71
  describe '#to_s' do
50
72
  it 'returns a string representation of the object' do
51
- expect(recording_transcriptions_values.to_s).to eq('{:transcripts=>[{:text=>"Hello World! Thank you for calling.", :confidence=>0.9}]}')
73
+ expect(recording_transcriptions_values.to_s).to eq('{:transcripts=>[{:speaker=>1, :text=>"Hello World! Thank you for calling.", :confidence=>0.9}], :clips=>[{:speaker=>1, :text=>"Hello World! Thank you for calling.", :confidence=>0.9, :startTimeSeconds=>1.0, :endTimeSeconds=>5.0}]}')
52
74
  end
53
75
  end
54
76
 
@@ -62,7 +84,8 @@ describe Bandwidth::RecordingTranscriptions do
62
84
  describe '#to_body #to_hash' do
63
85
  it 'returns a hash representation of the object' do
64
86
  expect(recording_transcriptions_values.to_body).to eq({
65
- transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9 }]
87
+ transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9, speaker: 1 }],
88
+ clips: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9, speaker: 1, startTimeSeconds: 1.0, endTimeSeconds: 5.0 }]
66
89
  })
67
90
  end
68
91
  end
@@ -6,6 +6,8 @@ describe Bandwidth::TfvStatus do
6
6
  status: Bandwidth::TfvStatusEnum::VERIFIED,
7
7
  internal_ticket_number: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
8
8
  decline_reason_description: 'The reason for declining',
9
+ denial_status_code: 100,
10
+ additional_denial_reasons: [Bandwidth::AdditionalDenialReason.new({ status_code: 100, reason: 'reason text', resubmit_allowed: true })],
9
11
  resubmit_allowed: false,
10
12
  created_date_time: '2024-01-01T00:00:00Z',
11
13
  modified_date_time: '2024-01-02T00:00:00Z',
@@ -37,7 +39,11 @@ describe Bandwidth::TfvStatus do
37
39
 
38
40
  describe '#openapi_nullable' do
39
41
  it 'expects nullable attributes to be the set of nullable fields' do
40
- expect(Bandwidth::TfvStatus.openapi_nullable).to eq(Set.new([:'cv_token']))
42
+ expect(Bandwidth::TfvStatus.openapi_nullable).to eq(Set.new([
43
+ :'denial_status_code',
44
+ :'additional_denial_reasons',
45
+ :'cv_token'
46
+ ]))
41
47
  end
42
48
  end
43
49
 
@@ -48,6 +54,8 @@ describe Bandwidth::TfvStatus do
48
54
  status: Bandwidth::TfvStatusEnum::VERIFIED,
49
55
  internalTicketNumber: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
50
56
  declineReasonDescription: 'The reason for declining',
57
+ denialStatusCode: 100,
58
+ additionalDenialReasons: [{ statusCode: 100, reason: 'reason text', resubmitAllowed: true }],
51
59
  resubmitAllowed: false,
52
60
  createdDateTime: '2024-01-01T00:00:00Z',
53
61
  modifiedDateTime: '2024-01-02T00:00:00Z',
@@ -61,6 +69,8 @@ describe Bandwidth::TfvStatus do
61
69
  expect(tfv_status_from_hash.status).to eq(Bandwidth::TfvStatusEnum::VERIFIED)
62
70
  expect(tfv_status_from_hash.internal_ticket_number).to eq('8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3')
63
71
  expect(tfv_status_from_hash.decline_reason_description).to eq('The reason for declining')
72
+ expect(tfv_status_from_hash.denial_status_code).to eq(100)
73
+ expect(tfv_status_from_hash.additional_denial_reasons.first).to be_instance_of(Bandwidth::AdditionalDenialReason)
64
74
  expect(tfv_status_from_hash.resubmit_allowed).to eq(false)
65
75
  expect(tfv_status_from_hash.created_date_time).to eq(Time.parse('2024-01-01T00:00:00Z'))
66
76
  expect(tfv_status_from_hash.modified_date_time).to eq(Time.parse('2024-01-02T00:00:00Z'))
@@ -73,7 +83,7 @@ describe Bandwidth::TfvStatus do
73
83
 
74
84
  describe '#to_s' do
75
85
  it 'returns a string representation of the object' do
76
- expect(tfv_status_values.to_s).to eq('{:phoneNumber=>"+18005554321", :status=>"VERIFIED", :internalTicketNumber=>"8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3", :declineReasonDescription=>"The reason for declining", :resubmitAllowed=>false, :createdDateTime=>"2024-01-01T00:00:00Z", :modifiedDateTime=>"2024-01-02T00:00:00Z", :submission=>{:businessAddress=>{:name=>"Bandwidth"}}, :blocked=>false, :blockedReason=>"The reason for blocking", :cvToken=>"cv_token_value"}')
86
+ expect(tfv_status_values.to_s).to eq('{:phoneNumber=>"+18005554321", :status=>"VERIFIED", :internalTicketNumber=>"8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3", :declineReasonDescription=>"The reason for declining", :denialStatusCode=>100, :additionalDenialReasons=>[{:statusCode=>100, :reason=>"reason text", :resubmitAllowed=>true}], :resubmitAllowed=>false, :createdDateTime=>"2024-01-01T00:00:00Z", :modifiedDateTime=>"2024-01-02T00:00:00Z", :submission=>{:businessAddress=>{:name=>"Bandwidth"}}, :blocked=>false, :blockedReason=>"The reason for blocking", :cvToken=>"cv_token_value"}')
77
87
  end
78
88
  end
79
89
 
@@ -91,6 +101,8 @@ describe Bandwidth::TfvStatus do
91
101
  status: Bandwidth::TfvStatusEnum::VERIFIED,
92
102
  internalTicketNumber: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
93
103
  declineReasonDescription: 'The reason for declining',
104
+ denialStatusCode: 100,
105
+ additionalDenialReasons: [{ statusCode: 100, reason: 'reason text', resubmitAllowed: true }],
94
106
  resubmitAllowed: false,
95
107
  createdDateTime: '2024-01-01T00:00:00Z',
96
108
  modifiedDateTime: '2024-01-02T00:00:00Z',
@@ -2,6 +2,7 @@
2
2
  describe Bandwidth::Transcription do
3
3
  let(:transcription_default) { Bandwidth::Transcription.new }
4
4
  let(:transcription_values) { Bandwidth::Transcription.new({
5
+ speaker: 1,
5
6
  text: 'Hello World! Thank you for calling.',
6
7
  confidence: 0.9
7
8
  }) }
@@ -35,10 +36,12 @@ describe Bandwidth::Transcription do
35
36
  describe '#build_from_hash' do
36
37
  it 'validates instance of Transcription created by the build_from_hash method' do
37
38
  transcription_from_hash = Bandwidth::Transcription.build_from_hash({
39
+ speaker: 1,
38
40
  text: 'Hello World! Thank you for calling.',
39
41
  confidence: 0.9
40
42
  })
41
43
  expect(transcription_from_hash).to be_instance_of(Bandwidth::Transcription)
44
+ expect(transcription_from_hash.speaker).to eq(1)
42
45
  expect(transcription_from_hash.text).to eq('Hello World! Thank you for calling.')
43
46
  expect(transcription_from_hash.confidence).to eq(0.9)
44
47
  end
@@ -46,7 +49,7 @@ describe Bandwidth::Transcription do
46
49
 
47
50
  describe '#to_s' do
48
51
  it 'returns a string representation of the object' do
49
- expect(transcription_values.to_s).to eq('{:text=>"Hello World! Thank you for calling.", :confidence=>0.9}')
52
+ expect(transcription_values.to_s).to eq('{:speaker=>1, :text=>"Hello World! Thank you for calling.", :confidence=>0.9}')
50
53
  end
51
54
  end
52
55
 
@@ -60,6 +63,7 @@ describe Bandwidth::Transcription do
60
63
  describe '#to_body #to_hash' do
61
64
  it 'returns a hash representation of the object' do
62
65
  expect(transcription_values.to_body).to eq({
66
+ speaker: 1,
63
67
  text: 'Hello World! Thank you for calling.',
64
68
  confidence: 0.9
65
69
  })