phrase 1.0.5 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/docs/BranchName.md +17 -0
- data/docs/Job.md +5 -3
- data/docs/JobDetails.md +4 -2
- data/docs/JobLocale.md +3 -1
- data/docs/LocalesApi.md +2 -0
- data/docs/ScreenshotsApi.md +3 -1
- data/docs/Webhook.md +2 -0
- data/docs/WebhookCreateParameters.md +5 -1
- data/docs/WebhookUpdateParameters.md +5 -1
- data/lib/phrase.rb +1 -0
- data/lib/phrase/api/locales_api.rb +3 -0
- data/lib/phrase/api/screenshots_api.rb +3 -0
- data/lib/phrase/api_client.rb +4 -2
- data/lib/phrase/models/branch_name.rb +194 -0
- data/lib/phrase/models/job.rb +22 -13
- data/lib/phrase/models/job_details.rb +19 -10
- data/lib/phrase/models/job_locale.rb +13 -4
- data/lib/phrase/models/webhook.rb +10 -1
- data/lib/phrase/models/webhook_create_parameters.rb +24 -4
- data/lib/phrase/models/webhook_update_parameters.rb +24 -4
- data/lib/phrase/version.rb +1 -1
- data/spec/api/locales_api_spec.rb +1 -0
- data/spec/api/screenshots_api_spec.rb +1 -0
- data/spec/models/branch_name_spec.rb +29 -0
- data/spec/models/job_details_spec.rb +9 -3
- data/spec/models/job_locale_spec.rb +6 -0
- data/spec/models/job_spec.rb +9 -3
- data/spec/models/webhook_create_parameters_spec.rb +12 -0
- data/spec/models/webhook_spec.rb +6 -0
- data/spec/models/webhook_update_parameters_spec.rb +12 -0
- metadata +166 -162
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34d17e134d85444a1c4c57c16e0b44d58a54ab1d5d9a1f4c53a62ab3f478e0b9
|
4
|
+
data.tar.gz: ef367eab838d233b6f1f8b1b34aec6de7efe75342ba5dff49e799c15b2606e76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc51d8227c5437d79aa15aedd2c14fcfcab5ef0ab139c02c71a34b7fca71bfa0b1ff9ba4be468cbb84ea9c0694ae90d4647cf88d38d89a12aabaedb341cef4b5
|
7
|
+
data.tar.gz: e9d3cc8c4acf1153641e7f7e8ee0e381d1f02772506f606b81bf04be50247fba4f9f7256c1cf6574d3e6f6adda547c14f006dee10e3f7192dfcc483a8ff3c30a
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Phrase is a translation management platform for software projects. You can colla
|
|
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: 1.0.
|
10
|
+
- Package version: 1.0.10
|
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-1.0.
|
59
|
+
gem install ./phrase-1.0.10.gem
|
60
60
|
```
|
61
61
|
|
62
|
-
(for development, run `gem install --dev ./phrase-1.0.
|
62
|
+
(for development, run `gem install --dev ./phrase-1.0.10.gem` to install the development dependencies)
|
63
63
|
|
64
64
|
## Getting Started
|
65
65
|
|
@@ -314,6 +314,7 @@ Class | Method | HTTP request | Description
|
|
314
314
|
- [Phrase::Branch](docs/Branch.md)
|
315
315
|
- [Phrase::BranchCreateParameters](docs/BranchCreateParameters.md)
|
316
316
|
- [Phrase::BranchMergeParameters](docs/BranchMergeParameters.md)
|
317
|
+
- [Phrase::BranchName](docs/BranchName.md)
|
317
318
|
- [Phrase::BranchUpdateParameters](docs/BranchUpdateParameters.md)
|
318
319
|
- [Phrase::Comment](docs/Comment.md)
|
319
320
|
- [Phrase::CommentCreateParameters](docs/CommentCreateParameters.md)
|
data/docs/BranchName.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Phrase::BranchName
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**name** | **String** | | [optional]
|
8
|
+
|
9
|
+
## Code Sample
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'Phrase'
|
13
|
+
|
14
|
+
instance = Phrase::BranchName.new(name: null)
|
15
|
+
```
|
16
|
+
|
17
|
+
|
data/docs/Job.md
CHANGED
@@ -10,9 +10,10 @@ Name | Type | Description | Notes
|
|
10
10
|
**due_date** | **DateTime** | | [optional]
|
11
11
|
**state** | **String** | | [optional]
|
12
12
|
**ticket_url** | **String** | | [optional]
|
13
|
+
**project** | [**ProjectShort**](ProjectShort.md) | | [optional]
|
14
|
+
**branch** | [**BranchName**](BranchName.md) | | [optional]
|
13
15
|
**created_at** | **DateTime** | | [optional]
|
14
16
|
**updated_at** | **DateTime** | | [optional]
|
15
|
-
**project** | [**ProjectShort**](ProjectShort.md) | | [optional]
|
16
17
|
|
17
18
|
## Code Sample
|
18
19
|
|
@@ -25,9 +26,10 @@ instance = Phrase::Job.new(id: null,
|
|
25
26
|
due_date: null,
|
26
27
|
state: null,
|
27
28
|
ticket_url: null,
|
29
|
+
project: null,
|
30
|
+
branch: null,
|
28
31
|
created_at: null,
|
29
|
-
updated_at: null
|
30
|
-
project: null)
|
32
|
+
updated_at: null)
|
31
33
|
```
|
32
34
|
|
33
35
|
|
data/docs/JobDetails.md
CHANGED
@@ -10,9 +10,10 @@ Name | Type | Description | Notes
|
|
10
10
|
**due_date** | **DateTime** | | [optional]
|
11
11
|
**state** | **String** | | [optional]
|
12
12
|
**ticket_url** | **String** | | [optional]
|
13
|
+
**project** | [**ProjectShort**](ProjectShort.md) | | [optional]
|
14
|
+
**branch** | [**BranchName**](BranchName.md) | | [optional]
|
13
15
|
**created_at** | **DateTime** | | [optional]
|
14
16
|
**updated_at** | **DateTime** | | [optional]
|
15
|
-
**project** | [**ProjectShort**](ProjectShort.md) | | [optional]
|
16
17
|
**owner** | [**UserPreview**](UserPreview.md) | | [optional]
|
17
18
|
**job_tag_name** | **String** | | [optional]
|
18
19
|
**locales** | [**Array<LocalePreview>**](LocalePreview.md) | | [optional]
|
@@ -29,9 +30,10 @@ instance = Phrase::JobDetails.new(id: null,
|
|
29
30
|
due_date: null,
|
30
31
|
state: null,
|
31
32
|
ticket_url: null,
|
33
|
+
project: null,
|
34
|
+
branch: null,
|
32
35
|
created_at: null,
|
33
36
|
updated_at: null,
|
34
|
-
project: null,
|
35
37
|
owner: null,
|
36
38
|
job_tag_name: null,
|
37
39
|
locales: null,
|
data/docs/JobLocale.md
CHANGED
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
|
|
8
8
|
**job** | [**JobPreview**](JobPreview.md) | | [optional]
|
9
9
|
**locale** | [**LocalePreview**](LocalePreview.md) | | [optional]
|
10
10
|
**users** | [**Array<UserPreview>**](UserPreview.md) | | [optional]
|
11
|
+
**completed** | **Boolean** | | [optional]
|
11
12
|
|
12
13
|
## Code Sample
|
13
14
|
|
@@ -17,7 +18,8 @@ require 'Phrase'
|
|
17
18
|
instance = Phrase::JobLocale.new(id: null,
|
18
19
|
job: null,
|
19
20
|
locale: null,
|
20
|
-
users: null
|
21
|
+
users: null,
|
22
|
+
completed: null)
|
21
23
|
```
|
22
24
|
|
23
25
|
|
data/docs/LocalesApi.md
CHANGED
@@ -174,6 +174,7 @@ opts = {
|
|
174
174
|
tags: 'feature1,feature2', # String | Limit results to keys tagged with a list of comma separated tag names.
|
175
175
|
tag: 'feature', # String | Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead
|
176
176
|
include_empty_translations: true, # Boolean | Indicates whether keys without translations should be included in the output as well.
|
177
|
+
exclude_empty_zero_forms: true, # Boolean | Indicates whether zero forms should be included when empty in pluralized keys.
|
177
178
|
include_translated_keys: true, # Boolean | Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys.
|
178
179
|
keep_notranslate_tags: true, # Boolean | Indicates whether [NOTRANSLATE] tags should be kept.
|
179
180
|
convert_emoji: true, # Boolean | This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively.
|
@@ -206,6 +207,7 @@ Name | Type | Description | Notes
|
|
206
207
|
**tags** | **String**| Limit results to keys tagged with a list of comma separated tag names. | [optional]
|
207
208
|
**tag** | **String**| Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead | [optional]
|
208
209
|
**include_empty_translations** | **Boolean**| Indicates whether keys without translations should be included in the output as well. | [optional]
|
210
|
+
**exclude_empty_zero_forms** | **Boolean**| Indicates whether zero forms should be included when empty in pluralized keys. | [optional]
|
209
211
|
**include_translated_keys** | **Boolean**| Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys. | [optional]
|
210
212
|
**keep_notranslate_tags** | **Boolean**| Indicates whether [NOTRANSLATE] tags should be kept. | [optional]
|
211
213
|
**convert_emoji** | **Boolean**| This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively. | [optional]
|
data/docs/ScreenshotsApi.md
CHANGED
@@ -294,7 +294,8 @@ project_id = 'project_id_example' # String | Project ID
|
|
294
294
|
opts = {
|
295
295
|
x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional)
|
296
296
|
page: 1, # Integer | Page number
|
297
|
-
per_page: 25 # Integer | allows you to specify a page size up to 100 items, 25 by default
|
297
|
+
per_page: 25, # Integer | allows you to specify a page size up to 100 items, 25 by default
|
298
|
+
key_id: 'abcd1234cdef1234abcd1234cdef1234' # String | filter by key
|
298
299
|
}
|
299
300
|
|
300
301
|
begin
|
@@ -315,6 +316,7 @@ Name | Type | Description | Notes
|
|
315
316
|
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
|
316
317
|
**page** | **Integer**| Page number | [optional]
|
317
318
|
**per_page** | **Integer**| allows you to specify a page size up to 100 items, 25 by default | [optional]
|
319
|
+
**key_id** | **String**| filter by key | [optional]
|
318
320
|
|
319
321
|
### Return type
|
320
322
|
|
data/docs/Webhook.md
CHANGED
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
|
|
9
9
|
**description** | **String** | | [optional]
|
10
10
|
**events** | **Array<String>** | | [optional]
|
11
11
|
**active** | **Boolean** | | [optional]
|
12
|
+
**include_branches** | **Boolean** | | [optional]
|
12
13
|
**created_at** | **DateTime** | | [optional]
|
13
14
|
**updated_at** | **DateTime** | | [optional]
|
14
15
|
|
@@ -22,6 +23,7 @@ instance = Phrase::Webhook.new(id: null,
|
|
22
23
|
description: null,
|
23
24
|
events: null,
|
24
25
|
active: null,
|
26
|
+
include_branches: null,
|
25
27
|
created_at: null,
|
26
28
|
updated_at: null)
|
27
29
|
```
|
@@ -5,9 +5,11 @@
|
|
5
5
|
Name | Type | Description | Notes
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
7
|
**callback_url** | **String** | Callback URL to send requests to | [optional]
|
8
|
+
**secret** | **String** | Webhook secret used to calculate signature. If empty, the default project secret will be used. | [optional]
|
8
9
|
**description** | **String** | Webhook description | [optional]
|
9
10
|
**events** | **String** | List of event names to trigger the webhook (separated by comma) | [optional]
|
10
11
|
**active** | **Boolean** | Whether webhook is active or inactive | [optional]
|
12
|
+
**include_branches** | **Boolean** | If enabled, webhook will also be triggered for events from branches of the project specified. | [optional]
|
11
13
|
|
12
14
|
## Code Sample
|
13
15
|
|
@@ -15,9 +17,11 @@ Name | Type | Description | Notes
|
|
15
17
|
require 'Phrase'
|
16
18
|
|
17
19
|
instance = Phrase::WebhookCreateParameters.new(callback_url: http://example.com/hooks/phraseapp-notifications,
|
20
|
+
secret: secr3t,
|
18
21
|
description: My webhook for chat notifications,
|
19
22
|
events: locales:create,translations:update,
|
20
|
-
active: null
|
23
|
+
active: null,
|
24
|
+
include_branches: null)
|
21
25
|
```
|
22
26
|
|
23
27
|
|
@@ -5,9 +5,11 @@
|
|
5
5
|
Name | Type | Description | Notes
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
7
|
**callback_url** | **String** | Callback URL to send requests to | [optional]
|
8
|
+
**secret** | **String** | Webhook secret used to calculate signature. If empty, the default project secret will be used. | [optional]
|
8
9
|
**description** | **String** | Webhook description | [optional]
|
9
10
|
**events** | **String** | List of event names to trigger the webhook (separated by comma) | [optional]
|
10
11
|
**active** | **Boolean** | Whether webhook is active or inactive | [optional]
|
12
|
+
**include_branches** | **Boolean** | If enabled, webhook will also be triggered for events from branches of the project specified. | [optional]
|
11
13
|
|
12
14
|
## Code Sample
|
13
15
|
|
@@ -15,9 +17,11 @@ Name | Type | Description | Notes
|
|
15
17
|
require 'Phrase'
|
16
18
|
|
17
19
|
instance = Phrase::WebhookUpdateParameters.new(callback_url: http://example.com/hooks/phraseapp-notifications,
|
20
|
+
secret: secr3t,
|
18
21
|
description: My webhook for chat notifications,
|
19
22
|
events: locales:create,translations:update,
|
20
|
-
active: null
|
23
|
+
active: null,
|
24
|
+
include_branches: null)
|
21
25
|
```
|
22
26
|
|
23
27
|
|
data/lib/phrase.rb
CHANGED
@@ -28,6 +28,7 @@ require 'phrase/models/blacklisted_key_update_parameters'
|
|
28
28
|
require 'phrase/models/branch'
|
29
29
|
require 'phrase/models/branch_create_parameters'
|
30
30
|
require 'phrase/models/branch_merge_parameters'
|
31
|
+
require 'phrase/models/branch_name'
|
31
32
|
require 'phrase/models/branch_update_parameters'
|
32
33
|
require 'phrase/models/comment'
|
33
34
|
require 'phrase/models/comment_create_parameters'
|
@@ -165,6 +165,7 @@ module Phrase
|
|
165
165
|
# @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
|
166
166
|
# @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead
|
167
167
|
# @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
|
168
|
+
# @option opts [Boolean] :exclude_empty_zero_forms Indicates whether zero forms should be included when empty in pluralized keys.
|
168
169
|
# @option opts [Boolean] :include_translated_keys Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys.
|
169
170
|
# @option opts [Boolean] :keep_notranslate_tags Indicates whether [NOTRANSLATE] tags should be kept.
|
170
171
|
# @option opts [Boolean] :convert_emoji This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively.
|
@@ -191,6 +192,7 @@ module Phrase
|
|
191
192
|
# @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
|
192
193
|
# @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead
|
193
194
|
# @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
|
195
|
+
# @option opts [Boolean] :exclude_empty_zero_forms Indicates whether zero forms should be included when empty in pluralized keys.
|
194
196
|
# @option opts [Boolean] :include_translated_keys Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys.
|
195
197
|
# @option opts [Boolean] :keep_notranslate_tags Indicates whether [NOTRANSLATE] tags should be kept.
|
196
198
|
# @option opts [Boolean] :convert_emoji This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively.
|
@@ -223,6 +225,7 @@ module Phrase
|
|
223
225
|
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
|
224
226
|
query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
|
225
227
|
query_params[:'include_empty_translations'] = opts[:'include_empty_translations'] if !opts[:'include_empty_translations'].nil?
|
228
|
+
query_params[:'exclude_empty_zero_forms'] = opts[:'exclude_empty_zero_forms'] if !opts[:'exclude_empty_zero_forms'].nil?
|
226
229
|
query_params[:'include_translated_keys'] = opts[:'include_translated_keys'] if !opts[:'include_translated_keys'].nil?
|
227
230
|
query_params[:'keep_notranslate_tags'] = opts[:'keep_notranslate_tags'] if !opts[:'keep_notranslate_tags'].nil?
|
228
231
|
query_params[:'convert_emoji'] = opts[:'convert_emoji'] if !opts[:'convert_emoji'].nil?
|
@@ -310,6 +310,7 @@ module Phrase
|
|
310
310
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
311
311
|
# @option opts [Integer] :page Page number
|
312
312
|
# @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
|
313
|
+
# @option opts [String] :key_id filter by key
|
313
314
|
# @return [Array<Screenshot>]
|
314
315
|
def screenshots_list(project_id, opts = {})
|
315
316
|
data, _status_code, _headers = screenshots_list_with_http_info(project_id, opts)
|
@@ -323,6 +324,7 @@ module Phrase
|
|
323
324
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
324
325
|
# @option opts [Integer] :page Page number
|
325
326
|
# @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
|
327
|
+
# @option opts [String] :key_id filter by key
|
326
328
|
# @return [Array<(Response<(Array<Screenshot>)>, Integer, Hash)>] Response<(Array<Screenshot>)> data, response status code and response headers
|
327
329
|
def screenshots_list_with_http_info(project_id, opts = {})
|
328
330
|
if @api_client.config.debugging
|
@@ -339,6 +341,7 @@ module Phrase
|
|
339
341
|
query_params = opts[:query_params] || {}
|
340
342
|
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
341
343
|
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
344
|
+
query_params[:'key_id'] = opts[:'key_id'] if !opts[:'key_id'].nil?
|
342
345
|
|
343
346
|
# header parameters
|
344
347
|
header_params = opts[:header_params] || {}
|
data/lib/phrase/api_client.rb
CHANGED
@@ -128,9 +128,11 @@ module Phrase
|
|
128
128
|
data = {}
|
129
129
|
form_params.each do |key, value|
|
130
130
|
case value
|
131
|
-
when ::File, ::Array, nil
|
132
|
-
# let typhoeus handle File, Array and nil parameters
|
131
|
+
when ::File, ::Tempfile, ::Array, nil
|
132
|
+
# let typhoeus handle File, Tempfile, Array and nil parameters
|
133
133
|
data[key] = value
|
134
|
+
when ::Hash
|
135
|
+
data[key] = build_request_body(header_params, value, body)
|
134
136
|
else
|
135
137
|
data[key] = value.to_s
|
136
138
|
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class BranchName
|
5
|
+
attr_accessor :name
|
6
|
+
|
7
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:'name' => :'name'
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
# Attribute type mapping.
|
15
|
+
def self.openapi_types
|
16
|
+
{
|
17
|
+
:'name' => :'String'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# List of attributes with nullable: true
|
22
|
+
def self.openapi_nullable
|
23
|
+
Set.new([
|
24
|
+
])
|
25
|
+
end
|
26
|
+
|
27
|
+
# Initializes the object
|
28
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
29
|
+
def initialize(attributes = {})
|
30
|
+
if (!attributes.is_a?(Hash))
|
31
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::BranchName` initialize method"
|
32
|
+
end
|
33
|
+
|
34
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
35
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
36
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
37
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::BranchName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
38
|
+
end
|
39
|
+
h[k.to_sym] = v
|
40
|
+
}
|
41
|
+
|
42
|
+
if attributes.key?(:'name')
|
43
|
+
self.name = attributes[:'name']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
48
|
+
# @return Array for valid properties with the reasons
|
49
|
+
def list_invalid_properties
|
50
|
+
invalid_properties = Array.new
|
51
|
+
invalid_properties
|
52
|
+
end
|
53
|
+
|
54
|
+
# Check to see if the all the properties in the model are valid
|
55
|
+
# @return true if the model is valid
|
56
|
+
def valid?
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
# Checks equality by comparing each attribute.
|
61
|
+
# @param [Object] Object to be compared
|
62
|
+
def ==(o)
|
63
|
+
return true if self.equal?(o)
|
64
|
+
self.class == o.class &&
|
65
|
+
name == o.name
|
66
|
+
end
|
67
|
+
|
68
|
+
# @see the `==` method
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def eql?(o)
|
71
|
+
self == o
|
72
|
+
end
|
73
|
+
|
74
|
+
# Calculates hash code according to all attributes.
|
75
|
+
# @return [Integer] Hash code
|
76
|
+
def hash
|
77
|
+
[name].hash
|
78
|
+
end
|
79
|
+
|
80
|
+
# Builds the object from hash
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
# @return [Object] Returns the model itself
|
83
|
+
def self.build_from_hash(attributes)
|
84
|
+
new.build_from_hash(attributes)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Builds the object from hash
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
89
|
+
# @return [Object] Returns the model itself
|
90
|
+
def build_from_hash(attributes)
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
92
|
+
self.class.openapi_types.each_pair do |key, type|
|
93
|
+
if type =~ /\AArray<(.*)>/i
|
94
|
+
# check to ensure the input is an array given that the attribute
|
95
|
+
# is documented as an array but the input is not
|
96
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
97
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
98
|
+
end
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
101
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
102
|
+
end
|
103
|
+
|
104
|
+
self
|
105
|
+
end
|
106
|
+
|
107
|
+
# Deserializes the data based on type
|
108
|
+
# @param string type Data type
|
109
|
+
# @param string value Value to be deserialized
|
110
|
+
# @return [Object] Deserialized data
|
111
|
+
def _deserialize(type, value)
|
112
|
+
case type.to_sym
|
113
|
+
when :DateTime
|
114
|
+
DateTime.parse(value)
|
115
|
+
when :Date
|
116
|
+
Date.parse(value)
|
117
|
+
when :String
|
118
|
+
value.to_s
|
119
|
+
when :Integer
|
120
|
+
value.to_i
|
121
|
+
when :Float
|
122
|
+
value.to_f
|
123
|
+
when :Boolean
|
124
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
125
|
+
true
|
126
|
+
else
|
127
|
+
false
|
128
|
+
end
|
129
|
+
when :Object
|
130
|
+
# generic object (usually a Hash), return directly
|
131
|
+
value
|
132
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
133
|
+
inner_type = Regexp.last_match[:inner_type]
|
134
|
+
value.map { |v| _deserialize(inner_type, v) }
|
135
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
136
|
+
k_type = Regexp.last_match[:k_type]
|
137
|
+
v_type = Regexp.last_match[:v_type]
|
138
|
+
{}.tap do |hash|
|
139
|
+
value.each do |k, v|
|
140
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
else # model
|
144
|
+
Phrase.const_get(type).build_from_hash(value)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Returns the string representation of the object
|
149
|
+
# @return [String] String presentation of the object
|
150
|
+
def to_s
|
151
|
+
to_hash.to_s
|
152
|
+
end
|
153
|
+
|
154
|
+
# to_body is an alias to to_hash (backward compatibility)
|
155
|
+
# @return [Hash] Returns the object in the form of hash
|
156
|
+
def to_body
|
157
|
+
to_hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns the object in the form of hash
|
161
|
+
# @return [Hash] Returns the object in the form of hash
|
162
|
+
def to_hash
|
163
|
+
hash = {}
|
164
|
+
self.class.attribute_map.each_pair do |attr, param|
|
165
|
+
value = self.send(attr)
|
166
|
+
if value.nil?
|
167
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
168
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
169
|
+
end
|
170
|
+
|
171
|
+
hash[param] = _to_hash(value)
|
172
|
+
end
|
173
|
+
hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Outputs non-array value in the form of hash
|
177
|
+
# For object, use to_hash. Otherwise, just return the value
|
178
|
+
# @param [Object] value Any valid value
|
179
|
+
# @return [Hash] Returns the value in the form of hash
|
180
|
+
def _to_hash(value)
|
181
|
+
if value.is_a?(Array)
|
182
|
+
value.compact.map { |v| _to_hash(v) }
|
183
|
+
elsif value.is_a?(Hash)
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
186
|
+
end
|
187
|
+
elsif value.respond_to? :to_hash
|
188
|
+
value.to_hash
|
189
|
+
else
|
190
|
+
value
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|