Module: Crowdin::ApiResources::Bundles
- Defined in:
- lib/crowdin-api/api_resources/bundles.rb
Instance Method Summary collapse
- #add_bundle(query = {}, project_id = config.project_id) ⇒ Object
- #bundle_list_files(bundle_id, query = {}, project_id = config.project_id) ⇒ Object
- #delete_bundle(bundle_id, project_id = config.project_id) ⇒ Object
- #edit_bundle(bundle_id, query = {}, project_id = config.project_id) ⇒ Object
- #get_bundle(bundle_id, project_id = config.project_id) ⇒ Object
- #list_bundles(query = {}, project_id = config.project_id) ⇒ Object
Instance Method Details
#add_bundle(query = {}, project_id = config.project_id) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/crowdin-api/api_resources/bundles.rb', line 24 def add_bundle(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error %i[name format sourcePatterns exportPattern].each do |param| query[param] || raise_parameter_is_required_error(param) end request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/bundles", { params: query } ) Web::SendRequest.new(request).perform end |
#bundle_list_files(bundle_id, query = {}, project_id = config.project_id) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/crowdin-api/api_resources/bundles.rb', line 90 def bundle_list_files(bundle_id, query = {}, project_id = config.project_id) bundle_id || raise_parameter_is_required_error(:bundle_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/files", { params: query } ) Web::SendRequest.new(request).perform end |
#delete_bundle(bundle_id, project_id = config.project_id) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/crowdin-api/api_resources/bundles.rb', line 57 def delete_bundle(bundle_id, project_id = config.project_id) bundle_id || raise_parameter_is_required_error(:bundle_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :delete, "#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}" ) Web::SendRequest.new(request).perform end |
#edit_bundle(bundle_id, query = {}, project_id = config.project_id) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/crowdin-api/api_resources/bundles.rb', line 73 def edit_bundle(bundle_id, query = {}, project_id = config.project_id) bundle_id || raise_parameter_is_required_error(:bundle_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :patch, "#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}", { params: query } ) Web::SendRequest.new(request).perform end |
#get_bundle(bundle_id, project_id = config.project_id) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/crowdin-api/api_resources/bundles.rb', line 42 def get_bundle(bundle_id, project_id = config.project_id) bundle_id || raise_parameter_is_required_error(:bundle_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}" ) Web::SendRequest.new(request).perform end |
#list_bundles(query = {}, project_id = config.project_id) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/crowdin-api/api_resources/bundles.rb', line 9 def list_bundles(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}/bundles", { params: query } ) Web::SendRequest.new(request).perform end |