freeclimb 4.5.1 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/Gemfile.lock +58 -43
  4. data/README.md +13 -6
  5. data/docs/AddToConference.md +0 -2
  6. data/docs/AddToConferenceAllOf.md +0 -2
  7. data/docs/CreateWebRTCToken.md +22 -0
  8. data/docs/DefaultApi.md +302 -7
  9. data/docs/GetDigits.md +1 -1
  10. data/docs/GetDigitsAllOf.md +1 -1
  11. data/docs/IncomingNumberResult.md +3 -1
  12. data/docs/IncomingNumberResultAllOf.md +3 -1
  13. data/docs/MessageRequest.md +2 -2
  14. data/docs/MessageRequestAllOf.md +2 -2
  15. data/docs/MessageResult.md +3 -1
  16. data/docs/MessageResultAllOf.md +3 -1
  17. data/docs/Play.md +0 -2
  18. data/docs/PlayAllOf.md +0 -2
  19. data/docs/RemoveFromConference.md +1 -4
  20. data/docs/SMSTenDLCCampaign.md +10 -0
  21. data/docs/SMSTollFreeCampaign.md +30 -0
  22. data/docs/SMSTollFreeCampaignsListResult.md +32 -0
  23. data/docs/SMSTollFreeCampaignsListResultAllOf.md +18 -0
  24. data/docs/Say.md +0 -2
  25. data/docs/SayAllOf.md +0 -2
  26. data/docs/SetListen.md +0 -2
  27. data/docs/SetListenAllOf.md +0 -2
  28. data/docs/SetTalk.md +0 -2
  29. data/docs/SetTalkAllOf.md +0 -2
  30. data/docs/TFN.md +18 -0
  31. data/docs/TerminateConference.md +1 -4
  32. data/lib/freeclimb/api/default_api.rb +258 -7
  33. data/lib/freeclimb/models/add_to_conference.rb +1 -13
  34. data/lib/freeclimb/models/add_to_conference_all_of.rb +1 -13
  35. data/lib/freeclimb/models/create_web_rtc_token.rb +278 -0
  36. data/lib/freeclimb/models/get_digits.rb +1 -1
  37. data/lib/freeclimb/models/get_digits_all_of.rb +1 -1
  38. data/lib/freeclimb/models/incoming_number_result.rb +16 -5
  39. data/lib/freeclimb/models/incoming_number_result_all_of.rb +16 -5
  40. data/lib/freeclimb/models/message_request.rb +11 -9
  41. data/lib/freeclimb/models/message_request_all_of.rb +11 -9
  42. data/lib/freeclimb/models/message_result.rb +19 -5
  43. data/lib/freeclimb/models/message_result_all_of.rb +19 -5
  44. data/lib/freeclimb/models/play.rb +1 -13
  45. data/lib/freeclimb/models/play_all_of.rb +1 -13
  46. data/lib/freeclimb/models/remove_from_conference.rb +3 -23
  47. data/lib/freeclimb/models/say.rb +1 -13
  48. data/lib/freeclimb/models/say_all_of.rb +1 -13
  49. data/lib/freeclimb/models/set_listen.rb +2 -18
  50. data/lib/freeclimb/models/set_listen_all_of.rb +2 -18
  51. data/lib/freeclimb/models/set_talk.rb +2 -18
  52. data/lib/freeclimb/models/set_talk_all_of.rb +2 -18
  53. data/lib/freeclimb/models/sms_ten_dlc_campaign.rb +131 -1
  54. data/lib/freeclimb/models/sms_toll_free_campaign.rb +349 -0
  55. data/lib/freeclimb/models/sms_toll_free_campaigns_list_result.rb +311 -0
  56. data/lib/freeclimb/models/sms_toll_free_campaigns_list_result_all_of.rb +226 -0
  57. data/lib/freeclimb/models/terminate_conference.rb +3 -23
  58. data/lib/freeclimb/models/tfn.rb +229 -0
  59. data/lib/freeclimb/utils/signature_information.rb +1 -1
  60. data/lib/freeclimb/version.rb +1 -1
  61. data/lib/freeclimb.rb +5 -2
  62. data/openapi.json +605 -110
  63. data/package.json +8 -0
  64. data/spec/api/default_api_spec.rb +104 -3
  65. data/spec/models/add_to_conference_spec.rb +0 -30
  66. data/spec/models/create_web_rtc_token_spec.rb +225 -0
  67. data/spec/models/get_digits_spec.rb +19 -19
  68. data/spec/models/incoming_number_result_spec.rb +25 -0
  69. data/spec/models/message_request_spec.rb +23 -23
  70. data/spec/models/message_result_spec.rb +30 -0
  71. data/spec/models/play_spec.rb +0 -30
  72. data/spec/models/remove_from_conference_spec.rb +1 -67
  73. data/spec/models/say_spec.rb +0 -30
  74. data/spec/models/set_listen_spec.rb +0 -31
  75. data/spec/models/set_talk_spec.rb +0 -31
  76. data/spec/models/sms_ten_dlc_campaign_spec.rb +165 -0
  77. data/spec/models/sms_toll_free_campaign_spec.rb +368 -0
  78. data/spec/models/sms_toll_free_campaigns_list_result_spec.rb +371 -0
  79. data/spec/models/terminate_conference_spec.rb +1 -67
  80. data/spec/models/tfn_spec.rb +162 -0
  81. data/spec/utils/request_verifier_spec.rb +5 -4
  82. data/spec/utils/signature_information_spec.rb +7 -1
  83. data/yarn.lock +1292 -0
  84. metadata +102 -82
