class Phrase::ProjectsApi
Attributes
Public Class Methods
# File lib/phrase/api/projects_api.rb, line 7 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create a project Create a new project. @param project_create_parameters [ProjectCreateParameters] @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @return [ProjectDetails]
# File lib/phrase/api/projects_api.rb, line 16 def project_create(project_create_parameters, opts = {}) data, _status_code, _headers = project_create_with_http_info(project_create_parameters, opts) data end
Create a project Create a new project. @param project_create_parameters [ProjectCreateParameters] @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @return [Array<(Response
<(ProjectDetails
)>, Integer, Hash)>] Response
<(ProjectDetails
)> data, response status code and response headers
# File lib/phrase/api/projects_api.rb, line 27 def project_create_with_http_info(project_create_parameters, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProjectsApi.project_create ...' end # verify the required parameter 'project_create_parameters' is set if @api_client.config.client_side_validation && project_create_parameters.nil? fail ArgumentError, "Missing the required parameter 'project_create_parameters' when calling ProjectsApi.project_create" end # resource path local_var_path = '/projects' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(project_create_parameters) # return_type return_type = opts[:return_type] || 'ProjectDetails' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProjectsApi#project_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end
Delete a project Delete an existing project. @param id [String] ID @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @return [nil]
# File lib/phrase/api/projects_api.rb, line 84 def project_delete(id, opts = {}) data, _status_code, _headers = project_delete_with_http_info(id, opts) data end
Delete a project Delete an existing project. @param id [String] ID @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @return [Array<(Response
, Integer, Hash)>] Response
<(nil, response status code and response headers
# File lib/phrase/api/projects_api.rb, line 95 def project_delete_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProjectsApi.project_delete ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling ProjectsApi.project_delete" end # resource path local_var_path = '/projects/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProjectsApi#project_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end
Get a single project Get details on a single project. @param id [String] ID @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @return [ProjectDetails]
# File lib/phrase/api/projects_api.rb, line 148 def project_show(id, opts = {}) data, _status_code, _headers = project_show_with_http_info(id, opts) data end
Get a single project Get details on a single project. @param id [String] ID @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @return [Array<(Response
<(ProjectDetails
)>, Integer, Hash)>] Response
<(ProjectDetails
)> data, response status code and response headers
# File lib/phrase/api/projects_api.rb, line 159 def project_show_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProjectsApi.project_show ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling ProjectsApi.project_show" end # resource path local_var_path = '/projects/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'ProjectDetails' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProjectsApi#project_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end
Update a project Update an existing project. @param id [String] ID @param project_update_parameters [ProjectUpdateParameters] @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @return [ProjectDetails]
# File lib/phrase/api/projects_api.rb, line 215 def project_update(id, project_update_parameters, opts = {}) data, _status_code, _headers = project_update_with_http_info(id, project_update_parameters, opts) data end
Update a project Update an existing project. @param id [String] ID @param project_update_parameters [ProjectUpdateParameters] @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @return [Array<(Response
<(ProjectDetails
)>, Integer, Hash)>] Response
<(ProjectDetails
)> data, response status code and response headers
# File lib/phrase/api/projects_api.rb, line 227 def project_update_with_http_info(id, project_update_parameters, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProjectsApi.project_update ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling ProjectsApi.project_update" end # verify the required parameter 'project_update_parameters' is set if @api_client.config.client_side_validation && project_update_parameters.nil? fail ArgumentError, "Missing the required parameter 'project_update_parameters' when calling ProjectsApi.project_update" end # resource path local_var_path = '/projects/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(project_update_parameters) # return_type return_type = opts[:return_type] || 'ProjectDetails' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProjectsApi#project_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end
List projects List all projects the current user has access to. @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @option opts [Integer] :page Page number @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default @option opts [String] :account_id Filter by Account
ID @option opts [String] :sort_by Sort projects. Valid options are "name_asc", "name_desc", "updated_at_asc", "updated_at_desc", "space_asc" and "space_desc". @option opts [Array<String>] :filters Filter projects. Valid options are ["favorites"]. @return [Array<Project>]
# File lib/phrase/api/projects_api.rb, line 292 def projects_list(opts = {}) data, _status_code, _headers = projects_list_with_http_info(opts) data end
List projects List all projects the current user has access to. @param [Hash] opts the optional parameters @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) @option opts [Integer] :page Page number @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default @option opts [String] :account_id Filter by Account
ID @option opts [String] :sort_by Sort projects. Valid options are "name_asc", "name_desc", "updated_at_asc", "updated_at_desc", "space_asc" and "space_desc". @option opts [Array<String>] :filters Filter projects. Valid options are ["favorites"]. @return [Array<(Response
<(Array<Project>)>, Integer, Hash)>] Response
<(Array<Project>)> data, response status code and response headers
# File lib/phrase/api/projects_api.rb, line 307 def projects_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProjectsApi.projects_list ...' end # resource path local_var_path = '/projects' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? query_params[:'account_id'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? query_params[:'filters'] = @api_client.build_collection_param(opts[:'filters'], :multi) if !opts[:'filters'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Array<Project>' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProjectsApi#projects_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end