Module: Crowdin::ApiResources::SourceFiles
- Defined in:
- lib/crowdin-api/api_resources/source_files.rb
Instance Method Summary collapse
- #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
- #delete_branch(branch_id = nil, project_id = config.project_id) ⇒ Object
- #delete_directory(directory_id = nil, project_id = config.project_id) ⇒ Object
- #delete_file(file_id = nil, project_id = config.project_id) ⇒ 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
- #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_branch(branch_id = nil, 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_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
- #update_or_restore_file(file_id = nil, query = {}, project_id = config.project_id) ⇒ Object
Instance Method Details
#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
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 101 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
178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 178 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 |
#delete_branch(branch_id = nil, project_id = config.project_id) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 54 def delete_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, :delete, "#{config.target_api_url}/projects/#{project_id}/branches/#{branch_id}" ) Web::SendRequest.new(request).perform end |
#delete_directory(directory_id = nil, project_id = config.project_id) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 131 def delete_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, :delete, "#{config.target_api_url}/projects/#{project_id}/directories/#{directory_id}" ) Web::SendRequest.new(request).perform end |
#delete_file(file_id = nil, project_id = config.project_id) ⇒ Object
225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 225 def delete_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, :delete, "#{config.target_api_url}/projects/#{project_id}/files/#{file_id}" ) Web::SendRequest.new(request).perform end |
#download_file(file_id = nil, destination = nil, project_id = config.project_id) ⇒ Object
258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 258 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
274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 274 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 |
#edit_branch(branch_id = nil, query = {}, project_id = config.project_id) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 70 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
147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 147 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
241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 241 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_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_directory(directory_id = nil, project_id = config.project_id) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 116 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
193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 193 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
307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 307 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_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
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 86 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
290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 290 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
163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 163 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 |
#update_or_restore_file(file_id = nil, query = {}, project_id = config.project_id) ⇒ Object
209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/crowdin-api/api_resources/source_files.rb', line 209 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 |