@@ -0,0 +1,371 @@
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::SMSTollFreeCampaignsListResult
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe Freeclimb::SMSTollFreeCampaignsListResult do
21
+ let(:instance) { Freeclimb::SMSTollFreeCampaignsListResult.new }
22
+
23
+ describe 'test an instance of SMSTollFreeCampaignsListResult' do
24
+ it 'should create an instance of SMSTollFreeCampaignsListResult' do
25
+ expect(instance).to be_instance_of(Freeclimb::SMSTollFreeCampaignsListResult)
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "total"' do
30
+ it 'should work' do
31
+ instance.total = 1
32
+ expect(instance.total).to eq(1)
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "start"' do
37
+ it 'should work' do
38
+ instance.start = 1
39
+ expect(instance.start).to eq(1)
40
+ end
41
+ end
42
+
43
+ describe 'test attribute "_end"' do
44
+ it 'should work' do
45
+ instance._end = 1
46
+ expect(instance._end).to eq(1)
47
+ end
48
+ end
49
+
50
+ describe 'test attribute "page"' do
51
+ it 'should work' do
52
+ instance.page = 1
53
+ expect(instance.page).to eq(1)
54
+ end
55
+ end
56
+
57
+ describe 'test attribute "num_pages"' do
58
+ it 'should work' do
59
+ instance.num_pages = 1
60
+ expect(instance.num_pages).to eq(1)
61
+ end
62
+ end
63
+
64
+ describe 'test attribute "page_size"' do
65
+ it 'should work' do
66
+ instance.page_size = 1
67
+ expect(instance.page_size).to eq(1)
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "next_page_uri"' do
72
+ it 'should work' do
73
+ instance.next_page_uri = "TEST_STRING"
74
+ expect(instance.next_page_uri).to eq("TEST_STRING")
75
+ end
76
+ end
77
+
78
+ describe 'test attribute "brands"' do
79
+ it 'should work' do
80
+ instance.brands = ["ELEMENT_1", "ELEMENT_2"]
81
+ expect(instance.brands).to eq(["ELEMENT_1", "ELEMENT_2"])
82
+ end
83
+ end
84
+
85
+ describe 'test method "initialize"' do
86
+ it 'properly initializes with values' do
87
+ expect{instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
88
+ total: 1,
89
+ start: 1,
90
+ _end: 1,
91
+ page: 1,
92
+ num_pages: 1,
93
+ page_size: 1,
94
+ next_page_uri: "TS",
95
+ brands: Array.new(),
96
+ )}.not_to raise_error()
97
+ end
98
+ it 'fails to initialize with input argument that is not a hash in Freeclimb::SMSTollFreeCampaignsListResult' do
99
+ expect{instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
100
+ total: 1,
101
+ start: 1,
102
+ _end: 1,
103
+ page: 1,
104
+ num_pages: 1,
105
+ page_size: 1,
106
+ next_page_uri: "TS",
107
+ brands: Array.new(),
108
+ invalid_attribute: true
109
+ )}.to raise_error(ArgumentError)
110
+ end
111
+ it 'fails to initialize with invalid attribute' do
112
+ expect{instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
113
+ total: 1,
114
+ start: 1,
115
+ _end: 1,
116
+ page: 1,
117
+ num_pages: 1,
118
+ page_size: 1,
119
+ next_page_uri: "TS",
120
+ brands: Array.new(),
121
+ invalid_attribute: true
122
+ )}.to raise_error(ArgumentError)
123
+ end
124
+ end
125
+
126
+ describe 'test method "valid"' do
127
+ it 'checks if properties are valid' do
128
+ instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
129
+ total: 1,
130
+ start: 1,
131
+ _end: 1,
132
+ page: 1,
133
+ num_pages: 1,
134
+ page_size: 1,
135
+ next_page_uri: "TS",
136
+ brands: Array.new(),
137
+ )
138
+ expect(instance.valid?).to eq(true)
139
+ end
140
+ it 'checks if properties are invalid' do
141
+ instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
142
+ )
143
+ expect(instance.valid?).to eq(false)
144
+ end
145
+ it 'checks if model is empty' do
146
+ instance = Freeclimb::SMSTollFreeCampaignsListResult.new()
147
+ expect(instance.valid?).to eq(false)
148
+ end
149
+ end
150
+
151
+ describe 'test method "eql?"' do
152
+ it 'checks if objects are equal' do
153
+ obj = Object.new()
154
+ instance_1 = Freeclimb::SMSTollFreeCampaignsListResult.new(
155
+ total: 1,
156
+ start: 1,
157
+ _end: 1,
158
+ page: 1,
159
+ num_pages: 1,
160
+ page_size: 1,
161
+ next_page_uri: "TS",
162
+ brands: [],
163
+ )
164
+ instance_2 = Freeclimb::SMSTollFreeCampaignsListResult.new(
165
+ total: 1,
166
+ start: 1,
167
+ _end: 1,
168
+ page: 1,
169
+ num_pages: 1,
170
+ page_size: 1,
171
+ next_page_uri: "TS",
172
+ brands: [],
173
+ )
174
+ expect(instance_1.eql?(instance_2)).to eq(true)
175
+ end
176
+ it 'checks if objects are not equal' do
177
+ instance_1 = Freeclimb::SMSTollFreeCampaignsListResult.new(
178
+ total: 1,
179
+ start: 1,
180
+ _end: 1,
181
+ page: 1,
182
+ num_pages: 1,
183
+ page_size: 1,
184
+ next_page_uri: "TS",
185
+ brands: [],
186
+ )
187
+ instance_2 = Freeclimb::SMSTollFreeCampaignsListResult.new(
188
+ total: 0,
189
+ start: 0,
190
+ _end: 0,
191
+ page: 0,
192
+ num_pages: 0,
193
+ page_size: 0,
194
+ next_page_uri: "ST",
195
+ brands: nil,
196
+ )
197
+ expect(instance_1.eql?(instance_2)).to eq(false)
198
+ end
199
+ end
200
+
201
+ describe 'test method "hash"' do
202
+ it 'calculates hash code' do
203
+ instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
204
+ total: 1,
205
+ start: 1,
206
+ _end: 1,
207
+ page: 1,
208
+ num_pages: 1,
209
+ page_size: 1,
210
+ next_page_uri: "TS",
211
+ brands: Array.new(),
212
+ )
213
+ expect(instance.hash).to be_a_kind_of(Integer)
214
+ end
215
+ end
216
+
217
+ describe 'test method "build_from_hash"' do
218
+ it 'builds equivalent model from hash code' do
219
+ instance_1 = Freeclimb::SMSTollFreeCampaignsListResult.new(
220
+ total: 1,
221
+ start: 1,
222
+ _end: 1,
223
+ page: 1,
224
+ num_pages: 1,
225
+ page_size: 1,
226
+ next_page_uri: "TS",
227
+ brands: Array.new(),
228
+ )
229
+ instance_2 = Freeclimb::SMSTollFreeCampaignsListResult.new
230
+ expect(instance_2.build_from_hash(instance_1.hash)).to eq(instance_1.build_from_hash(instance_1.hash))
231
+ end
232
+ end
233
+
234
+ describe 'test method "_deserialize"' do
235
+ instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
236
+ total: 1,
237
+ start: 1,
238
+ _end: 1,
239
+ page: 1,
240
+ num_pages: 1,
241
+ page_size: 1,
242
+ next_page_uri: "TS",
243
+ brands: Array.new(),
244
+ )
245
+ it 'deserializes the data of total' do
246
+ expect(instance._deserialize("Integer", instance.total)).to be_a_kind_of(Integer)
247
+ end
248
+ it 'deserializes the data of start' do
249
+ expect(instance._deserialize("Integer", instance.start)).to be_a_kind_of(Integer)
250
+ end
251
+ it 'deserializes the data of _end' do
252
+ expect(instance._deserialize("Integer", instance._end)).to be_a_kind_of(Integer)
253
+ end
254
+ it 'deserializes the data of page' do
255
+ expect(instance._deserialize("Integer", instance.page)).to be_a_kind_of(Integer)
256
+ end
257
+ it 'deserializes the data of num_pages' do
258
+ expect(instance._deserialize("Integer", instance.num_pages)).to be_a_kind_of(Integer)
259
+ end
260
+ it 'deserializes the data of page_size' do
261
+ expect(instance._deserialize("Integer", instance.page_size)).to be_a_kind_of(Integer)
262
+ end
263
+ it 'deserializes the data of next_page_uri' do
264
+ expect(instance._deserialize("String", instance.next_page_uri)).to be_a_kind_of(String)
265
+ end
266
+ it 'deserializes the data of brands' do
267
+ expect(instance._deserialize("Array<SMSTollFreeCampaign>", instance.brands)).to be_a_kind_of(Array)
268
+ end
269
+ end
270
+
271
+ describe 'test method "to_s"' do
272
+ it 'returns the string representation of the object' do
273
+ instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
274
+ total: 1,
275
+ start: 1,
276
+ _end: 1,
277
+ page: 1,
278
+ num_pages: 1,
279
+ page_size: 1,
280
+ next_page_uri: "TS",
281
+ brands: Array.new(),
282
+ )
283
+ expect(instance.to_s).to eq(instance.to_hash.to_s)
284
+ end
285
+ end
286
+
287
+ describe 'test method "to_hash"' do
288
+ it 'returns the object in the form of hash' do
289
+ instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
290
+ total: 1,
291
+ start: 1,
292
+ _end: 1,
293
+ page: 1,
294
+ num_pages: 1,
295
+ page_size: 1,
296
+ next_page_uri: "TS",
297
+ brands: Array.new(),
298
+ )
299
+ expect(instance.to_hash).to be_a_kind_of(Hash)
300
+ end
301
+ it 'creates equal hash for two equal objects' do
302
+ obj = Object.new()
303
+ instance_1 = Freeclimb::SMSTollFreeCampaignsListResult.new(
304
+ total: 1,
305
+ start: 1,
306
+ _end: 1,
307
+ page: 1,
308
+ num_pages: 1,
309
+ page_size: 1,
310
+ next_page_uri: "TS",
311
+ brands: Array.new(),
312
+ )
313
+ instance_2 = Freeclimb::SMSTollFreeCampaignsListResult.new(
314
+ total: 1,
315
+ start: 1,
316
+ _end: 1,
317
+ page: 1,
318
+ num_pages: 1,
319
+ page_size: 1,
320
+ next_page_uri: "TS",
321
+ brands: Array.new(),
322
+ )
323
+ expect(instance_1.to_hash).to eq(instance_2.to_hash)
324
+ end
325
+ end
326
+
327
+ describe 'test method "_to_hash"' do
328
+ instance = Freeclimb::SMSTollFreeCampaignsListResult.new(
329
+ total: 1,
330
+
331
+ start: 1,
332
+
333
+ _end: 1,
334
+
335
+ page: 1,
336
+
337
+ num_pages: 1,
338
+
339
+ page_size: 1,
340
+
341
+ next_page_uri: "TS",
342
+
343
+ brands: Array.new(),
344
+ )
345
+ it 'returns total in the form of hash' do
346
+ expect(instance._to_hash(instance.total)).to eq(instance.total)
347
+ end
348
+ it 'returns start in the form of hash' do
349
+ expect(instance._to_hash(instance.start)).to eq(instance.start)
350
+ end
351
+ it 'returns _end in the form of hash' do
352
+ expect(instance._to_hash(instance._end)).to eq(instance._end)
353
+ end
354
+ it 'returns page in the form of hash' do
355
+ expect(instance._to_hash(instance.page)).to eq(instance.page)
356
+ end
357
+ it 'returns num_pages in the form of hash' do
358
+ expect(instance._to_hash(instance.num_pages)).to eq(instance.num_pages)
359
+ end
360
+ it 'returns page_size in the form of hash' do
361
+ expect(instance._to_hash(instance.page_size)).to eq(instance.page_size)
362
+ end
363
+ it 'returns next_page_uri in the form of hash' do
364
+ expect(instance._to_hash(instance.next_page_uri)).to eq(instance.next_page_uri)
365
+ end
366
+ it 'returns brands in the form of hash' do
367
+ expect(instance._to_hash(instance.brands)).to eq(instance.brands)
368
+ end
369
+ end
370
+
371
+ end
@@ -26,78 +26,26 @@ describe Freeclimb::TerminateConference do
26
26
  end
