Module: Crowdin::ApiResources::SourceFiles
- Defined in:
- lib/crowdin-api/api_resources/source_files.rb
Instance Method Summary collapse
- #add_asset_reference(file_id, body = {}, project_id = config.project_id) ⇒ Object
- #add_branch(query = {}, project_id = config.project_id) ⇒ Object
- #add_directory(query = {}, project_id = config.project_id) ⇒ Object
- #add_file(query = {}, project_id = config.project_id) ⇒ Object
- #build_reviewed_source_files(body = {}, project_id = config.project_id) ⇒ Object
- #check_branch_clone_status(branch_id, clone_id, project_id = config.project_id) ⇒ Object
- #check_branch_merge_status(branch_id, merge_id, project_id = config.project_id) ⇒ Object
- #check_delete_branch_job_status(branch_id, job_identifier, project_id = config.project_id) ⇒ Object
- #check_delete_directory_job_status(directory_id, job_identifier, project_id = config.project_id) ⇒ Object
- #check_delete_file_job_status(file_id, job_identifier, project_id = config.project_id) ⇒ Object
- #check_reviewed_source_files_build_status(build_id, project_id = config.project_id) ⇒ Object
- #clone_branch(branch_id, body = {}, project_id = config.project_id) ⇒ Object
- #delete_asset_reference(file_id, reference_id, project_id = config.project_id) ⇒ Object
- #delete_branch(branch_id = nil, project_id = config.project_id, async: false) ⇒ Object
- #delete_directory(directory_id = nil, project_id = config.project_id, async: false) ⇒ Object
- #delete_file(file_id = nil, project_id = config.project_id, async: false) ⇒ Object
- #download_file(file_id = nil, destination = nil, project_id = config.project_id) ⇒ Object
- #download_file_preview(file_id = nil, destination = nil, project_id = config.project_id) ⇒ Object
- #download_reviewed_source_files(build_id, destination = nil, project_id = config.project_id) ⇒ Object
- #edit_branch(branch_id = nil, query = {}, project_id = config.project_id) ⇒ Object
- #edit_directory(directory_id = nil, query = {}, project_id = config.project_id) ⇒ Object
- #edit_file(file_id = nil, query = {}, project_id = config.project_id) ⇒ Object
- #get_asset_reference(file_id, reference_id, project_id = config.project_id) ⇒ Object
- #get_branch(branch_id = nil, project_id = config.project_id) ⇒ Object
- #get_branch_merge_summary(branch_id, merge_id, project_id = config.project_id) ⇒ Object
- #get_cloned_branch(branch_id, clone_id, project_id = config.project_id) ⇒ Object
- #get_directory(directory_id = nil, project_id = config.project_id) ⇒ Object
- #get_file(file_id = nil, project_id = config.project_id) ⇒ Object
- #get_file_revision(file_id = nil, revision_id = nil, project_id = config.project_id) ⇒ Object
- #list_asset_references(file_id, query = {}, project_id = config.project_id) ⇒ Object
- #list_branches(query = {}, project_id = config.project_id) ⇒ Object
- #list_directories(query = {}, project_id = config.project_id) ⇒ Object
- #list_file_revisions(file_id = nil, query = {}, project_id = config.project_id) ⇒ Object
- #list_files(query = {}, project_id = config.project_id) ⇒ Object
- #list_reviewed_source_files_builds(query = {}, project_id = config.project_id) ⇒ Object
- #merge_branch(branch_id, body = {}, project_id = config.project_id) ⇒ Object
- #search_branches(query = {}) ⇒ Object
- #search_directories(query = {}) ⇒ Object
- #search_files(query = {}) ⇒ Object
- #update_or_restore_file(file_id = nil, query = {}, project_id = config.project_id) ⇒ Object
Instance Method Details
#add_asset_reference(file_id, body = {}, project_id = config.project_id) ⇒ Object
522 523 524 525 526 527 528 529 530 531 532 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 522 def add_asset_reference(file_id, body = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/references", { params: body } ) Web::SendRequest.new(request).perform end |
#add_branch(query = {}, project_id = config.project_id) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 24 def add_branch(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/branches", { params: query } ) Web::SendRequest.new(request).perform end |
#add_directory(query = {}, project_id = config.project_id) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 103 def add_directory(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/directories", { params: query } ) Web::SendRequest.new(request).perform end |
#add_file(query = {}, project_id = config.project_id) ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 182 def add_file(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/files", { params: query } ) Web::SendRequest.new(request).perform end |
#build_reviewed_source_files(body = {}, project_id = config.project_id) ⇒ Object
583 584 585 586 587 588 589 590 591 592 593 594 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 583 def build_reviewed_source_files(body = {}, project_id = config.project_id) enterprise_mode? || raise_only_for_enterprise_mode_error project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/strings/reviewed-builds", { params: body } ) Web::SendRequest.new(request).perform end |
#check_branch_clone_status(branch_id, clone_id, project_id = config.project_id) ⇒ Object
385 386 387 388 389 390 391 392 393 394 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 385 def check_branch_clone_status(branch_id, clone_id, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}/clones/#{clone_id}" ) Web::SendRequest.new(request).perform end |
#check_branch_merge_status(branch_id, merge_id, project_id = config.project_id) ⇒ Object
446 447 448 449 450 451 452 453 454 455 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 446 def check_branch_merge_status(branch_id, merge_id, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}/merges/#{merge_id}" ) Web::SendRequest.new(request).perform end |
#check_delete_branch_job_status(branch_id, job_identifier, project_id = config.project_id) ⇒ Object
415 416 417 418 419 420 421 422 423 424 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 415 def check_delete_branch_job_status(branch_id, job_identifier, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}/jobs/#{job_identifier}" ) Web::SendRequest.new(request).perform end |
#check_delete_directory_job_status(directory_id, job_identifier, project_id = config.project_id) ⇒ Object
476 477 478 479 480 481 482 483 484 485 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 476 def check_delete_directory_job_status(directory_id, job_identifier, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/directories/#{directory_id}/jobs/#{job_identifier}" ) Web::SendRequest.new(request).perform end |
#check_delete_file_job_status(file_id, job_identifier, project_id = config.project_id) ⇒ Object
491 492 493 494 495 496 497 498 499 500 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 491 def check_delete_file_job_status(file_id, job_identifier, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/jobs/#{job_identifier}" ) Web::SendRequest.new(request).perform end |
#check_reviewed_source_files_build_status(build_id, project_id = config.project_id) ⇒ Object
598 599 600 601 602 603 604 605 606 607 608 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 598 def check_reviewed_source_files_build_status(build_id, project_id = config.project_id) enterprise_mode? || raise_only_for_enterprise_mode_error project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/strings/reviewed-builds/#{build_id}" ) Web::SendRequest.new(request).perform end |
#clone_branch(branch_id, body = {}, project_id = config.project_id) ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 369 def clone_branch(branch_id, body = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}/clones", { params: body } ) Web::SendRequest.new(request).perform end |
#delete_asset_reference(file_id, reference_id, project_id = config.project_id) ⇒ Object
538 539 540 541 542 543 544 545 546 547 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 538 def delete_asset_reference(file_id, reference_id, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :delete, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/references/#{reference_id}" ) Web::SendRequest.new(request).perform end |
#delete_branch(branch_id = nil, project_id = config.project_id, async: false) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 55 def delete_branch(branch_id = nil, project_id = config.project_id, async: false) branch_id || raise_parameter_is_required_error(:branch_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :delete, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}", { headers: async ? { Prefer: 'respond-async' } : {} } ) Web::SendRequest.new(request).perform end |
#delete_directory(directory_id = nil, project_id = config.project_id, async: false) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 134 def delete_directory(directory_id = nil, project_id = config.project_id, async: false) directory_id || raise_parameter_is_required_error(:directory_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :delete, "#{config.target_api_url}/projects/#{project_id}/directories/#{directory_id}", { headers: async ? { Prefer: 'respond-async' } : {} } ) Web::SendRequest.new(request).perform end |
#delete_file(file_id = nil, project_id = config.project_id, async: false) ⇒ Object
230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 230 def delete_file(file_id = nil, project_id = config.project_id, async: false) file_id || raise_parameter_is_required_error(:file_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :delete, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}", { headers: async ? { Prefer: 'respond-async' } : {} } ) Web::SendRequest.new(request).perform end |
#download_file(file_id = nil, destination = nil, project_id = config.project_id) ⇒ Object
264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 264 def download_file(file_id = nil, destination = nil, project_id = config.project_id) file_id || raise_parameter_is_required_error(:file_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/download" ) Web::SendRequest.new(request, destination).perform end |
#download_file_preview(file_id = nil, destination = nil, project_id = config.project_id) ⇒ Object
280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 280 def download_file_preview(file_id = nil, destination = nil, project_id = config.project_id) file_id || raise_parameter_is_required_error(:file_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/preview" ) Web::SendRequest.new(request, destination).perform end |
#download_reviewed_source_files(build_id, destination = nil, project_id = config.project_id) ⇒ Object
613 614 615 616 617 618 619 620 621 622 623 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 613 def download_reviewed_source_files(build_id, destination = nil, project_id = config.project_id) enterprise_mode? || raise_only_for_enterprise_mode_error project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/strings/reviewed-builds/#{build_id}/download" ) Web::SendRequest.new(request, destination).perform end |
#edit_branch(branch_id = nil, query = {}, project_id = config.project_id) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 72 def edit_branch(branch_id = nil, query = {}, project_id = config.project_id) branch_id || raise_parameter_is_required_error(:branch_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :patch, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}", { params: query } ) Web::SendRequest.new(request).perform end |
#edit_directory(directory_id = nil, query = {}, project_id = config.project_id) ⇒ Object
151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 151 def edit_directory(directory_id = nil, query = {}, project_id = config.project_id) directory_id || raise_parameter_is_required_error(:directory_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :patch, "#{config.target_api_url}/projects/#{project_id}/directories/#{directory_id}", { params: query } ) Web::SendRequest.new(request).perform end |
#edit_file(file_id = nil, query = {}, project_id = config.project_id) ⇒ Object
247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 247 def edit_file(file_id = nil, query = {}, project_id = config.project_id) file_id || raise_parameter_is_required_error(:file_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :patch, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}", { params: query } ) Web::SendRequest.new(request).perform end |
#get_asset_reference(file_id, reference_id, project_id = config.project_id) ⇒ Object
553 554 555 556 557 558 559 560 561 562 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 553 def get_asset_reference(file_id, reference_id, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/references/#{reference_id}" ) Web::SendRequest.new(request).perform end |
#get_branch(branch_id = nil, project_id = config.project_id) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 39 def get_branch(branch_id = nil, project_id = config.project_id) branch_id || raise_parameter_is_required_error(:branch_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}" ) Web::SendRequest.new(request).perform end |
#get_branch_merge_summary(branch_id, merge_id, project_id = config.project_id) ⇒ Object
461 462 463 464 465 466 467 468 469 470 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 461 def get_branch_merge_summary(branch_id, merge_id, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}/merges/#{merge_id}/summary" ) Web::SendRequest.new(request).perform end |
#get_cloned_branch(branch_id, clone_id, project_id = config.project_id) ⇒ Object
400 401 402 403 404 405 406 407 408 409 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 400 def get_cloned_branch(branch_id, clone_id, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}/clones/#{clone_id}/branch" ) Web::SendRequest.new(request).perform end |
#get_directory(directory_id = nil, project_id = config.project_id) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 118 def get_directory(directory_id = nil, project_id = config.project_id) directory_id || raise_parameter_is_required_error(:directory_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/directories/#{directory_id}" ) Web::SendRequest.new(request).perform end |
#get_file(file_id = nil, project_id = config.project_id) ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 197 def get_file(file_id = nil, project_id = config.project_id) file_id || raise_parameter_is_required_error(:file_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}" ) Web::SendRequest.new(request).perform end |
#get_file_revision(file_id = nil, revision_id = nil, project_id = config.project_id) ⇒ Object
313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 313 def get_file_revision(file_id = nil, revision_id = nil, project_id = config.project_id) file_id || raise_parameter_is_required_error(:file_id) revision_id || raise_parameter_is_required_error(:revision_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/revisions/#{revision_id}" ) Web::SendRequest.new(request).perform end |
#list_asset_references(file_id, query = {}, project_id = config.project_id) ⇒ Object
506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 506 def list_asset_references(file_id, query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/references", { params: query } ) Web::SendRequest.new(request).perform end |
#list_branches(query = {}, project_id = config.project_id) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 9 def list_branches(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/branches", { params: query } ) Web::SendRequest.new(request).perform end |
#list_directories(query = {}, project_id = config.project_id) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 88 def list_directories(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/directories", { params: query } ) Web::SendRequest.new(request).perform end |
#list_file_revisions(file_id = nil, query = {}, project_id = config.project_id) ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 296 def list_file_revisions(file_id = nil, query = {}, project_id = config.project_id) file_id || raise_parameter_is_required_error(:file_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}/revisions", { params: query } ) Web::SendRequest.new(request).perform end |
#list_files(query = {}, project_id = config.project_id) ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 167 def list_files(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/files", { params: query } ) Web::SendRequest.new(request).perform end |
#list_reviewed_source_files_builds(query = {}, project_id = config.project_id) ⇒ Object
568 569 570 571 572 573 574 575 576 577 578 579 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 568 def list_reviewed_source_files_builds(query = {}, project_id = config.project_id) enterprise_mode? || raise_only_for_enterprise_mode_error project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/strings/reviewed-builds", { params: query } ) Web::SendRequest.new(request).perform end |
#merge_branch(branch_id, body = {}, project_id = config.project_id) ⇒ Object
430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 430 def merge_branch(branch_id, body = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}/merges", { params: body } ) Web::SendRequest.new(request).perform end |
#search_branches(query = {}) ⇒ Object
329 330 331 332 333 334 335 336 337 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 329 def search_branches(query = {}) request = Web::Request.new( connection, :get, "#{config.target_api_url}/branches", { params: query } ) Web::SendRequest.new(request).perform end |
#search_directories(query = {}) ⇒ Object
342 343 344 345 346 347 348 349 350 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 342 def search_directories(query = {}) request = Web::Request.new( connection, :get, "#{config.target_api_url}/directories", { params: query } ) Web::SendRequest.new(request).perform end |
#search_files(query = {}) ⇒ Object
355 356 357 358 359 360 361 362 363 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 355 def search_files(query = {}) request = Web::Request.new( connection, :get, "#{config.target_api_url}/files", { params: query } ) Web::SendRequest.new(request).perform end |
#update_or_restore_file(file_id = nil, query = {}, project_id = config.project_id) ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 213 def update_or_restore_file(file_id = nil, query = {}, project_id = config.project_id) file_id || raise_parameter_is_required_error(:file_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :put, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}", { params: query } ) Web::SendRequest.new(request).perform end |