Class: CallRecorderApi::Client
- Inherits:
-
Object
- Object
- CallRecorderApi::Client
- Defined in:
- lib/call_recorder_api/client.rb
Instance Method Summary collapse
- #buy_credits(request) ⇒ Object
- #clone_file(request) ⇒ Object
- #create_file(request) ⇒ Object
- #create_folder(request) ⇒ Object
- #delete_files(request) ⇒ Object
- #delete_folder(request) ⇒ Object
- #delete_meta_files(request) ⇒ Object
- #get_files(request) ⇒ Object
- #get_folders(request) ⇒ Object
- #get_languages(request) ⇒ Object
- #get_meta_files(request) ⇒ Object
- #get_msgs(request) ⇒ Object
- #get_phones(request) ⇒ Object
- #get_profile(request) ⇒ Object
- #get_settings(request) ⇒ Object
- #get_translations(request) ⇒ Object
-
#initialize(config = Configuration.new) ⇒ Client
constructor
A new instance of Client.
- #notify_user_custom(request) ⇒ Object
- #recover_file(request) ⇒ Object
- #register_phone(request) ⇒ Object
- #update_device_token(request) ⇒ Object
- #update_file(request) ⇒ Object
- #update_folder(request) ⇒ Object
- #update_order(request) ⇒ Object
- #update_profile(request) ⇒ Object
- #update_profile_img(request) ⇒ Object
- #update_settings(request) ⇒ Object
- #update_star(request) ⇒ Object
- #update_user(request) ⇒ Object
- #upload_meta_file(request) ⇒ Object
- #verify_folder_pass(request) ⇒ Object
- #verify_phone(request) ⇒ Object
Constructor Details
#initialize(config = Configuration.new) ⇒ Client
Returns a new instance of Client.
8 9 10 |
# File 'lib/call_recorder_api/client.rb', line 8 def initialize(config = Configuration.new) @config = config end |
Instance Method Details
#buy_credits(request) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/call_recorder_api/client.rb', line 12 def buy_credits(request) r = RestClient.post(@config.baseUrl + '/rapi/buy_credits', { 'amount': request.amount, 'api_key': request.api_key, 'device_type': request.device_type, 'product_id': request.product_id, 'receipt': request.receipt, }) json = JSON.parse(r) BuyCreditsResponse.new( status = json['status'], msg = json['msg'], ) end |
#clone_file(request) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/call_recorder_api/client.rb', line 27 def clone_file(request) r = RestClient.post(@config.baseUrl + '/rapi/clone_file', { 'api_key': request.api_key, 'id': request.id, }) json = JSON.parse(r) CloneFileResponse.new( status = json['status'], msg = json['msg'], code = json['code'], id = json['id'], ) end |
#create_file(request) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/call_recorder_api/client.rb', line 41 def create_file(request) r = RestClient.post(@config.baseUrl + '/rapi/create_file', { 'api_key': request.api_key, 'data': request.data.to_json, 'file': File.new(request.file, 'rb'), }) json = JSON.parse(r) CreateFileResponse.new( status = json['status'], id = json['id'], msg = json['msg'], ) end |
#create_folder(request) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/call_recorder_api/client.rb', line 55 def create_folder(request) r = RestClient.post(@config.baseUrl + '/rapi/create_folder', { 'api_key': request.api_key, 'name': request.name, 'pass': request.pass, }) json = JSON.parse(r) CreateFolderResponse.new( status = json['status'], msg = json['msg'], id = json['id'], code = json['code'], ) end |
#delete_files(request) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/call_recorder_api/client.rb', line 70 def delete_files(request) r = RestClient.post(@config.baseUrl + '/rapi/delete_files', { 'action': request.action, 'api_key': request.api_key, 'ids': request.ids.join(','), }) json = JSON.parse(r) DeleteFilesResponse.new( status = json['status'], msg = json['msg'], ) end |
#delete_folder(request) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/call_recorder_api/client.rb', line 83 def delete_folder(request) r = RestClient.post(@config.baseUrl + '/rapi/delete_folder', { 'api_key': request.api_key, 'id': request.id, 'move_to': request.move_to, }) json = JSON.parse(r) DeleteFolderResponse.new( status = json['status'], msg = json['msg'], ) end |
#delete_meta_files(request) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/call_recorder_api/client.rb', line 96 def (request) r = RestClient.post(@config.baseUrl + '/rapi/delete_meta_files', { 'api_key': request.api_key, 'ids': request.ids.join(','), 'parent_id': request.parent_id, }) json = JSON.parse(r) DeleteMetaFilesResponse.new( status = json['status'], msg = json['msg'], ) end |
#get_files(request) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/call_recorder_api/client.rb', line 109 def get_files(request) r = RestClient.post(@config.baseUrl + '/rapi/get_files', { 'api_key': request.api_key, 'folder_id': request.folder_id, 'id': request.id, 'op': request.op, 'page': request.page, 'pass': request.pass, 'q': request.q, 'reminder': request.reminder, 'source': request.source, }) json = JSON.parse(r) GetFilesResponse.new( status = json['status'], credits = json['credits'], credits_trans = json['credits_trans'], files = json['files'], ) end |
#get_folders(request) ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/call_recorder_api/client.rb', line 130 def get_folders(request) r = RestClient.post(@config.baseUrl + '/rapi/get_folders', { 'api_key': request.api_key, }) json = JSON.parse(r) GetFoldersResponse.new( status = json['status'], msg = json['msg'], folders = json['folders'], ) end |
#get_languages(request) ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/call_recorder_api/client.rb', line 142 def get_languages(request) r = RestClient.post(@config.baseUrl + '/rapi/get_languages', { 'api_key': request.api_key, }) json = JSON.parse(r) GetLanguagesResponse.new( status = json['status'], msg = json['msg'], languages = json['languages'], ) end |
#get_meta_files(request) ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/call_recorder_api/client.rb', line 154 def (request) r = RestClient.post(@config.baseUrl + '/rapi/get_meta_files', { 'api_key': request.api_key, 'parent_id': request.parent_id, }) json = JSON.parse(r) GetMetaFilesResponse.new( status = json['status'], = json['meta_files'], ) end |
#get_msgs(request) ⇒ Object
166 167 168 169 170 171 172 173 174 175 |
# File 'lib/call_recorder_api/client.rb', line 166 def get_msgs(request) r = RestClient.post(@config.baseUrl + '/rapi/get_msgs', { 'api_key': request.api_key, }) json = JSON.parse(r) GetMessagesResponse.new( status = json['status'], msgs = json['msgs'], ) end |
#get_phones(request) ⇒ Object
177 178 179 180 181 182 183 184 |
# File 'lib/call_recorder_api/client.rb', line 177 def get_phones(request) r = RestClient.post(@config.baseUrl + '/rapi/get_phones', { 'api_key': request.api_key, }) json = JSON.parse(r) GetPhonesResponse.new( ) end |
#get_profile(request) ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/call_recorder_api/client.rb', line 186 def get_profile(request) r = RestClient.post(@config.baseUrl + '/rapi/get_profile', { 'api_key': request.api_key, }) json = JSON.parse(r) GetProfileResponse.new( status = json['status'], code = json['code'], profile = json['profile'], app = json['app'], share_url = json['share_url'], rate_url = json['rate_url'], credits = json['credits'], credits_trans = json['credits_trans'], ) end |
#get_settings(request) ⇒ Object
203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/call_recorder_api/client.rb', line 203 def get_settings(request) r = RestClient.post(@config.baseUrl + '/rapi/get_settings', { 'api_key': request.api_key, }) json = JSON.parse(r) GetSettingsResponse.new( status = json['status'], app = json['app'], credits = json['credits'], settings = json['settings'], ) end |
#get_translations(request) ⇒ Object
216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/call_recorder_api/client.rb', line 216 def get_translations(request) r = RestClient.post(@config.baseUrl + '/rapi/get_translations', { 'api_key': request.api_key, 'language': request.language, }) json = JSON.parse(r) GetTranslationsResponse.new( status = json['status'], msg = json['msg'], code = json['code'], translation = json['translation'], ) end |
#notify_user_custom(request) ⇒ Object
230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/call_recorder_api/client.rb', line 230 def notify_user_custom(request) r = RestClient.post(@config.baseUrl + '/rapi/notify_user_custom', { 'api_key': request.api_key, 'body': request.body, 'device_type': request.device_type, 'title': request.title, }) json = JSON.parse(r) NotifyUserResponse.new( status = json['status'], msg = json['msg'], ) end |
#recover_file(request) ⇒ Object
244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/call_recorder_api/client.rb', line 244 def recover_file(request) r = RestClient.post(@config.baseUrl + '/rapi/recover_file', { 'api_key': request.api_key, 'folder_id': request.folder_id, 'id': request.id, }) json = JSON.parse(r) RecoverFileResponse.new( status = json['status'], msg = json['msg'], code = json['code'], ) end |
#register_phone(request) ⇒ Object
258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/call_recorder_api/client.rb', line 258 def register_phone(request) r = RestClient.post(@config.baseUrl + '/rapi/register_phone', { 'phone': request.phone, 'token': request.token, }) json = JSON.parse(r) RegisterPhoneResponse.new( status = json['status'], phone = json['phone'], code = json['code'], msg = json['msg'], ) end |
#update_device_token(request) ⇒ Object
272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/call_recorder_api/client.rb', line 272 def update_device_token(request) r = RestClient.post(@config.baseUrl + '/rapi/update_device_token', { 'api_key': request.api_key, 'device_token': request.device_token, 'device_type': request.device_type, }) json = JSON.parse(r) UpdateDeviceTokenResponse.new( status = json['status'], msg = json['msg'], ) end |
#update_file(request) ⇒ Object
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/call_recorder_api/client.rb', line 285 def update_file(request) r = RestClient.post(@config.baseUrl + '/rapi/update_file', { 'api_key': request.api_key, 'email': request.email, 'f_name': request.f_name, 'folder_id': request.folder_id, 'id': request.id, 'l_name': request.l_name, 'name': request.name, 'notes': request.notes, 'phone': request.phone, 'remind_date': request.remind_date, 'remind_days': request.remind_days, 'tags': request., }) json = JSON.parse(r) UpdateFileResponse.new( status = json['status'], msg = json['msg'], ) end |
#update_folder(request) ⇒ Object
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/call_recorder_api/client.rb', line 307 def update_folder(request) r = RestClient.post(@config.baseUrl + '/rapi/update_folder', { 'api_key': request.api_key, 'id': request.id, 'is_private': request.is_private, 'name': request.name, 'pass': request.pass, }) json = JSON.parse(r) UpdateFolderResponse.new( status = json['status'], msg = json['msg'], code = json['code'], ) end |
#update_order(request) ⇒ Object
323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/call_recorder_api/client.rb', line 323 def update_order(request) r = RestClient.post(@config.baseUrl + '/rapi/update_order', { 'api_key': request.api_key, 'folders': request.folders.join(','), }) json = JSON.parse(r) UpdateOrderResponse.new( status = json['status'], msg = json['msg'], code = json['code'], ) end |
#update_profile(request) ⇒ Object
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/call_recorder_api/client.rb', line 351 def update_profile(request) r = RestClient.post(@config.baseUrl + '/rapi/update_profile', { 'api_key': request.api_key, 'data[f_name]': request.data.f_name, 'data[l_name]': request.data.l_name, 'data[email]': request.data.email, 'data[is_public]': request.data.is_public, 'data[language]': request.data.language, }) json = JSON.parse(r) UpdateProfileResponse.new( status = json['status'], msg = json['msg'], code = json['code'], ) end |
#update_profile_img(request) ⇒ Object
336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/call_recorder_api/client.rb', line 336 def update_profile_img(request) r = RestClient.post(@config.baseUrl + '/upload/update_profile_img', { 'api_key': request.api_key, 'file': File.new(request.file, 'rb'), }) json = JSON.parse(r) UpdateProfileImgResponse.new( status = json['status'], msg = json['msg'], code = json['code'], file = json['file'], path = json['path'], ) end |
#update_settings(request) ⇒ Object
368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/call_recorder_api/client.rb', line 368 def update_settings(request) r = RestClient.post(@config.baseUrl + '/rapi/update_settings', { 'api_key': request.api_key, 'files_permission': request., 'play_beep': request.play_beep, }) json = JSON.parse(r) UpdateSettingsResponse.new( status = json['status'], msg = json['msg'], code = json['code'], ) end |
#update_star(request) ⇒ Object
382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/call_recorder_api/client.rb', line 382 def update_star(request) r = RestClient.post(@config.baseUrl + '/rapi/update_star', { 'api_key': request.api_key, 'id': request.id, 'star': request.star, 'type': request.type, }) json = JSON.parse(r) UpdateStarResponse.new( status = json['status'], msg = json['msg'], code = json['code'], ) end |
#update_user(request) ⇒ Object
397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/call_recorder_api/client.rb', line 397 def update_user(request) r = RestClient.post(@config.baseUrl + '/rapi/update_user', { 'api_key': request.api_key, 'app': request.app, 'time_zone': request.time_zone, }) json = JSON.parse(r) UpdateUserResponse.new( status = json['status'], msg = json['msg'], code = json['code'], ) end |
#upload_meta_file(request) ⇒ Object
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/call_recorder_api/client.rb', line 411 def (request) r = RestClient.post(@config.baseUrl + '/rapi/upload_meta_file', { 'api_key': request.api_key, 'file': File.new(request.file, 'rb'), 'id': request.id, 'name': request.name, 'parent_id': request.parent_id, }) json = JSON.parse(r) UploadMetaFileResponse.new( status = json['status'], msg = json['msg'], parent_id = json['parent_id'], id = json['id'], ) end |
#verify_folder_pass(request) ⇒ Object
428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/call_recorder_api/client.rb', line 428 def verify_folder_pass(request) r = RestClient.post(@config.baseUrl + '/rapi/verify_folder_pass', { 'api_key': request.api_key, 'id': request.id, 'pass': request.pass, }) json = JSON.parse(r) VerifyFolderPassResponse.new( status = json['status'], msg = json['msg'], code = json['code'], ) end |
#verify_phone(request) ⇒ Object
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/call_recorder_api/client.rb', line 442 def verify_phone(request) r = RestClient.post(@config.baseUrl + '/rapi/verify_phone', { 'app': request.app, 'code': request.code, 'device_id': request.device_id, 'device_token': request.device_token, 'device_type': request.device_type, 'mcc': request.mcc, 'phone': request.phone, 'time_zone': request.time_zone, 'token': request.token, }) json = JSON.parse(r) VerifyPhoneResponse.new( status = json['status'], phone = json['phone'], api_key = json['api_key'], msg = json['msg'], ) end |