27
27
  end
28
28
 
29
- describe 'test attribute "conference_id"' do
30
- it 'should work' do
31
- instance.conference_id = "TEST_STRING"
32
- expect(instance.conference_id).to eq("TEST_STRING")
33
- end
34
- end
35
-
36
29
  describe 'test method "initialize"' do
37
30
  it 'properly initializes with values' do
38
31
  expect{instance = Freeclimb::TerminateConference.new(
39
- conference_id: "TS",
40
32
  )}.not_to raise_error()
41
33
  end
42
34
  it 'fails to initialize with input argument that is not a hash in Freeclimb::TerminateConference' do
43
35
  expect{instance = Freeclimb::TerminateConference.new(
44
- conference_id: "TS",
45
36
  invalid_attribute: true
46
37
  )}.to raise_error(ArgumentError)
47
38
  end
48
39
  it 'fails to initialize with invalid attribute' do
49
40
  expect{instance = Freeclimb::TerminateConference.new(
50
- conference_id: "TS",
51
41
  invalid_attribute: true
52
42
  )}.to raise_error(ArgumentError)
53
43
  end
54
44
  end
55
45
 
56
- describe 'test method "valid"' do
57
- it 'checks if properties are valid' do
58
- instance = Freeclimb::TerminateConference.new(
59
- conference_id: "TS",
60
- )
61
- expect(instance.valid?).to eq(true)
62
- end
63
- it 'checks if properties are invalid' do
64
- instance = Freeclimb::TerminateConference.new(
65
- conference_id: nil,
66
- )
67
- expect(instance.valid?).to eq(false)
68
- end
69
- it 'checks if model is empty' do
70
- instance = Freeclimb::TerminateConference.new()
71
- expect(instance.valid?).to eq(false)
72
- end
73
- end
74
-
75
- describe 'test method "eql?"' do
76
- it 'checks if objects are equal' do
77
- obj = Object.new()
78
- instance_1 = Freeclimb::TerminateConference.new(
79
- conference_id: "TS",
80
- )
81
- instance_2 = Freeclimb::TerminateConference.new(
82
- conference_id: "TS",
83
- )
84
- expect(instance_1.eql?(instance_2)).to eq(true)
85
- end
86
- it 'checks if objects are not equal' do
87
- instance_1 = Freeclimb::TerminateConference.new(
88
- conference_id: "TS",
89
- )
90
- instance_2 = Freeclimb::TerminateConference.new(
91
- conference_id: "ST",
92
- )
93
- expect(instance_1.eql?(instance_2)).to eq(false)
94
- end
95
- end
96
-
97
46
  describe 'test method "hash"' do
