Class: Phrase::UploadsApi
- Inherits:
-
Object
- Object
- Phrase::UploadsApi
- Defined in:
- lib/phrase/api/uploads_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ UploadsApi
constructor
A new instance of UploadsApi.
-
#upload_create(project_id, file, file_format, locale_id, opts = {}) ⇒ Upload
Upload a new file Upload a new language file.
-
#upload_create_with_http_info(project_id, file, file_format, locale_id, opts = {}) ⇒ Array<(Response<(Upload)>, Integer, Hash)>
Upload a new file Upload a new language file.
-
#upload_show(project_id, id, opts = {}) ⇒ Upload
Get a single upload View details and summary for a single upload.
-
#upload_show_with_http_info(project_id, id, opts = {}) ⇒ Array<(Response<(Upload)>, Integer, Hash)>
Get a single upload View details and summary for a single upload.
-
#uploads_list(project_id, opts = {}) ⇒ Array<Upload>
List uploads List all uploads for the given project.
-
#uploads_list_with_http_info(project_id, opts = {}) ⇒ Array<(Response<(Array<Upload>)>, Integer, Hash)>
List uploads List all uploads for the given project.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ UploadsApi
Returns a new instance of UploadsApi.
7 8 9 |
# File 'lib/phrase/api/uploads_api.rb', line 7 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
5 6 7 |
# File 'lib/phrase/api/uploads_api.rb', line 5 def api_client @api_client end |
Instance Method Details
#upload_create(project_id, file, file_format, locale_id, opts = {}) ⇒ Upload
Upload a new file Upload a new language file. Creates necessary resources in your project.
35 36 37 38 |
# File 'lib/phrase/api/uploads_api.rb', line 35 def upload_create(project_id, file, file_format, locale_id, opts = {}) data, _status_code, _headers = upload_create_with_http_info(project_id, file, file_format, locale_id, opts) data end |
#upload_create_with_http_info(project_id, file, file_format, locale_id, opts = {}) ⇒ Array<(Response<(Upload)>, Integer, Hash)>
Upload a new file Upload a new language file. Creates necessary resources in your project.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/phrase/api/uploads_api.rb', line 65 def upload_create_with_http_info(project_id, file, file_format, locale_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UploadsApi.upload_create ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling UploadsApi.upload_create" end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling UploadsApi.upload_create" end # verify the required parameter 'file_format' is set if @api_client.config.client_side_validation && file_format.nil? fail ArgumentError, "Missing the required parameter 'file_format' when calling UploadsApi.upload_create" end # verify the required parameter 'locale_id' is set if @api_client.config.client_side_validation && locale_id.nil? fail ArgumentError, "Missing the required parameter 'locale_id' when calling UploadsApi.upload_create" end # resource path local_var_path = '/projects/{project_id}/uploads'.sub('{' + 'project_id' + '}', CGI.escape(project_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(['multipart/form-data']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} form_params['file'] = file form_params['file_format'] = file_format form_params['locale_id'] = locale_id form_params['branch'] = opts[:'branch'] if !opts[:'branch'].nil? form_params['tags'] = opts[:'tags'] if !opts[:'tags'].nil? form_params['update_translations'] = opts[:'update_translations'] if !opts[:'update_translations'].nil? form_params['update_translation_keys'] = opts[:'update_translation_keys'] if !opts[:'update_translation_keys'].nil? form_params['update_translations_on_source_match'] = opts[:'update_translations_on_source_match'] if !opts[:'update_translations_on_source_match'].nil? form_params['update_descriptions'] = opts[:'update_descriptions'] if !opts[:'update_descriptions'].nil? form_params['convert_emoji'] = opts[:'convert_emoji'] if !opts[:'convert_emoji'].nil? form_params['skip_upload_tags'] = opts[:'skip_upload_tags'] if !opts[:'skip_upload_tags'].nil? form_params['skip_unverification'] = opts[:'skip_unverification'] if !opts[:'skip_unverification'].nil? form_params['file_encoding'] = opts[:'file_encoding'] if !opts[:'file_encoding'].nil? form_params['locale_mapping'] = opts[:'locale_mapping'] if !opts[:'locale_mapping'].nil? form_params['format_options'] = opts[:'format_options'] if !opts[:'format_options'].nil? form_params['autotranslate'] = opts[:'autotranslate'] if !opts[:'autotranslate'].nil? form_params['mark_reviewed'] = opts[:'mark_reviewed'] if !opts[:'mark_reviewed'].nil? form_params['tag_only_affected_keys'] = opts[:'tag_only_affected_keys'] if !opts[:'tag_only_affected_keys'].nil? form_params['translation_key_prefix'] = opts[:'translation_key_prefix'] if !opts[:'translation_key_prefix'].nil? # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Upload' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] = 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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UploadsApi#upload_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |
#upload_show(project_id, id, opts = {}) ⇒ Upload
Get a single upload View details and summary for a single upload.
155 156 157 158 |
# File 'lib/phrase/api/uploads_api.rb', line 155 def upload_show(project_id, id, opts = {}) data, _status_code, _headers = upload_show_with_http_info(project_id, id, opts) data end |
#upload_show_with_http_info(project_id, id, opts = {}) ⇒ Array<(Response<(Upload)>, Integer, Hash)>
Get a single upload View details and summary for a single upload.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/phrase/api/uploads_api.rb', line 168 def upload_show_with_http_info(project_id, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UploadsApi.upload_show ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling UploadsApi.upload_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 UploadsApi.upload_show" end # resource path local_var_path = '/projects/{project_id}/uploads/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].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] || 'Upload' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] = 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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UploadsApi#upload_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |
#uploads_list(project_id, opts = {}) ⇒ Array<Upload>
List uploads List all uploads for the given project.
231 232 233 234 |
# File 'lib/phrase/api/uploads_api.rb', line 231 def uploads_list(project_id, opts = {}) data, _status_code, _headers = uploads_list_with_http_info(project_id, opts) data end |
#uploads_list_with_http_info(project_id, opts = {}) ⇒ Array<(Response<(Array<Upload>)>, Integer, Hash)>
List uploads List all uploads for the given project.
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/phrase/api/uploads_api.rb', line 245 def uploads_list_with_http_info(project_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UploadsApi.uploads_list ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling UploadsApi.uploads_list" end # resource path local_var_path = '/projects/{project_id}/uploads'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) # 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[:'branch'] = opts[:'branch'] if !opts[:'branch'].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<Upload>' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] = 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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UploadsApi#uploads_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |