phrase 4.10.0 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +5 -3
- data/docs/BranchMergeParameters.md +1 -1
- data/docs/BranchSyncParameters.md +17 -0
- data/docs/BranchesApi.md +66 -1
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/ProjectCreateParameters.md +1 -1
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/lib/phrase/api/branches_api.rb +80 -2
- data/lib/phrase/models/branch_merge_parameters.rb +1 -1
- data/lib/phrase/models/branch_sync_parameters.rb +197 -0
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +1 -0
- data/spec/api/branches_api_spec.rb +16 -1
- data/spec/models/branch_sync_parameters_spec.rb +29 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2b8cd0103c3dac58522d18fbc9dcd6d2cd221e59aac25f5735092cba9c62090
|
4
|
+
data.tar.gz: fa7616166d107432c5ac1755e462ed989b24232b8377c46ee4c87c33e1915e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e05ced7788c9101d6a306f379f0d0306250af9b5c99b883366905f6dbcb44cf826531af54645ab5449cd6ac1868f56b53d64708d729a858df3060d8f8eb0c40c
|
7
|
+
data.tar.gz: a0eb92dd2ef6e0ab83ea054da78ceb45774abf206a0fc75803dcd0239218bcb62011808198d53cc5a3a7195b27daaf450a6fd87a4b33f5d1f0b8d01da6902567
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [4.11.0](https://github.com/phrase/openapi/compare/ruby-v4.10.0...ruby-v4.11.0) (2025-10-01)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* add branch sync endpoint ([#912](https://github.com/phrase/openapi/issues/912)) ([3293917](https://github.com/phrase/openapi/commit/329391757b3f81574448b1b87506b85bfdeb6761))
|
9
|
+
|
3
10
|
## [4.10.0](https://github.com/phrase/openapi/compare/ruby-v4.9.0...ruby-v4.10.0) (2025-09-30)
|
4
11
|
|
5
12
|
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Phrase Strings is a translation management platform for software projects. You c
|
|
7
7
|
## This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
8
8
|
|
9
9
|
- API version: 2.0.0
|
10
|
-
- Package version: 4.
|
10
|
+
- Package version: 4.11.0
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
12
12
|
For more information, please visit [https://developers.phrase.com/api/](https://developers.phrase.com/api/)
|
13
13
|
|
@@ -56,10 +56,10 @@ gem build phrase.gemspec
|
|
56
56
|
Then install the gem locally:
|
57
57
|
|
58
58
|
```shell
|
59
|
-
gem install ./phrase-4.
|
59
|
+
gem install ./phrase-4.11.0.gem
|
60
60
|
```
|
61
61
|
|
62
|
-
(for development, run `gem install --dev ./phrase-4.
|
62
|
+
(for development, run `gem install --dev ./phrase-4.11.0.gem` to install the development dependencies)
|
63
63
|
|
64
64
|
## Getting Started
|
65
65
|
|
@@ -154,6 +154,7 @@ Class | Method | HTTP request | Description
|
|
154
154
|
*Phrase::BranchesApi* | [**branch_delete**](docs/BranchesApi.md#branch_delete) | **DELETE** /projects/{project_id}/branches/{name} | Delete a branch
|
155
155
|
*Phrase::BranchesApi* | [**branch_merge**](docs/BranchesApi.md#branch_merge) | **PATCH** /projects/{project_id}/branches/{name}/merge | Merge a branch
|
156
156
|
*Phrase::BranchesApi* | [**branch_show**](docs/BranchesApi.md#branch_show) | **GET** /projects/{project_id}/branches/{name} | Get a single branch
|
157
|
+
*Phrase::BranchesApi* | [**branch_sync**](docs/BranchesApi.md#branch_sync) | **PATCH** /projects/{project_id}/branches/{name}/sync | Sync a branch
|
157
158
|
*Phrase::BranchesApi* | [**branch_update**](docs/BranchesApi.md#branch_update) | **PATCH** /projects/{project_id}/branches/{name} | Update a branch
|
158
159
|
*Phrase::BranchesApi* | [**branches_list**](docs/BranchesApi.md#branches_list) | **GET** /projects/{project_id}/branches | List branches
|
159
160
|
*Phrase::CommentReactionsApi* | [**reaction_create**](docs/CommentReactionsApi.md#reaction_create) | **POST** /projects/{project_id}/keys/{key_id}/comments/{comment_id}/reactions | Create a reaction
|
@@ -435,6 +436,7 @@ Class | Method | HTTP request | Description
|
|
435
436
|
- [Phrase::BranchCreateParameters](docs/BranchCreateParameters.md)
|
436
437
|
- [Phrase::BranchMergeParameters](docs/BranchMergeParameters.md)
|
437
438
|
- [Phrase::BranchName](docs/BranchName.md)
|
439
|
+
- [Phrase::BranchSyncParameters](docs/BranchSyncParameters.md)
|
438
440
|
- [Phrase::BranchUpdateParameters](docs/BranchUpdateParameters.md)
|
439
441
|
- [Phrase::Comment](docs/Comment.md)
|
440
442
|
- [Phrase::CommentCreateParameters](docs/CommentCreateParameters.md)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Name | Type | Description | Notes
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
|
-
**strategy** | **String** | strategy used for merge
|
7
|
+
**strategy** | **String** | strategy used for merge conflicts, use_main or use_branch | [optional]
|
8
8
|
|
9
9
|
## Code Sample
|
10
10
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Phrase::BranchSyncParameters
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**strategy** | **String** | strategy used for conflicts, use_main or use_branch | [optional]
|
8
|
+
|
9
|
+
## Code Sample
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'Phrase'
|
13
|
+
|
14
|
+
instance = Phrase::BranchSyncParameters.new(strategy: use_main)
|
15
|
+
```
|
16
|
+
|
17
|
+
|
data/docs/BranchesApi.md
CHANGED
@@ -9,6 +9,7 @@ Method | HTTP request | Description
|
|
9
9
|
[**branch_delete**](BranchesApi.md#branch_delete) | **DELETE** /projects/{project_id}/branches/{name} | Delete a branch
|
10
10
|
[**branch_merge**](BranchesApi.md#branch_merge) | **PATCH** /projects/{project_id}/branches/{name}/merge | Merge a branch
|
11
11
|
[**branch_show**](BranchesApi.md#branch_show) | **GET** /projects/{project_id}/branches/{name} | Get a single branch
|
12
|
+
[**branch_sync**](BranchesApi.md#branch_sync) | **PATCH** /projects/{project_id}/branches/{name}/sync | Sync a branch
|
12
13
|
[**branch_update**](BranchesApi.md#branch_update) | **PATCH** /projects/{project_id}/branches/{name} | Update a branch
|
13
14
|
[**branches_list**](BranchesApi.md#branches_list) | **GET** /projects/{project_id}/branches | List branches
|
14
15
|
|
@@ -207,7 +208,7 @@ Response<(nil (empty response body))>
|
|
207
208
|
|
208
209
|
Merge a branch
|
209
210
|
|
210
|
-
Merge an existing branch.
|
211
|
+
Merge an existing branch. *Note: Merging a branch may take several minutes depending on diff size.*
|
211
212
|
|
212
213
|
### Example
|
213
214
|
|
@@ -328,6 +329,70 @@ Response<([**Branch**](Branch.md))>
|
|
328
329
|
- **Accept**: application/json
|
329
330
|
|
330
331
|
|
332
|
+
## branch_sync
|
333
|
+
|
334
|
+
> branch_sync(project_id, name, branch_sync_parameters, opts)
|
335
|
+
|
336
|
+
Sync a branch
|
337
|
+
|
338
|
+
Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta*
|
339
|
+
|
340
|
+
### Example
|
341
|
+
|
342
|
+
```ruby
|
343
|
+
# load the gem
|
344
|
+
require 'phrase'
|
345
|
+
# setup authorization
|
346
|
+
Phrase.configure do |config|
|
347
|
+
# Configure HTTP basic authorization: Basic
|
348
|
+
config.username = 'YOUR USERNAME'
|
349
|
+
config.password = 'YOUR PASSWORD'
|
350
|
+
|
351
|
+
# Configure API key authorization: Token
|
352
|
+
config.api_key['Authorization'] = 'YOUR API KEY'
|
353
|
+
config.api_key_prefix['Authorization'] = 'token'
|
354
|
+
end
|
355
|
+
|
356
|
+
api_instance = Phrase::BranchesApi.new
|
357
|
+
project_id = 'project_id_example' # String | Project ID
|
358
|
+
name = 'name_example' # String | name
|
359
|
+
branch_sync_parameters = Phrase::BranchSyncParameters.new # BranchSyncParameters |
|
360
|
+
opts = {
|
361
|
+
x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
|
362
|
+
}
|
363
|
+
|
364
|
+
begin
|
365
|
+
#Sync a branch
|
366
|
+
api_instance.branch_sync(project_id, name, branch_sync_parameters, opts)
|
367
|
+
rescue Phrase::ApiError => e
|
368
|
+
puts "Exception when calling BranchesApi->branch_sync: #{e}"
|
369
|
+
end
|
370
|
+
```
|
371
|
+
|
372
|
+
### Parameters
|
373
|
+
|
374
|
+
|
375
|
+
Name | Type | Description | Notes
|
376
|
+
------------- | ------------- | ------------- | -------------
|
377
|
+
**project_id** | **String**| Project ID |
|
378
|
+
**name** | **String**| name |
|
379
|
+
**branch_sync_parameters** | [**BranchSyncParameters**](BranchSyncParameters.md)| |
|
380
|
+
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
|
381
|
+
|
382
|
+
### Return type
|
383
|
+
|
384
|
+
Response<(nil (empty response body))>
|
385
|
+
|
386
|
+
### Authorization
|
387
|
+
|
388
|
+
[Basic](../README.md#Basic), [Token](../README.md#Token)
|
389
|
+
|
390
|
+
### HTTP request headers
|
391
|
+
|
392
|
+
- **Content-Type**: application/json
|
393
|
+
- **Accept**: Not defined
|
394
|
+
|
395
|
+
|
331
396
|
## branch_update
|
332
397
|
|
333
398
|
> Branch branch_update(project_id, name, branch_update_parameters, opts)
|
data/docs/KeyCreateParameters.md
CHANGED
@@ -38,7 +38,7 @@ instance = Phrase::KeyCreateParameters.new(branch: my-feature-branch,
|
|
38
38
|
data_type: number,
|
39
39
|
tags: awesome-feature,needs-proofreading,
|
40
40
|
max_characters_allowed: 140,
|
41
|
-
screenshot: [B@
|
41
|
+
screenshot: [B@13421eb0,
|
42
42
|
remove_screenshot: null,
|
43
43
|
unformatted: null,
|
44
44
|
default_translation_content: Default translation content,
|
data/docs/KeyUpdateParameters.md
CHANGED
@@ -36,7 +36,7 @@ instance = Phrase::KeyUpdateParameters.new(branch: my-feature-branch,
|
|
36
36
|
data_type: number,
|
37
37
|
tags: awesome-feature,needs-proofreading,
|
38
38
|
max_characters_allowed: 140,
|
39
|
-
screenshot: [B@
|
39
|
+
screenshot: [B@bf68379,
|
40
40
|
remove_screenshot: null,
|
41
41
|
unformatted: null,
|
42
42
|
xml_space_preserve: null,
|
@@ -37,7 +37,7 @@ instance = Phrase::ProjectCreateParameters.new(name: My Android Project,
|
|
37
37
|
main_format: yml,
|
38
38
|
media: Python,
|
39
39
|
shares_translation_memory: true,
|
40
|
-
project_image: [B@
|
40
|
+
project_image: [B@c34e260,
|
41
41
|
remove_project_image: null,
|
42
42
|
account_id: abcd1234,
|
43
43
|
point_of_contact: abcd1234,
|
@@ -39,7 +39,7 @@ instance = Phrase::ProjectUpdateParameters.new(account_id: abcd1234,
|
|
39
39
|
main_format: yml,
|
40
40
|
media: Python,
|
41
41
|
shares_translation_memory: true,
|
42
|
-
project_image: [B@
|
42
|
+
project_image: [B@39342312,
|
43
43
|
remove_project_image: false,
|
44
44
|
workflow: review,
|
45
45
|
machine_translation_enabled: true,
|
@@ -222,7 +222,7 @@ module Phrase
|
|
222
222
|
end
|
223
223
|
|
224
224
|
# Merge a branch
|
225
|
-
# Merge an existing branch.
|
225
|
+
# Merge an existing branch. *Note: Merging a branch may take several minutes depending on diff size.*
|
226
226
|
# @param project_id [String] Project ID
|
227
227
|
# @param name [String] name
|
228
228
|
# @param branch_merge_parameters [BranchMergeParameters]
|
@@ -235,7 +235,7 @@ module Phrase
|
|
235
235
|
end
|
236
236
|
|
237
237
|
# Merge a branch
|
238
|
-
# Merge an existing branch.
|
238
|
+
# Merge an existing branch. *Note: Merging a branch may take several minutes depending on diff size.*
|
239
239
|
# @param project_id [String] Project ID
|
240
240
|
# @param name [String] name
|
241
241
|
# @param branch_merge_parameters [BranchMergeParameters]
|
@@ -371,6 +371,84 @@ module Phrase
|
|
371
371
|
return response, status_code, headers
|
372
372
|
end
|
373
373
|
|
374
|
+
# Sync a branch
|
375
|
+
# Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta*
|
376
|
+
# @param project_id [String] Project ID
|
377
|
+
# @param name [String] name
|
378
|
+
# @param branch_sync_parameters [BranchSyncParameters]
|
379
|
+
# @param [Hash] opts the optional parameters
|
380
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
381
|
+
# @return [nil]
|
382
|
+
def branch_sync(project_id, name, branch_sync_parameters, opts = {})
|
383
|
+
data, _status_code, _headers = branch_sync_with_http_info(project_id, name, branch_sync_parameters, opts)
|
384
|
+
data
|
385
|
+
end
|
386
|
+
|
387
|
+
# Sync a branch
|
388
|
+
# Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta*
|
389
|
+
# @param project_id [String] Project ID
|
390
|
+
# @param name [String] name
|
391
|
+
# @param branch_sync_parameters [BranchSyncParameters]
|
392
|
+
# @param [Hash] opts the optional parameters
|
393
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
394
|
+
# @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
|
395
|
+
def branch_sync_with_http_info(project_id, name, branch_sync_parameters, opts = {})
|
396
|
+
if @api_client.config.debugging
|
397
|
+
@api_client.config.logger.debug 'Calling API: BranchesApi.branch_sync ...'
|
398
|
+
end
|
399
|
+
# verify the required parameter 'project_id' is set
|
400
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
401
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling BranchesApi.branch_sync"
|
402
|
+
end
|
403
|
+
# verify the required parameter 'name' is set
|
404
|
+
if @api_client.config.client_side_validation && name.nil?
|
405
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling BranchesApi.branch_sync"
|
406
|
+
end
|
407
|
+
# verify the required parameter 'branch_sync_parameters' is set
|
408
|
+
if @api_client.config.client_side_validation && branch_sync_parameters.nil?
|
409
|
+
fail ArgumentError, "Missing the required parameter 'branch_sync_parameters' when calling BranchesApi.branch_sync"
|
410
|
+
end
|
411
|
+
# resource path
|
412
|
+
local_var_path = '/projects/{project_id}/branches/{name}/sync'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))
|
413
|
+
|
414
|
+
# query parameters
|
415
|
+
query_params = opts[:query_params] || {}
|
416
|
+
|
417
|
+
# header parameters
|
418
|
+
header_params = opts[:header_params] || {}
|
419
|
+
# HTTP header 'Content-Type'
|
420
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
421
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
422
|
+
|
423
|
+
# form parameters
|
424
|
+
form_params = opts[:form_params] || {}
|
425
|
+
|
426
|
+
# http body (model)
|
427
|
+
post_body = opts[:body] || @api_client.object_to_http_body(branch_sync_parameters)
|
428
|
+
|
429
|
+
# return_type
|
430
|
+
return_type = opts[:return_type]
|
431
|
+
|
432
|
+
# auth_names
|
433
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
434
|
+
|
435
|
+
new_options = opts.merge(
|
436
|
+
:header_params => header_params,
|
437
|
+
:query_params => query_params,
|
438
|
+
:form_params => form_params,
|
439
|
+
:body => post_body,
|
440
|
+
:auth_names => auth_names,
|
441
|
+
:return_type => return_type
|
442
|
+
)
|
443
|
+
|
444
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
445
|
+
if @api_client.config.debugging
|
446
|
+
@api_client.config.logger.debug "API called: BranchesApi#branch_sync\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
447
|
+
end
|
448
|
+
response = ::Phrase::Response.new(data, headers)
|
449
|
+
return response, status_code, headers
|
450
|
+
end
|
451
|
+
|
374
452
|
# Update a branch
|
375
453
|
# Update an existing branch.
|
376
454
|
# @param project_id [String] Project ID
|
@@ -2,7 +2,7 @@ require 'date'
|
|
2
2
|
|
3
3
|
module Phrase
|
4
4
|
class BranchMergeParameters
|
5
|
-
# strategy used for merge
|
5
|
+
# strategy used for merge conflicts, use_main or use_branch
|
6
6
|
attr_accessor :strategy
|
7
7
|
|
8
8
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -0,0 +1,197 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class BranchSyncParameters
|
5
|
+
# strategy used for conflicts, use_main or use_branch
|
6
|
+
attr_accessor :strategy
|
7
|
+
|
8
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
9
|
+
def self.attribute_map
|
10
|
+
{
|
11
|
+
:'strategy' => :'strategy'
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Attribute type mapping.
|
16
|
+
def self.openapi_types
|
17
|
+
{
|
18
|
+
:'strategy' => :'String'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# List of attributes with nullable: true
|
23
|
+
def self.openapi_nullable
|
24
|
+
Set.new([
|
25
|
+
])
|
26
|
+
end
|
27
|
+
|
28
|
+
# Initializes the object
|
29
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
30
|
+
def initialize(attributes = {})
|
31
|
+
if (!attributes.is_a?(Hash))
|
32
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::BranchSyncParameters` initialize method"
|
33
|
+
end
|
34
|
+
|
35
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
36
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
37
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
38
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::BranchSyncParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
39
|
+
end
|
40
|
+
h[k.to_sym] = v
|
41
|
+
}
|
42
|
+
|
43
|
+
if attributes.key?(:'strategy')
|
44
|
+
self.strategy = attributes[:'strategy']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
49
|
+
# @return Array for valid properties with the reasons
|
50
|
+
def list_invalid_properties
|
51
|
+
invalid_properties = Array.new
|
52
|
+
invalid_properties
|
53
|
+
end
|
54
|
+
|
55
|
+
# Check to see if the all the properties in the model are valid
|
56
|
+
# @return true if the model is valid
|
57
|
+
def valid?
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Checks equality by comparing each attribute.
|
62
|
+
# @param [Object] Object to be compared
|
63
|
+
def ==(o)
|
64
|
+
return true if self.equal?(o)
|
65
|
+
self.class == o.class &&
|
66
|
+
strategy == o.strategy
|
67
|
+
end
|
68
|
+
|
69
|
+
# @see the `==` method
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def eql?(o)
|
72
|
+
self == o
|
73
|
+
end
|
74
|
+
|
75
|
+
# Calculates hash code according to all attributes.
|
76
|
+
# @return [Integer] Hash code
|
77
|
+
def hash
|
78
|
+
[strategy].hash
|
79
|
+
end
|
80
|
+
|
81
|
+
# Builds the object from hash
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
83
|
+
# @return [Object] Returns the model itself
|
84
|
+
def self.build_from_hash(attributes)
|
85
|
+
new.build_from_hash(attributes)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Builds the object from hash
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
90
|
+
# @return [Object] Returns the model itself
|
91
|
+
def build_from_hash(attributes)
|
92
|
+
return nil unless attributes.is_a?(Hash)
|
93
|
+
self.class.openapi_types.each_pair do |key, type|
|
94
|
+
if type =~ /\AArray<(.*)>/i
|
95
|
+
# check to ensure the input is an array given that the attribute
|
96
|
+
# is documented as an array but the input is not
|
97
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
98
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
99
|
+
end
|
100
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
101
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
102
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
103
|
+
end
|
104
|
+
|
105
|
+
self
|
106
|
+
end
|
107
|
+
|
108
|
+
# Deserializes the data based on type
|
109
|
+
# @param string type Data type
|
110
|
+
# @param string value Value to be deserialized
|
111
|
+
# @return [Object] Deserialized data
|
112
|
+
def _deserialize(type, value)
|
113
|
+
case type.to_sym
|
114
|
+
when :DateTime
|
115
|
+
DateTime.parse(value)
|
116
|
+
when :Date
|
117
|
+
Date.parse(value)
|
118
|
+
when :Time
|
119
|
+
Time.parse(value)
|
120
|
+
when :String
|
121
|
+
value.to_s
|
122
|
+
when :Integer
|
123
|
+
value.to_i
|
124
|
+
when :Float
|
125
|
+
value.to_f
|
126
|
+
when :Boolean
|
127
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
128
|
+
true
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
when :Object
|
133
|
+
# generic object (usually a Hash), return directly
|
134
|
+
value
|
135
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
136
|
+
inner_type = Regexp.last_match[:inner_type]
|
137
|
+
value.map { |v| _deserialize(inner_type, v) }
|
138
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
139
|
+
k_type = Regexp.last_match[:k_type]
|
140
|
+
v_type = Regexp.last_match[:v_type]
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each do |k, v|
|
143
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
else # model
|
147
|
+
Phrase.const_get(type).build_from_hash(value)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns the string representation of the object
|
152
|
+
# @return [String] String presentation of the object
|
153
|
+
def to_s
|
154
|
+
to_hash.to_s
|
155
|
+
end
|
156
|
+
|
157
|
+
# to_body is an alias to to_hash (backward compatibility)
|
158
|
+
# @return [Hash] Returns the object in the form of hash
|
159
|
+
def to_body
|
160
|
+
to_hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the object in the form of hash
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
165
|
+
def to_hash
|
166
|
+
hash = {}
|
167
|
+
self.class.attribute_map.each_pair do |attr, param|
|
168
|
+
value = self.send(attr)
|
169
|
+
if value.nil?
|
170
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
171
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
172
|
+
end
|
173
|
+
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
# @param [Object] value Any valid value
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map { |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
data/lib/phrase/version.rb
CHANGED
data/lib/phrase.rb
CHANGED
@@ -27,6 +27,7 @@ require 'phrase/models/branch'
|
|
27
27
|
require 'phrase/models/branch_create_parameters'
|
28
28
|
require 'phrase/models/branch_merge_parameters'
|
29
29
|
require 'phrase/models/branch_name'
|
30
|
+
require 'phrase/models/branch_sync_parameters'
|
30
31
|
require 'phrase/models/branch_update_parameters'
|
31
32
|
require 'phrase/models/comment'
|
32
33
|
require 'phrase/models/comment_create_parameters'
|
@@ -64,7 +64,7 @@ describe 'BranchesApi' do
|
|
64
64
|
|
65
65
|
# unit tests for branch_merge
|
66
66
|
# Merge a branch
|
67
|
-
# Merge an existing branch.
|
67
|
+
# Merge an existing branch. *Note: Merging a branch may take several minutes depending on diff size.*
|
68
68
|
# @param project_id Project ID
|
69
69
|
# @param name name
|
70
70
|
# @param branch_merge_parameters
|
@@ -91,6 +91,21 @@ describe 'BranchesApi' do
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
# unit tests for branch_sync
|
95
|
+
# Sync a branch
|
96
|
+
# Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta*
|
97
|
+
# @param project_id Project ID
|
98
|
+
# @param name name
|
99
|
+
# @param branch_sync_parameters
|
100
|
+
# @param [Hash] opts the optional parameters
|
101
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
102
|
+
# @return [nil]
|
103
|
+
describe 'branch_sync test' do
|
104
|
+
it 'should work' do
|
105
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
94
109
|
# unit tests for branch_update
|
95
110
|
# Update a branch
|
96
111
|
# Update an existing branch.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
# Unit tests for Phrase::BranchSyncParameters
|
6
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
7
|
+
# Please update as you see appropriate
|
8
|
+
describe 'BranchSyncParameters' do
|
9
|
+
before do
|
10
|
+
# run before each test
|
11
|
+
@instance = Phrase::BranchSyncParameters.new
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
# run after each test
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'test an instance of BranchSyncParameters' do
|
19
|
+
it 'should create an instance of BranchSyncParameters' do
|
20
|
+
expect(@instance).to be_instance_of(Phrase::BranchSyncParameters)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "strategy"' do
|
24
|
+
it 'should work' do
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phrase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phrase
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- docs/BranchCreateParameters.md
|
102
102
|
- docs/BranchMergeParameters.md
|
103
103
|
- docs/BranchName.md
|
104
|
+
- docs/BranchSyncParameters.md
|
104
105
|
- docs/BranchUpdateParameters.md
|
105
106
|
- docs/BranchesApi.md
|
106
107
|
- docs/Comment.md
|
@@ -432,6 +433,7 @@ files:
|
|
432
433
|
- lib/phrase/models/branch_create_parameters.rb
|
433
434
|
- lib/phrase/models/branch_merge_parameters.rb
|
434
435
|
- lib/phrase/models/branch_name.rb
|
436
|
+
- lib/phrase/models/branch_sync_parameters.rb
|
435
437
|
- lib/phrase/models/branch_update_parameters.rb
|
436
438
|
- lib/phrase/models/comment.rb
|
437
439
|
- lib/phrase/models/comment_create_parameters.rb
|
@@ -711,6 +713,7 @@ files:
|
|
711
713
|
- spec/models/branch_merge_parameters_spec.rb
|
712
714
|
- spec/models/branch_name_spec.rb
|
713
715
|
- spec/models/branch_spec.rb
|
716
|
+
- spec/models/branch_sync_parameters_spec.rb
|
714
717
|
- spec/models/branch_update_parameters_spec.rb
|
715
718
|
- spec/models/comment_create_parameters1_spec.rb
|
716
719
|
- spec/models/comment_create_parameters_spec.rb
|
@@ -1182,6 +1185,7 @@ test_files:
|
|
1182
1185
|
- spec/models/job_locale_complete_review_parameters_spec.rb
|
1183
1186
|
- spec/models/screenshot_marker_update_parameters_spec.rb
|
1184
1187
|
- spec/models/distribution_create_parameters_spec.rb
|
1188
|
+
- spec/models/branch_sync_parameters_spec.rb
|
1185
1189
|
- spec/models/quality_performance_score_list_request_spec.rb
|
1186
1190
|
- spec/models/distribution_update_parameters_spec.rb
|
1187
1191
|
- spec/models/affected_count_spec.rb
|