98
47
  it 'calculates hash code' do
99
48
  instance = Freeclimb::TerminateConference.new(
100
- conference_id: "TS",
101
49
  )
102
50
  expect(instance.hash).to be_a_kind_of(Integer)
103
51
  end
@@ -106,7 +54,6 @@ describe Freeclimb::TerminateConference do
106
54
  describe 'test method "build_from_hash"' do
107
55
  it 'builds equivalent model from hash code' do
108
56
  instance_1 = Freeclimb::TerminateConference.new(
109
- conference_id: "TS",
110
57
  )
111
58
  instance_2 = Freeclimb::TerminateConference.new
112
59
  expect(instance_2.build_from_hash(instance_1.hash)).to eq(instance_1.build_from_hash(instance_1.hash))
@@ -115,17 +62,12 @@ describe Freeclimb::TerminateConference do
115
62
 
116
63
  describe 'test method "_deserialize"' do
117
64
  instance = Freeclimb::TerminateConference.new(
118
- conference_id: "TS",
119
65
  )
120
- it 'deserializes the data of conference_id' do
121
- expect(instance._deserialize("String", instance.conference_id)).to be_a_kind_of(String)
122
- end
123
66
  end
124
67
 
125
68
  describe 'test method "to_s"' do
126
69
  it 'returns the string representation of the object' do
127
70
  instance = Freeclimb::TerminateConference.new(
128
- conference_id: "TS",
129
71
  )
130
72
  expect(instance.to_s).to eq(instance.to_hash.to_s)
131
73
  end
@@ -134,29 +76,21 @@ describe Freeclimb::TerminateConference do
134
76
  describe 'test method "to_hash"' do
135
77
  it 'returns the object in the form of hash' do
136
78
  instance = Freeclimb::TerminateConference.new(
137
- conference_id: "TS",
138
79
  )
139
80
  expect(instance.to_hash).to be_a_kind_of(Hash)
140
81
  end
141
82
  it 'creates equal hash for two equal objects' do
142
83
  obj = Object.new()
143
84
  instance_1 = Freeclimb::TerminateConference.new(
144
- conference_id: "TS",
145
85
  )
146
86
  instance_2 = Freeclimb::TerminateConference.new(
147
- conference_id: "TS",
148
87
  )
149
88
  expect(instance_1.to_hash).to eq(instance_2.to_hash)
150
89
  end
151
90
  end
152
91
 
153
92
  describe 'test method "_to_hash"' do
154
- instance = Freeclimb::TerminateConference.new(
155
- conference_id: "TS",
156
- )
157
- it 'returns conference_id in the form of hash' do
158
- expect(instance._to_hash(instance.conference_id)).to eq(instance.conference_id)
159
- end
93
+ instance = Freeclimb::TerminateConference.new()
160
94
  end
