freeclimb 4.4.4 → 4.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +1 -1
- data/LICENSE.txt +10 -0
- data/README.md +6 -4
- data/docs/SMSTenDLCCampaign.md +1 -1
- data/docs/TranscribeUtterance.md +28 -0
- data/docs/TranscribeUtteranceRecord.md +22 -0
- data/lib/freeclimb/models/transcribe_utterance.rb +299 -0
- data/lib/freeclimb/models/transcribe_utterance_record.rb +293 -0
- data/lib/freeclimb/version.rb +1 -1
- data/lib/freeclimb.rb +2 -0
- data/openapi.json +73 -0
- data/spec/api/default_api_spec.rb +13 -1
- data/spec/models/transcribe_utterance_record_spec.rb +222 -0
- data/spec/models/transcribe_utterance_spec.rb +380 -0
- metadata +11 -2
@@ -0,0 +1,293 @@
|
|
1
|
+
=begin
|
2
|
+
#FreeClimb API
|
3
|
+
|
4
|
+
#FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: support@freeclimb.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Freeclimb
|
17
|
+
class TranscribeUtteranceRecord
|
18
|
+
attr_accessor :save_recording
|
19
|
+
|
20
|
+
attr_accessor :max_length_sec
|
21
|
+
|
22
|
+
attr_accessor :rcrd_termination_silence_time_ms
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'save_recording' => :'saveRecording',
|
28
|
+
:'max_length_sec' => :'maxLengthSec',
|
29
|
+
:'rcrd_termination_silence_time_ms' => :'rcrdTerminationSilenceTimeMs'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'save_recording' => :'Boolean',
|
42
|
+
:'max_length_sec' => :'Integer',
|
43
|
+
:'rcrd_termination_silence_time_ms' => :'Integer'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
])
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
if (!attributes.is_a?(Hash))
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::TranscribeUtteranceRecord` initialize method"
|
58
|
+
end
|
59
|
+
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::TranscribeUtteranceRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
64
|
+
end
|
65
|
+
h[k.to_sym] = v
|
66
|
+
}
|
67
|
+
|
68
|
+
if attributes.key?(:'save_recording')
|
69
|
+
self.save_recording = attributes[:'save_recording']
|
70
|
+
else
|
71
|
+
self.save_recording = false
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'max_length_sec')
|
75
|
+
self.max_length_sec = attributes[:'max_length_sec']
|
76
|
+
else
|
77
|
+
self.max_length_sec = 60
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'rcrd_termination_silence_time_ms')
|
81
|
+
self.rcrd_termination_silence_time_ms = attributes[:'rcrd_termination_silence_time_ms']
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
86
|
+
# @return Array for valid properties with the reasons
|
87
|
+
def list_invalid_properties
|
88
|
+
invalid_properties = Array.new
|
89
|
+
if !@max_length_sec.nil? && @max_length_sec > 60
|
90
|
+
invalid_properties.push('invalid value for "max_length_sec", must be smaller than or equal to 60.')
|
91
|
+
end
|
92
|
+
|
93
|
+
if !@max_length_sec.nil? && @max_length_sec < 1
|
94
|
+
invalid_properties.push('invalid value for "max_length_sec", must be greater than or equal to 1.')
|
95
|
+
end
|
96
|
+
|
97
|
+
if !@rcrd_termination_silence_time_ms.nil? && @rcrd_termination_silence_time_ms > 3000
|
98
|
+
invalid_properties.push('invalid value for "rcrd_termination_silence_time_ms", must be smaller than or equal to 3000.')
|
99
|
+
end
|
100
|
+
|
101
|
+
if !@rcrd_termination_silence_time_ms.nil? && @rcrd_termination_silence_time_ms <= 0
|
102
|
+
invalid_properties.push('invalid value for "rcrd_termination_silence_time_ms", must be greater than 0.')
|
103
|
+
end
|
104
|
+
|
105
|
+
invalid_properties
|
106
|
+
end
|
107
|
+
|
108
|
+
# Check to see if the all the properties in the model are valid
|
109
|
+
# @return true if the model is valid
|
110
|
+
def valid?
|
111
|
+
|
112
|
+
if @save_recording.nil?
|
113
|
+
false
|
114
|
+
elsif @max_length_sec.nil?
|
115
|
+
false
|
116
|
+
elsif @rcrd_termination_silence_time_ms.nil?
|
117
|
+
false
|
118
|
+
else
|
119
|
+
list_invalid_properties.length() == 0
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Custom attribute writer method with validation
|
124
|
+
# @param [Object] max_length_sec Value to be assigned
|
125
|
+
def max_length_sec=(max_length_sec)
|
126
|
+
if !max_length_sec.nil? && max_length_sec > 60
|
127
|
+
fail ArgumentError, 'invalid value for "max_length_sec", must be smaller than or equal to 60.'
|
128
|
+
end
|
129
|
+
|
130
|
+
if !max_length_sec.nil? && max_length_sec < 1
|
131
|
+
fail ArgumentError, 'invalid value for "max_length_sec", must be greater than or equal to 1.'
|
132
|
+
end
|
133
|
+
|
134
|
+
@max_length_sec = max_length_sec
|
135
|
+
end
|
136
|
+
|
137
|
+
# Custom attribute writer method with validation
|
138
|
+
# @param [Object] rcrd_termination_silence_time_ms Value to be assigned
|
139
|
+
def rcrd_termination_silence_time_ms=(rcrd_termination_silence_time_ms)
|
140
|
+
if !rcrd_termination_silence_time_ms.nil? && rcrd_termination_silence_time_ms > 3000
|
141
|
+
fail ArgumentError, 'invalid value for "rcrd_termination_silence_time_ms", must be smaller than or equal to 3000.'
|
142
|
+
end
|
143
|
+
|
144
|
+
if !rcrd_termination_silence_time_ms.nil? && rcrd_termination_silence_time_ms <= 0
|
145
|
+
fail ArgumentError, 'invalid value for "rcrd_termination_silence_time_ms", must be greater than 0.'
|
146
|
+
end
|
147
|
+
|
148
|
+
@rcrd_termination_silence_time_ms = rcrd_termination_silence_time_ms
|
149
|
+
end
|
150
|
+
|
151
|
+
# Checks equality by comparing each attribute.
|
152
|
+
# @param [Object] Object to be compared
|
153
|
+
def ==(o)
|
154
|
+
return true if self.equal?(o)
|
155
|
+
self.class == o.class &&
|
156
|
+
save_recording == o.save_recording &&
|
157
|
+
max_length_sec == o.max_length_sec &&
|
158
|
+
rcrd_termination_silence_time_ms == o.rcrd_termination_silence_time_ms
|
159
|
+
end
|
160
|
+
|
161
|
+
# @see the `==` method
|
162
|
+
# @param [Object] Object to be compared
|
163
|
+
def eql?(o)
|
164
|
+
self == o
|
165
|
+
end
|
166
|
+
|
167
|
+
# Calculates hash code according to all attributes.
|
168
|
+
# @return [Integer] Hash code
|
169
|
+
def hash
|
170
|
+
[save_recording, max_length_sec, rcrd_termination_silence_time_ms].hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Builds the object from hash
|
174
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
175
|
+
# @return [Object] Returns the model itself
|
176
|
+
def self.build_from_hash(attributes)
|
177
|
+
new.build_from_hash(attributes)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Builds the object from hash
|
181
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
182
|
+
# @return [Object] Returns the model itself
|
183
|
+
def build_from_hash(attributes)
|
184
|
+
return nil unless attributes.is_a?(Hash)
|
185
|
+
self.class.openapi_types.each_pair do |key, type|
|
186
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
187
|
+
self.send("#{key}=", nil)
|
188
|
+
elsif type =~ /\AArray<(.*)>/i
|
189
|
+
# check to ensure the input is an array given that the attribute
|
190
|
+
# is documented as an array but the input is not
|
191
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
192
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
193
|
+
end
|
194
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
195
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
# Deserializes the data based on type
|
203
|
+
# @param string type Data type
|
204
|
+
# @param string value Value to be deserialized
|
205
|
+
# @return [Object] Deserialized data
|
206
|
+
def _deserialize(type, value)
|
207
|
+
case type.to_sym
|
208
|
+
when :Time
|
209
|
+
Time.parse(value)
|
210
|
+
when :Date
|
211
|
+
Date.parse(value)
|
212
|
+
when :String
|
213
|
+
value.to_s
|
214
|
+
when :Integer
|
215
|
+
value.to_i
|
216
|
+
when :Float
|
217
|
+
value.to_f
|
218
|
+
when :Boolean
|
219
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
220
|
+
true
|
221
|
+
else
|
222
|
+
false
|
223
|
+
end
|
224
|
+
when :Object
|
225
|
+
# generic object (usually a Hash), return directly
|
226
|
+
value
|
227
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
228
|
+
inner_type = Regexp.last_match[:inner_type]
|
229
|
+
value.map { |v| _deserialize(inner_type, v) }
|
230
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
231
|
+
k_type = Regexp.last_match[:k_type]
|
232
|
+
v_type = Regexp.last_match[:v_type]
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each do |k, v|
|
235
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
else # model
|
239
|
+
# models (e.g. Pet) or oneOf
|
240
|
+
klass = Freeclimb.const_get(type)
|
241
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns the string representation of the object
|
246
|
+
# @return [String] String presentation of the object
|
247
|
+
def to_s
|
248
|
+
to_hash.to_s
|
249
|
+
end
|
250
|
+
|
251
|
+
# to_body is an alias to to_hash (backward compatibility)
|
252
|
+
# @return [Hash] Returns the object in the form of hash
|
253
|
+
def to_body
|
254
|
+
to_hash
|
255
|
+
end
|
256
|
+
|
257
|
+
# Returns the object in the form of hash
|
258
|
+
# @return [Hash] Returns the object in the form of hash
|
259
|
+
def to_hash
|
260
|
+
hash = {}
|
261
|
+
self.class.attribute_map.each_pair do |attr, param|
|
262
|
+
value = self.send(attr)
|
263
|
+
if value.nil?
|
264
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
265
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
266
|
+
end
|
267
|
+
|
268
|
+
hash[param] = _to_hash(value)
|
269
|
+
end
|
270
|
+
hash
|
271
|
+
end
|
272
|
+
|
273
|
+
# Outputs non-array value in the form of hash
|
274
|
+
# For object, use to_hash. Otherwise, just return the value
|
275
|
+
# @param [Object] value Any valid value
|
276
|
+
# @return [Hash] Returns the value in the form of hash
|
277
|
+
def _to_hash(value)
|
278
|
+
if value.is_a?(Array)
|
279
|
+
value.compact.map { |v| _to_hash(v) }
|
280
|
+
elsif value.is_a?(Hash)
|
281
|
+
{}.tap do |hash|
|
282
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
283
|
+
end
|
284
|
+
elsif value.respond_to? :to_hash
|
285
|
+
value.to_hash
|
286
|
+
else
|
287
|
+
value
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|
292
|
+
|
293
|
+
end
|
data/lib/freeclimb/version.rb
CHANGED
data/lib/freeclimb.rb
CHANGED
@@ -125,6 +125,8 @@ require 'freeclimb/models/set_listen_all_of'
|
|
125
125
|
require 'freeclimb/models/set_talk_all_of'
|
126
126
|
require 'freeclimb/models/sms_all_of'
|
127
127
|
require 'freeclimb/models/terminate_conference_all_of'
|
128
|
+
require 'freeclimb/models/transcribe_utterance'
|
129
|
+
require 'freeclimb/models/transcribe_utterance_record'
|
128
130
|
require 'freeclimb/models/update_call_request'
|
129
131
|
require 'freeclimb/models/update_call_request_status'
|
130
132
|
require 'freeclimb/models/update_conference_participant_request'
|
data/openapi.json
CHANGED
@@ -467,6 +467,7 @@
|
|
467
467
|
"Sms": "#/components/schemas/Sms",
|
468
468
|
"StartRecordCall": "#/components/schemas/StartRecordCall",
|
469
469
|
"TerminateConference": "#/components/schemas/TerminateConference",
|
470
|
+
"TranscribeUtterance": "#/components/schemas/TranscribeUtterance",
|
470
471
|
"Unpark": "#/components/schemas/Unpark"
|
471
472
|
}
|
472
473
|
},
|
@@ -3262,6 +3263,78 @@
|
|
3262
3263
|
"identityStatus": "VERIFIED",
|
3263
3264
|
"createDate": "2022-07-01T20:29:23Z"
|
3264
3265
|
}
|
3266
|
+
},
|
3267
|
+
"TranscribeUtterance": {
|
3268
|
+
"title": "TranscribeUtterance",
|
3269
|
+
"x-stoplight": {
|
3270
|
+
"id": "u509r3zqc38ze"
|
3271
|
+
},
|
3272
|
+
"x-percl-command": true,
|
3273
|
+
"type": "object",
|
3274
|
+
"description": "The `TranscribeUtterance` command transcribes the caller’s voice and returns transcription of the audio and optionally returns the recording of the audio transcribed.\n\n`TranscribeUtterance` is blocking and is a terminal command. As such, the actionUrl property is required, and control of the Call picks up using the `PerCL` returned in response of the `actionUrl`. Recording and Transcription information is returned in the actionUrl request. If the reason this command ended was due to the call hanging up, any PerCL returned will not execute.",
|
3275
|
+
"properties": {
|
3276
|
+
"actionUrl": {
|
3277
|
+
"type": "string"
|
3278
|
+
},
|
3279
|
+
"playBeep": {
|
3280
|
+
"type": "boolean",
|
3281
|
+
"default": false
|
3282
|
+
},
|
3283
|
+
"record": {
|
3284
|
+
"type": "object",
|
3285
|
+
"properties": {
|
3286
|
+
"saveRecording": {
|
3287
|
+
"type": "boolean",
|
3288
|
+
"default": false
|
3289
|
+
},
|
3290
|
+
"maxLengthSec": {
|
3291
|
+
"type": "integer",
|
3292
|
+
"minimum": 1,
|
3293
|
+
"maximum": 60,
|
3294
|
+
"default": 60
|
3295
|
+
},
|
3296
|
+
"rcrdTerminationSilenceTimeMs": {
|
3297
|
+
"type": "integer",
|
3298
|
+
"exclusiveMinimum": true,
|
3299
|
+
"minimum": 0,
|
3300
|
+
"maximum": 3000
|
3301
|
+
}
|
3302
|
+
}
|
3303
|
+
},
|
3304
|
+
"privacyForLogging": {
|
3305
|
+
"type": "boolean",
|
3306
|
+
"default": false
|
3307
|
+
},
|
3308
|
+
"privacyForRecording": {
|
3309
|
+
"type": "boolean",
|
3310
|
+
"default": false
|
3311
|
+
},
|
3312
|
+
"prompts": {
|
3313
|
+
"type": "array",
|
3314
|
+
"items": {}
|
3315
|
+
}
|
3316
|
+
},
|
3317
|
+
"required": ["actionUrl"],
|
3318
|
+
"x-examples": {
|
3319
|
+
"Example 1": {
|
3320
|
+
"TranscribeUtterance": {
|
3321
|
+
"actionUrl": "http://foo.vail/handleTranscription",
|
3322
|
+
"record": {
|
3323
|
+
"maxLengthSec": 60,
|
3324
|
+
"saveRecording": true,
|
3325
|
+
"rcrdTerminationSilenceTimeMs": 2000
|
3326
|
+
},
|
3327
|
+
"playBeep": true,
|
3328
|
+
"prompts": [
|
3329
|
+
{
|
3330
|
+
"Play": {
|
3331
|
+
"file": "https://yoursite.com/path/to/please-record-greeting.wav"
|
3332
|
+
}
|
3333
|
+
}
|
3334
|
+
]
|
3335
|
+
}
|
3336
|
+
}
|
3337
|
+
}
|
3265
3338
|
}
|
3266
3339
|
}
|
3267
3340
|
},
|
@@ -222,6 +222,12 @@ describe 'DefaultApi' do
|
|
222
222
|
|
223
223
|
@has_campaign_list_incoming_numbers_test_value = true
|
224
224
|
|
225
|
+
@campaign_id_list_sms_messages_test_value = 'CX56XX4'
|
226
|
+
|
227
|
+
@brand_id_list_sms_messages_test_value = 'BX56XX4'
|
228
|
+
|
229
|
+
@is10_dlc_list_sms_messages_test_value = true
|
230
|
+
|
225
231
|
@queue_request_update_a_queue_test_value = Freeclimb::QueueRequest.new
|
226
232
|
|
227
233
|
@application_request_update_an_application_test_value = Freeclimb::ApplicationRequest.new
|
@@ -1256,6 +1262,9 @@ describe 'DefaultApi' do
|
|
1256
1262
|
# @option opts [String] :begin_time Only show Messages sent at or after this time (GMT), given as *YYYY-MM-DD hh:mm:ss*.
|
1257
1263
|
# @option opts [String] :end_time Only show messages sent at or before this time (GMT), given as *YYYY-MM-DD hh:mm*..
|
1258
1264
|
# @option opts [MessageDirection] :direction Either `inbound` or `outbound`. Only show Messages that were either *sent from* or *received by* FreeClimb.
|
1265
|
+
# @option opts [String] :campaign_id Only show messages associated with this campaign ID.
|
1266
|
+
# @option opts [String] :brand_id Only show messages associated with this brand ID
|
1267
|
+
# @option opts [Boolean] :is10_dlc Only show messages that were sent as part of a 10DLC campaign.
|
1259
1268
|
# @return [MessagesList]
|
1260
1269
|
describe 'list_sms_messages test' do
|
1261
1270
|
it 'should work' do
|
@@ -1265,11 +1274,14 @@ describe 'DefaultApi' do
|
|
1265
1274
|
begin_time = @begin_time_list_sms_messages_test_value
|
1266
1275
|
end_time = @end_time_list_sms_messages_test_value
|
1267
1276
|
direction = @direction_list_sms_messages_test_value
|
1277
|
+
campaign_id = @campaign_id_list_sms_messages_test_value
|
1278
|
+
brand_id = @brand_id_list_sms_messages_test_value
|
1279
|
+
is10_dlc = @is10_dlc_list_sms_messages_test_value
|
1268
1280
|
|
1269
1281
|
result = @api_instance.list_sms_messages(
|
1270
1282
|
|
1271
1283
|
{
|
1272
|
-
:to => to,:from => from,:begin_time => begin_time,:end_time => end_time,:direction => direction,
|
1284
|
+
:to => to,:from => from,:begin_time => begin_time,:end_time => end_time,:direction => direction,:campaign_id => campaign_id,:brand_id => brand_id,:is10_dlc => is10_dlc,
|
1273
1285
|
}
|
1274
1286
|
)
|
1275
1287
|
|
@@ -0,0 +1,222 @@
|
|
1
|
+
=begin
|
2
|
+
#FreeClimb API
|
3
|
+
|
4
|
+
#FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: support@freeclimb.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for Freeclimb::TranscribeUtteranceRecord
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe Freeclimb::TranscribeUtteranceRecord do
|
21
|
+
let(:instance) { Freeclimb::TranscribeUtteranceRecord.new }
|
22
|
+
|
23
|
+
describe 'test an instance of TranscribeUtteranceRecord' do
|
24
|
+
it 'should create an instance of TranscribeUtteranceRecord' do
|
25
|
+
expect(instance).to be_instance_of(Freeclimb::TranscribeUtteranceRecord)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test attribute "save_recording"' do
|
30
|
+
it 'should work' do
|
31
|
+
instance.save_recording = false
|
32
|
+
expect(instance.save_recording).to eq(false)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'test attribute "max_length_sec"' do
|
37
|
+
it 'should work' do
|
38
|
+
instance.max_length_sec = 1
|
39
|
+
expect(instance.max_length_sec).to eq(1)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'test attribute "rcrd_termination_silence_time_ms"' do
|
44
|
+
it 'should work' do
|
45
|
+
instance.rcrd_termination_silence_time_ms = 1
|
46
|
+
expect(instance.rcrd_termination_silence_time_ms).to eq(1)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'test method "initialize"' do
|
51
|
+
it 'properly initializes with values' do
|
52
|
+
expect{instance = Freeclimb::TranscribeUtteranceRecord.new(
|
53
|
+
save_recording: true,
|
54
|
+
max_length_sec: 1,
|
55
|
+
rcrd_termination_silence_time_ms: 1,
|
56
|
+
)}.not_to raise_error()
|
57
|
+
end
|
58
|
+
it 'fails to initialize with input argument that is not a hash in Freeclimb::TranscribeUtteranceRecord' do
|
59
|
+
expect{instance = Freeclimb::TranscribeUtteranceRecord.new(
|
60
|
+
save_recording: true,
|
61
|
+
max_length_sec: 1,
|
62
|
+
rcrd_termination_silence_time_ms: 1,
|
63
|
+
invalid_attribute: true
|
64
|
+
)}.to raise_error(ArgumentError)
|
65
|
+
end
|
66
|
+
it 'fails to initialize with invalid attribute' do
|
67
|
+
expect{instance = Freeclimb::TranscribeUtteranceRecord.new(
|
68
|
+
save_recording: true,
|
69
|
+
max_length_sec: 1,
|
70
|
+
rcrd_termination_silence_time_ms: 1,
|
71
|
+
invalid_attribute: true
|
72
|
+
)}.to raise_error(ArgumentError)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'test method "valid"' do
|
77
|
+
it 'checks if properties are valid' do
|
78
|
+
instance = Freeclimb::TranscribeUtteranceRecord.new(
|
79
|
+
save_recording: true,
|
80
|
+
max_length_sec: 1,
|
81
|
+
rcrd_termination_silence_time_ms: 1,
|
82
|
+
)
|
83
|
+
expect(instance.valid?).to eq(true)
|
84
|
+
end
|
85
|
+
it 'checks if properties are invalid' do
|
86
|
+
instance = Freeclimb::TranscribeUtteranceRecord.new(
|
87
|
+
save_recording: nil,
|
88
|
+
)
|
89
|
+
expect(instance.valid?).to eq(false)
|
90
|
+
end
|
91
|
+
it 'checks if model is empty' do
|
92
|
+
instance = Freeclimb::TranscribeUtteranceRecord.new()
|
93
|
+
expect(instance.valid?).to eq(false)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe 'test method "eql?"' do
|
98
|
+
it 'checks if objects are equal' do
|
99
|
+
obj = Object.new()
|
100
|
+
instance_1 = Freeclimb::TranscribeUtteranceRecord.new(
|
101
|
+
save_recording: true,
|
102
|
+
max_length_sec: 1,
|
103
|
+
rcrd_termination_silence_time_ms: 1,
|
104
|
+
)
|
105
|
+
instance_2 = Freeclimb::TranscribeUtteranceRecord.new(
|
106
|
+
save_recording: true,
|
107
|
+
max_length_sec: 1,
|
108
|
+
rcrd_termination_silence_time_ms: 1,
|
109
|
+
)
|
110
|
+
expect(instance_1.eql?(instance_2)).to eq(true)
|
111
|
+
end
|
112
|
+
it 'checks if objects are not equal' do
|
113
|
+
instance_1 = Freeclimb::TranscribeUtteranceRecord.new(
|
114
|
+
save_recording: true,
|
115
|
+
max_length_sec: 2,
|
116
|
+
rcrd_termination_silence_time_ms: 2,
|
117
|
+
)
|
118
|
+
instance_2 = Freeclimb::TranscribeUtteranceRecord.new(
|
119
|
+
save_recording: false,
|
120
|
+
max_length_sec: 1,
|
121
|
+
rcrd_termination_silence_time_ms: 1,
|
122
|
+
)
|
123
|
+
expect(instance_1.eql?(instance_2)).to eq(false)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe 'test method "hash"' do
|
128
|
+
it 'calculates hash code' do
|
129
|
+
instance = Freeclimb::TranscribeUtteranceRecord.new(
|
130
|
+
save_recording: true,
|
131
|
+
max_length_sec: 1,
|
132
|
+
rcrd_termination_silence_time_ms: 1,
|
133
|
+
)
|
134
|
+
expect(instance.hash).to be_a_kind_of(Integer)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe 'test method "build_from_hash"' do
|
139
|
+
it 'builds equivalent model from hash code' do
|
140
|
+
instance_1 = Freeclimb::TranscribeUtteranceRecord.new(
|
141
|
+
save_recording: true,
|
142
|
+
max_length_sec: 1,
|
143
|
+
rcrd_termination_silence_time_ms: 1,
|
144
|
+
)
|
145
|
+
instance_2 = Freeclimb::TranscribeUtteranceRecord.new
|
146
|
+
expect(instance_2.build_from_hash(instance_1.hash)).to eq(instance_1.build_from_hash(instance_1.hash))
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe 'test method "_deserialize"' do
|
151
|
+
instance = Freeclimb::TranscribeUtteranceRecord.new(
|
152
|
+
save_recording: true,
|
153
|
+
max_length_sec: 1,
|
154
|
+
rcrd_termination_silence_time_ms: 1,
|
155
|
+
)
|
156
|
+
it 'deserializes the data of save_recording' do
|
157
|
+
expect(instance._deserialize("Boolean", instance.save_recording)).to be_a_kind_of(TrueClass)
|
158
|
+
end
|
159
|
+
it 'deserializes the data of max_length_sec' do
|
160
|
+
expect(instance._deserialize("Integer", instance.max_length_sec)).to be_a_kind_of(Integer)
|
161
|
+
end
|
162
|
+
it 'deserializes the data of rcrd_termination_silence_time_ms' do
|
163
|
+
expect(instance._deserialize("Integer", instance.rcrd_termination_silence_time_ms)).to be_a_kind_of(Integer)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe 'test method "to_s"' do
|
168
|
+
it 'returns the string representation of the object' do
|
169
|
+
instance = Freeclimb::TranscribeUtteranceRecord.new(
|
170
|
+
save_recording: true,
|
171
|
+
max_length_sec: 1,
|
172
|
+
rcrd_termination_silence_time_ms: 1,
|
173
|
+
)
|
174
|
+
expect(instance.to_s).to eq(instance.to_hash.to_s)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
describe 'test method "to_hash"' do
|
179
|
+
it 'returns the object in the form of hash' do
|
180
|
+
instance = Freeclimb::TranscribeUtteranceRecord.new(
|
181
|
+
save_recording: true,
|
182
|
+
max_length_sec: 1,
|
183
|
+
rcrd_termination_silence_time_ms: 1,
|
184
|
+
)
|
185
|
+
expect(instance.to_hash).to be_a_kind_of(Hash)
|
186
|
+
end
|
187
|
+
it 'creates equal hash for two equal objects' do
|
188
|
+
obj = Object.new()
|
189
|
+
instance_1 = Freeclimb::TranscribeUtteranceRecord.new(
|
190
|
+
save_recording: true,
|
191
|
+
max_length_sec: 1,
|
192
|
+
rcrd_termination_silence_time_ms: 1,
|
193
|
+
)
|
194
|
+
instance_2 = Freeclimb::TranscribeUtteranceRecord.new(
|
195
|
+
save_recording: true,
|
196
|
+
max_length_sec: 1,
|
197
|
+
rcrd_termination_silence_time_ms: 1,
|
198
|
+
)
|
199
|
+
expect(instance_1.to_hash).to eq(instance_2.to_hash)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
describe 'test method "_to_hash"' do
|
204
|
+
instance = Freeclimb::TranscribeUtteranceRecord.new(
|
205
|
+
save_recording: true,
|
206
|
+
|
207
|
+
max_length_sec: 1,
|
208
|
+
|
209
|
+
rcrd_termination_silence_time_ms: 1,
|
210
|
+
)
|
211
|
+
it 'returns save_recording in the form of hash' do
|
212
|
+
expect(instance._to_hash(instance.save_recording)).to eq(instance.save_recording)
|
213
|
+
end
|
214
|
+
it 'returns max_length_sec in the form of hash' do
|
215
|
+
expect(instance._to_hash(instance.max_length_sec)).to eq(instance.max_length_sec)
|
216
|
+
end
|
217
|
+
it 'returns rcrd_termination_silence_time_ms in the form of hash' do
|
218
|
+
expect(instance._to_hash(instance.rcrd_termination_silence_time_ms)).to eq(instance.rcrd_termination_silence_time_ms)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|