Class: Phrase::LocalesApi
- Inherits:
-
Object
- Object
- Phrase::LocalesApi
- Defined in:
- lib/phrase/api/locales_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#account_locales(id, opts = {}) ⇒ Array<LocalePreview1>
List locales used in account List all locales unique by locale code used across all projects within an account.
-
#account_locales_with_http_info(id, opts = {}) ⇒ Array<(Response<(Array<LocalePreview1>)>, Integer, Hash)>
List locales used in account List all locales unique by locale code used across all projects within an account.
-
#initialize(api_client = ApiClient.default) ⇒ LocalesApi
constructor
A new instance of LocalesApi.
-
#locale_create(project_id, locale_create_parameters, opts = {}) ⇒ LocaleDetails
Create a locale Create a new locale.
-
#locale_create_with_http_info(project_id, locale_create_parameters, opts = {}) ⇒ Array<(Response<(LocaleDetails)>, Integer, Hash)>
Create a locale Create a new locale.
-
#locale_delete(project_id, id, opts = {}) ⇒ nil
Delete a locale Delete an existing locale.
-
#locale_delete_with_http_info(project_id, id, opts = {}) ⇒ Array<(Response, Integer, Hash)>
Delete a locale Delete an existing locale.
-
#locale_download(project_id, id, opts = {}) ⇒ File
Download a locale Download a locale in a specific file format.
-
#locale_download_with_http_info(project_id, id, opts = {}) ⇒ Array<(Response<(File)>, Integer, Hash)>
Download a locale Download a locale in a specific file format.
-
#locale_show(project_id, id, opts = {}) ⇒ LocaleDetails
Get a single locale Get details on a single locale for a given project.
-
#locale_show_with_http_info(project_id, id, opts = {}) ⇒ Array<(Response<(LocaleDetails)>, Integer, Hash)>
Get a single locale Get details on a single locale for a given project.
-
#locale_update(project_id, id, locale_update_parameters, opts = {}) ⇒ LocaleDetails
Update a locale Update an existing locale.
-
#locale_update_with_http_info(project_id, id, locale_update_parameters, opts = {}) ⇒ Array<(Response<(LocaleDetails)>, Integer, Hash)>
Update a locale Update an existing locale.
-
#locales_list(project_id, opts = {}) ⇒ Array<Locale>
List locales List all locales for the given project.
-
#locales_list_with_http_info(project_id, opts = {}) ⇒ Array<(Response<(Array<Locale>)>, Integer, Hash)>
List locales List all locales for the given project.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ LocalesApi
Returns a new instance of LocalesApi.
7 8 9 |
# File 'lib/phrase/api/locales_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/locales_api.rb', line 5 def api_client @api_client end |
Instance Method Details
#account_locales(id, opts = {}) ⇒ Array<LocalePreview1>
List locales used in account List all locales unique by locale code used across all projects within an account.
18 19 20 21 |
# File 'lib/phrase/api/locales_api.rb', line 18 def account_locales(id, opts = {}) data, _status_code, _headers = account_locales_with_http_info(id, opts) data end |
#account_locales_with_http_info(id, opts = {}) ⇒ Array<(Response<(Array<LocalePreview1>)>, Integer, Hash)>
List locales used in account List all locales unique by locale code used across all projects within an account.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/phrase/api/locales_api.rb', line 31 def account_locales_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LocalesApi.account_locales ...' 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 LocalesApi.account_locales" end # resource path local_var_path = '/accounts/{id}/locales'.sub('{' + 'id' + '}', CGI.escape(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? # 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<LocalePreview1>' # 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: LocalesApi#account_locales\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |
#locale_create(project_id, locale_create_parameters, opts = {}) ⇒ LocaleDetails
Create a locale Create a new locale.
89 90 91 92 |
# File 'lib/phrase/api/locales_api.rb', line 89 def locale_create(project_id, locale_create_parameters, opts = {}) data, _status_code, _headers = locale_create_with_http_info(project_id, locale_create_parameters, opts) data end |
#locale_create_with_http_info(project_id, locale_create_parameters, opts = {}) ⇒ Array<(Response<(LocaleDetails)>, Integer, Hash)>
Create a locale Create a new locale.
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 146 147 148 149 150 151 152 153 154 |
# File 'lib/phrase/api/locales_api.rb', line 101 def locale_create_with_http_info(project_id, locale_create_parameters, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LocalesApi.locale_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 LocalesApi.locale_create" end # verify the required parameter 'locale_create_parameters' is set if @api_client.config.client_side_validation && locale_create_parameters.nil? fail ArgumentError, "Missing the required parameter 'locale_create_parameters' when calling LocalesApi.locale_create" end # resource path local_var_path = '/projects/{project_id}/locales'.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(['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(locale_create_parameters) # return_type return_type = opts[:return_type] || 'LocaleDetails' # 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: LocalesApi#locale_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |
#locale_delete(project_id, id, opts = {}) ⇒ nil
Delete a locale Delete an existing locale.
164 165 166 167 |
# File 'lib/phrase/api/locales_api.rb', line 164 def locale_delete(project_id, id, opts = {}) data, _status_code, _headers = locale_delete_with_http_info(project_id, id, opts) data end |
#locale_delete_with_http_info(project_id, id, opts = {}) ⇒ Array<(Response, Integer, Hash)>
Delete a locale Delete an existing locale.
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 221 222 223 224 225 226 227 |
# File 'lib/phrase/api/locales_api.rb', line 177 def locale_delete_with_http_info(project_id, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LocalesApi.locale_delete ...' 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 LocalesApi.locale_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 LocalesApi.locale_delete" end # resource path local_var_path = '/projects/{project_id}/locales/{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] || {} 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'] = 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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LocalesApi#locale_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |
#locale_download(project_id, id, opts = {}) ⇒ File
Download a locale Download a locale in a specific file format.
257 258 259 260 |
# File 'lib/phrase/api/locales_api.rb', line 257 def locale_download(project_id, id, opts = {}) data, _status_code, _headers = locale_download_with_http_info(project_id, id, opts) data end |
#locale_download_with_http_info(project_id, id, opts = {}) ⇒ Array<(Response<(File)>, Integer, Hash)>
Download a locale Download a locale in a specific file format.
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/phrase/api/locales_api.rb', line 290 def locale_download_with_http_info(project_id, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LocalesApi.locale_download ...' 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 LocalesApi.locale_download" 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 LocalesApi.locale_download" end # resource path local_var_path = '/projects/{project_id}/locales/{id}/download'.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? query_params[:'file_format'] = opts[:'file_format'] if !opts[:'file_format'].nil? query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil? query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil? query_params[:'include_empty_translations'] = opts[:'include_empty_translations'] if !opts[:'include_empty_translations'].nil? query_params[:'exclude_empty_zero_forms'] = opts[:'exclude_empty_zero_forms'] if !opts[:'exclude_empty_zero_forms'].nil? query_params[:'include_translated_keys'] = opts[:'include_translated_keys'] if !opts[:'include_translated_keys'].nil? query_params[:'keep_notranslate_tags'] = opts[:'keep_notranslate_tags'] if !opts[:'keep_notranslate_tags'].nil? query_params[:'convert_emoji'] = opts[:'convert_emoji'] if !opts[:'convert_emoji'].nil? query_params[:'format_options'] = opts[:'format_options'] if !opts[:'format_options'].nil? query_params[:'encoding'] = opts[:'encoding'] if !opts[:'encoding'].nil? query_params[:'skip_unverified_translations'] = opts[:'skip_unverified_translations'] if !opts[:'skip_unverified_translations'].nil? query_params[:'include_unverified_translations'] = opts[:'include_unverified_translations'] if !opts[:'include_unverified_translations'].nil? query_params[:'use_last_reviewed_version'] = opts[:'use_last_reviewed_version'] if !opts[:'use_last_reviewed_version'].nil? query_params[:'fallback_locale_id'] = opts[:'fallback_locale_id'] if !opts[:'fallback_locale_id'].nil? query_params[:'source_locale_id'] = opts[:'source_locale_id'] if !opts[:'source_locale_id'].nil? query_params[:'translation_key_prefix'] = opts[:'translation_key_prefix'] if !opts[:'translation_key_prefix'].nil? query_params[:'filter_by_prefix'] = opts[:'filter_by_prefix'] if !opts[:'filter_by_prefix'].nil? query_params[:'custom_metadata_filters'] = opts[:'custom_metadata_filters'] if !opts[:'custom_metadata_filters'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil? header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'File' # 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: LocalesApi#locale_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |
#locale_show(project_id, id, opts = {}) ⇒ LocaleDetails
Get a single locale Get details on a single locale for a given project.
372 373 374 375 |
# File 'lib/phrase/api/locales_api.rb', line 372 def locale_show(project_id, id, opts = {}) data, _status_code, _headers = locale_show_with_http_info(project_id, id, opts) data end |
#locale_show_with_http_info(project_id, id, opts = {}) ⇒ Array<(Response<(LocaleDetails)>, Integer, Hash)>
Get a single locale Get details on a single locale for a given project.
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/phrase/api/locales_api.rb', line 385 def locale_show_with_http_info(project_id, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LocalesApi.locale_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 LocalesApi.locale_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 LocalesApi.locale_show" end # resource path local_var_path = '/projects/{project_id}/locales/{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] || 'LocaleDetails' # 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: LocalesApi#locale_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |
#locale_update(project_id, id, locale_update_parameters, opts = {}) ⇒ LocaleDetails
Update a locale Update an existing locale.
447 448 449 450 |
# File 'lib/phrase/api/locales_api.rb', line 447 def locale_update(project_id, id, locale_update_parameters, opts = {}) data, _status_code, _headers = locale_update_with_http_info(project_id, id, locale_update_parameters, opts) data end |
#locale_update_with_http_info(project_id, id, locale_update_parameters, opts = {}) ⇒ Array<(Response<(LocaleDetails)>, Integer, Hash)>
Update a locale Update an existing locale.
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'lib/phrase/api/locales_api.rb', line 460 def locale_update_with_http_info(project_id, id, locale_update_parameters, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LocalesApi.locale_update ...' 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 LocalesApi.locale_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 LocalesApi.locale_update" end # verify the required parameter 'locale_update_parameters' is set if @api_client.config.client_side_validation && locale_update_parameters.nil? fail ArgumentError, "Missing the required parameter 'locale_update_parameters' when calling LocalesApi.locale_update" end # resource path local_var_path = '/projects/{project_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(locale_update_parameters) # return_type return_type = opts[:return_type] || 'LocaleDetails' # 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(:PATCH, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LocalesApi#locale_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |
#locales_list(project_id, opts = {}) ⇒ Array<Locale>
List locales List all locales for the given project.
529 530 531 532 |
# File 'lib/phrase/api/locales_api.rb', line 529 def locales_list(project_id, opts = {}) data, _status_code, _headers = locales_list_with_http_info(project_id, opts) data end |
#locales_list_with_http_info(project_id, opts = {}) ⇒ Array<(Response<(Array<Locale>)>, Integer, Hash)>
List locales List all locales for the given project.
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 |
# File 'lib/phrase/api/locales_api.rb', line 544 def locales_list_with_http_info(project_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LocalesApi.locales_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 LocalesApi.locales_list" end # resource path local_var_path = '/projects/{project_id}/locales'.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[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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<Locale>' # 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: LocalesApi#locales_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end |