161
95
 
162
96
  end
@@ -0,0 +1,162 @@
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::TFN
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe Freeclimb::TFN do
21
+ let(:instance) { Freeclimb::TFN.new }
22
+
23
+ describe 'test an instance of TFN' do
24
+ it 'should create an instance of TFN' do
25
+ expect(instance).to be_instance_of(Freeclimb::TFN)
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "campaign_id"' do
30
+ it 'should work' do
31
+ instance.campaign_id = "TEST_STRING"
32
+ expect(instance.campaign_id).to eq("TEST_STRING")
33
+ end
34
+ end
35
+
36
+ describe 'test method "initialize"' do
37
+ it 'properly initializes with values' do
38
+ expect{instance = Freeclimb::TFN.new(
39
+ campaign_id: "TS",
40
+ )}.not_to raise_error()
41
+ end
42
+ it 'fails to initialize with input argument that is not a hash in Freeclimb::TFN' do
43
+ expect{instance = Freeclimb::TFN.new(
44
+ campaign_id: "TS",
45
+ invalid_attribute: true
46
+ )}.to raise_error(ArgumentError)
47
+ end
48
+ it 'fails to initialize with invalid attribute' do
49
+ expect{instance = Freeclimb::TFN.new(
50
+ campaign_id: "TS",
51
+ invalid_attribute: true
52
+ )}.to raise_error(ArgumentError)
53
+ end
54
+ end
55
+
56
+ describe 'test method "valid"' do
57
+ it 'checks if properties are valid' do
58
+ instance = Freeclimb::TFN.new(
59
+ campaign_id: "TS",
60
+ )
61
+ expect(instance.valid?).to eq(true)
62
+ end
63
+ it 'checks if properties are invalid' do
64
+ instance = Freeclimb::TFN.new(
65
+ campaign_id: nil,
66
+ )
67
+ expect(instance.valid?).to eq(false)
68
+ end
69
+ it 'checks if model is empty' do
70
+ instance = Freeclimb::TFN.new()
71
+ expect(instance.valid?).to eq(false)
72
+ end
73
+ end
74
+
75
+ describe 'test method "eql?"' do
76
+ it 'checks if objects are equal' do
77
+ obj = Object.new()
78
+ instance_1 = Freeclimb::TFN.new(
79
+ campaign_id: "TS",
80
+ )
81
+ instance_2 = Freeclimb::TFN.new(
82
+ campaign_id: "TS",
83
+ )
84
+ expect(instance_1.eql?(instance_2)).to eq(true)
85
+ end
86
+ it 'checks if objects are not equal' do
87
+ instance_1 = Freeclimb::TFN.new(
88
+ campaign_id: "TS",
89
+ )
90
+ instance_2 = Freeclimb::TFN.new(
91
+ campaign_id: "ST",
92
+ )
93
+ expect(instance_1.eql?(instance_2)).to eq(false)
94
+ end
95
+ end
96
+
97
+ describe 'test method "hash"' do
98
+ it 'calculates hash code' do
99
+ instance = Freeclimb::TFN.new(
100
+ campaign_id: "TS",
101
+ )
102
+ expect(instance.hash).to be_a_kind_of(Integer)
103
+ end
104
+ end
105
+
106
+ describe 'test method "build_from_hash"' do
107
+ it 'builds equivalent model from hash code' do
108
+ instance_1 = Freeclimb::TFN.new(
109
+ campaign_id: "TS",
110
+ )
111
+ instance_2 = Freeclimb::TFN.new
112
+ expect(instance_2.build_from_hash(instance_1.hash)).to eq(instance_1.build_from_hash(instance_1.hash))
113
+ end
114
+ end
115
+
116
+ describe 'test method "_deserialize"' do
117
+ instance = Freeclimb::TFN.new(
118
+ campaign_id: "TS",
119
+ )
120
+ it 'deserializes the data of campaign_id' do
121
+ expect(instance._deserialize("String", instance.campaign_id)).to be_a_kind_of(String)
122
+ end
123
+ end
124
+
125
+ describe 'test method "to_s"' do
126
+ it 'returns the string representation of the object' do
127
+ instance = Freeclimb::TFN.new(
128
+ campaign_id: "TS",
129
+ )
130
+ expect(instance.to_s).to eq(instance.to_hash.to_s)
131
+ end
132
+ end
133
+
134
+ describe 'test method "to_hash"' do
135
+ it 'returns the object in the form of hash' do
136
+ instance = Freeclimb::TFN.new(
137
+ campaign_id: "TS",
138
+ )
139
+ expect(instance.to_hash).to be_a_kind_of(Hash)
140
+ end
141
+ it 'creates equal hash for two equal objects' do
142
+ obj = Object.new()
143
+ instance_1 = Freeclimb::TFN.new(
144
+ campaign_id: "TS",
145
+ )
146
+ instance_2 = Freeclimb::TFN.new(
147
+ campaign_id: "TS",
148
+ )
149
+ expect(instance_1.to_hash).to eq(instance_2.to_hash)
150
+ end
151
+ end
152
+
153
+ describe 'test method "_to_hash"' do
154
+ instance = Freeclimb::TFN.new(
155
+ campaign_id: "TS",
156
+ )
157
+ it 'returns campaign_id in the form of hash' do
158
+ expect(instance._to_hash(instance.campaign_id)).to eq(instance.campaign_id)
159
+ end
160
+ end
161
+
162
+ end
@@ -111,11 +111,12 @@ describe 'RequestVerifier' do
111
111
  context 'Request plus tolerance is not less than the current datetime' do
112
112
  it 'throws "Request time exceeded tolerance threshold. Request: 1900871395, CurrentTime: currentTimeValue, tolerance, toleranceValue"' do
113
113
  currentTime = DateTime.now.strftime('%s').to_i
114
- request_header = "t=1900871395,v1=1d798c86e977ff734dec3a8b8d67fe8621dcc1df46ef4212e0bfe2e122b01bfd,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"
114
+ timeCalculation = currentTime - (6 * 60)
115
+ request_header = "t=#{timeCalculation},v1=1d798c86e977ff734dec3a8b8d67fe8621dcc1df46ef4212e0bfe2e122b01bfd,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"
115
116
  signing_secret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"
116
117
  tolerance = (5 * 60)
117
118
  request_body = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"
118
- expect { Freeclimb::RequestVerifier.verify_request_signature(request_body, request_header, signing_secret, tolerance) }.to raise_error("Request time exceeded tolerance threshold. Request: 1900871395" + ", CurrentTime: " + currentTime.to_s + ", tolerance: " + tolerance.to_s)
119
+ expect { Freeclimb::RequestVerifier.verify_request_signature(request_body, request_header, signing_secret, tolerance) }.to raise_error("Request time exceeded tolerance threshold. Request: #{timeCalculation}" + ", CurrentTime: " + currentTime.to_s + ", tolerance: " + tolerance.to_s)
119
120
  end
120
121
  end
121
122
  end
@@ -124,7 +125,7 @@ describe 'RequestVerifier' do
124
125
  context 'Signature request is unverified, signing secret does not exist in signatures, potential typo' do
125
126
  it 'throws "Unverified signature request, If this request was unexpected, it may be from a bad actor. Please proceed with caution. If the request was exepected, please check any typos or issues with the signingSecret"' do
126
127
  currentTime = DateTime.now.strftime('%s').to_i
127
- request_header = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"
128
+ request_header = "t=#{currentTime},v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"
128
129
  signing_secret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7794"
129
130
  tolerance = (5 * 60)
130
131
  request_body = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"
@@ -136,7 +137,7 @@ describe 'RequestVerifier' do
136
137
  describe '#verify_request_signature' do
137
138
  context 'Request is valid' do
138
139
  it 'No errors are thrown' do
139
- request_header = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"
140
+ request_header = "t=2130000000,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=6835006e70c9b9f610e8fb3a8b36b52b3f28c12d0a2dab75091c46ca7ec11b20"
140
141
  signing_secret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793"
141
142
  tolerance = (5 * 60)
142
143
  request_body = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"