phrase 2.5.1 → 2.7.1
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/README.md +14 -4
- data/docs/IcuSkeletonParameters.md +2 -0
- data/docs/Invitation.md +3 -3
- data/docs/JobComment.md +29 -0
- data/docs/JobCommentCreateParameters.md +17 -0
- data/docs/JobCommentUpdateParameters.md +17 -0
- data/docs/JobCommentsApi.md +343 -0
- data/docs/JobCreateParameters.md +3 -1
- data/docs/JobsApi.md +130 -0
- data/docs/KeyCreateParameters.md +2 -0
- data/docs/Member.md +1 -1
- data/docs/ScreenshotsApi.md +12 -6
- data/docs/StyleguideCreateParameters.md +1 -1
- data/docs/StyleguideUpdateParameters.md +1 -1
- data/docs/{Team1.md → TeamShort.md} +2 -2
- data/lib/phrase/api/job_comments_api.rb +411 -0
- data/lib/phrase/api/jobs_api.rb +146 -0
- data/lib/phrase/api/screenshots_api.rb +17 -11
- data/lib/phrase/models/icu_skeleton_parameters.rb +11 -1
- data/lib/phrase/models/invitation.rb +13 -13
- data/lib/phrase/models/job_comment.rb +250 -0
- data/lib/phrase/models/job_comment_create_parameters.rb +195 -0
- data/lib/phrase/models/job_comment_update_parameters.rb +195 -0
- data/lib/phrase/models/job_create_parameters.rb +14 -4
- data/lib/phrase/models/key_create_parameters.rb +11 -1
- data/lib/phrase/models/member.rb +1 -1
- data/lib/phrase/models/{team1.rb → team_short.rb} +3 -3
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +5 -1
- data/spec/api/job_comments_api_spec.rb +101 -0
- data/spec/api/jobs_api_spec.rb +30 -0
- data/spec/api/screenshots_api_spec.rb +4 -1
- data/spec/models/icu_skeleton_parameters_spec.rb +6 -0
- data/spec/models/invitation_spec.rb +6 -6
- data/spec/models/job_comment_create_parameters_spec.rb +29 -0
- data/spec/models/job_comment_spec.rb +65 -0
- data/spec/models/job_comment_update_parameters_spec.rb +29 -0
- data/spec/models/job_create_parameters_spec.rb +6 -0
- data/spec/models/key_create_parameters_spec.rb +6 -0
- data/spec/models/{team1_spec.rb → team_short_spec.rb} +6 -6
- metadata +217 -201
data/lib/phrase/api/jobs_api.rb
CHANGED
@@ -390,6 +390,79 @@ module Phrase
|
|
390
390
|
return response, status_code, headers
|
391
391
|
end
|
392
392
|
|
393
|
+
# Lock a job
|
394
|
+
# If you are the job owner, you may lock a job using this API request.
|
395
|
+
# @param project_id [String] Project ID
|
396
|
+
# @param id [String] ID
|
397
|
+
# @param [Hash] opts the optional parameters
|
398
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
399
|
+
# @option opts [String] :branch specify the branch to use
|
400
|
+
# @return [nil]
|
401
|
+
def job_lock(project_id, id, opts = {})
|
402
|
+
data, _status_code, _headers = job_lock_with_http_info(project_id, id, opts)
|
403
|
+
data
|
404
|
+
end
|
405
|
+
|
406
|
+
# Lock a job
|
407
|
+
# If you are the job owner, you may lock a job using this API request.
|
408
|
+
# @param project_id [String] Project ID
|
409
|
+
# @param id [String] ID
|
410
|
+
# @param [Hash] opts the optional parameters
|
411
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
412
|
+
# @option opts [String] :branch specify the branch to use
|
413
|
+
# @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
|
414
|
+
def job_lock_with_http_info(project_id, id, opts = {})
|
415
|
+
if @api_client.config.debugging
|
416
|
+
@api_client.config.logger.debug 'Calling API: JobsApi.job_lock ...'
|
417
|
+
end
|
418
|
+
# verify the required parameter 'project_id' is set
|
419
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
420
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_lock"
|
421
|
+
end
|
422
|
+
# verify the required parameter 'id' is set
|
423
|
+
if @api_client.config.client_side_validation && id.nil?
|
424
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling JobsApi.job_lock"
|
425
|
+
end
|
426
|
+
# resource path
|
427
|
+
local_var_path = '/projects/{project_id}/jobs/{id}/lock'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
428
|
+
|
429
|
+
# query parameters
|
430
|
+
query_params = opts[:query_params] || {}
|
431
|
+
query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
432
|
+
|
433
|
+
# header parameters
|
434
|
+
header_params = opts[:header_params] || {}
|
435
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
436
|
+
|
437
|
+
# form parameters
|
438
|
+
form_params = opts[:form_params] || {}
|
439
|
+
|
440
|
+
# http body (model)
|
441
|
+
post_body = opts[:body]
|
442
|
+
|
443
|
+
# return_type
|
444
|
+
return_type = opts[:return_type]
|
445
|
+
|
446
|
+
# auth_names
|
447
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
448
|
+
|
449
|
+
new_options = opts.merge(
|
450
|
+
:header_params => header_params,
|
451
|
+
:query_params => query_params,
|
452
|
+
:form_params => form_params,
|
453
|
+
:body => post_body,
|
454
|
+
:auth_names => auth_names,
|
455
|
+
:return_type => return_type
|
456
|
+
)
|
457
|
+
|
458
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
459
|
+
if @api_client.config.debugging
|
460
|
+
@api_client.config.logger.debug "API called: JobsApi#job_lock\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
461
|
+
end
|
462
|
+
response = ::Phrase::Response.new(data, headers)
|
463
|
+
return response, status_code, headers
|
464
|
+
end
|
465
|
+
|
393
466
|
# Reopen a job
|
394
467
|
# Mark a job as uncompleted.
|
395
468
|
# @param project_id [String] Project ID
|
@@ -625,6 +698,79 @@ module Phrase
|
|
625
698
|
return response, status_code, headers
|
626
699
|
end
|
627
700
|
|
701
|
+
# Unlock a job
|
702
|
+
# If you are the job owner, you may unlock a locked job using this API request.
|
703
|
+
# @param project_id [String] Project ID
|
704
|
+
# @param id [String] ID
|
705
|
+
# @param [Hash] opts the optional parameters
|
706
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
707
|
+
# @option opts [String] :branch specify the branch to use
|
708
|
+
# @return [nil]
|
709
|
+
def job_unlock(project_id, id, opts = {})
|
710
|
+
data, _status_code, _headers = job_unlock_with_http_info(project_id, id, opts)
|
711
|
+
data
|
712
|
+
end
|
713
|
+
|
714
|
+
# Unlock a job
|
715
|
+
# If you are the job owner, you may unlock a locked job using this API request.
|
716
|
+
# @param project_id [String] Project ID
|
717
|
+
# @param id [String] ID
|
718
|
+
# @param [Hash] opts the optional parameters
|
719
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
720
|
+
# @option opts [String] :branch specify the branch to use
|
721
|
+
# @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
|
722
|
+
def job_unlock_with_http_info(project_id, id, opts = {})
|
723
|
+
if @api_client.config.debugging
|
724
|
+
@api_client.config.logger.debug 'Calling API: JobsApi.job_unlock ...'
|
725
|
+
end
|
726
|
+
# verify the required parameter 'project_id' is set
|
727
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
728
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_unlock"
|
729
|
+
end
|
730
|
+
# verify the required parameter 'id' is set
|
731
|
+
if @api_client.config.client_side_validation && id.nil?
|
732
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling JobsApi.job_unlock"
|
733
|
+
end
|
734
|
+
# resource path
|
735
|
+
local_var_path = '/projects/{project_id}/jobs/{id}/unlock'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
736
|
+
|
737
|
+
# query parameters
|
738
|
+
query_params = opts[:query_params] || {}
|
739
|
+
query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
740
|
+
|
741
|
+
# header parameters
|
742
|
+
header_params = opts[:header_params] || {}
|
743
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
744
|
+
|
745
|
+
# form parameters
|
746
|
+
form_params = opts[:form_params] || {}
|
747
|
+
|
748
|
+
# http body (model)
|
749
|
+
post_body = opts[:body]
|
750
|
+
|
751
|
+
# return_type
|
752
|
+
return_type = opts[:return_type]
|
753
|
+
|
754
|
+
# auth_names
|
755
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
756
|
+
|
757
|
+
new_options = opts.merge(
|
758
|
+
:header_params => header_params,
|
759
|
+
:query_params => query_params,
|
760
|
+
:form_params => form_params,
|
761
|
+
:body => post_body,
|
762
|
+
:auth_names => auth_names,
|
763
|
+
:return_type => return_type
|
764
|
+
)
|
765
|
+
|
766
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
767
|
+
if @api_client.config.debugging
|
768
|
+
@api_client.config.logger.debug "API called: JobsApi#job_unlock\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
769
|
+
end
|
770
|
+
response = ::Phrase::Response.new(data, headers)
|
771
|
+
return response, status_code, headers
|
772
|
+
end
|
773
|
+
|
628
774
|
# Update a job
|
629
775
|
# Update an existing job.
|
630
776
|
# @param project_id [String] Project ID
|
@@ -10,23 +10,29 @@ module Phrase
|
|
10
10
|
# Create a screenshot
|
11
11
|
# Create a new screenshot.
|
12
12
|
# @param project_id [String] Project ID
|
13
|
-
# @param screenshot_create_parameters [ScreenshotCreateParameters]
|
14
13
|
# @param [Hash] opts the optional parameters
|
15
14
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
15
|
+
# @option opts [String] :branch specify the branch to use
|
16
|
+
# @option opts [String] :name Name of the screenshot
|
17
|
+
# @option opts [String] :description Description of the screenshot
|
18
|
+
# @option opts [File] :filename Screenshot file
|
16
19
|
# @return [Screenshot]
|
17
|
-
def screenshot_create(project_id,
|
18
|
-
data, _status_code, _headers = screenshot_create_with_http_info(project_id,
|
20
|
+
def screenshot_create(project_id, opts = {})
|
21
|
+
data, _status_code, _headers = screenshot_create_with_http_info(project_id, opts)
|
19
22
|
data
|
20
23
|
end
|
21
24
|
|
22
25
|
# Create a screenshot
|
23
26
|
# Create a new screenshot.
|
24
27
|
# @param project_id [String] Project ID
|
25
|
-
# @param screenshot_create_parameters [ScreenshotCreateParameters]
|
26
28
|
# @param [Hash] opts the optional parameters
|
27
29
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
30
|
+
# @option opts [String] :branch specify the branch to use
|
31
|
+
# @option opts [String] :name Name of the screenshot
|
32
|
+
# @option opts [String] :description Description of the screenshot
|
33
|
+
# @option opts [File] :filename Screenshot file
|
28
34
|
# @return [Array<(Response<(Screenshot)>, Integer, Hash)>] Response<(Screenshot)> data, response status code and response headers
|
29
|
-
def screenshot_create_with_http_info(project_id,
|
35
|
+
def screenshot_create_with_http_info(project_id, opts = {})
|
30
36
|
if @api_client.config.debugging
|
31
37
|
@api_client.config.logger.debug 'Calling API: ScreenshotsApi.screenshot_create ...'
|
32
38
|
end
|
@@ -34,10 +40,6 @@ module Phrase
|
|
34
40
|
if @api_client.config.client_side_validation && project_id.nil?
|
35
41
|
fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotsApi.screenshot_create"
|
36
42
|
end
|
37
|
-
# verify the required parameter 'screenshot_create_parameters' is set
|
38
|
-
if @api_client.config.client_side_validation && screenshot_create_parameters.nil?
|
39
|
-
fail ArgumentError, "Missing the required parameter 'screenshot_create_parameters' when calling ScreenshotsApi.screenshot_create"
|
40
|
-
end
|
41
43
|
# resource path
|
42
44
|
local_var_path = '/projects/{project_id}/screenshots'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
|
43
45
|
|
@@ -49,14 +51,18 @@ module Phrase
|
|
49
51
|
# HTTP header 'Accept' (if needed)
|
50
52
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
51
53
|
# HTTP header 'Content-Type'
|
52
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['
|
54
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
53
55
|
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
54
56
|
|
55
57
|
# form parameters
|
56
58
|
form_params = opts[:form_params] || {}
|
59
|
+
form_params['branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
60
|
+
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
|
61
|
+
form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
|
62
|
+
form_params['filename'] = opts[:'filename'] if !opts[:'filename'].nil?
|
57
63
|
|
58
64
|
# http body (model)
|
59
|
-
post_body = opts[:body]
|
65
|
+
post_body = opts[:body]
|
60
66
|
|
61
67
|
# return_type
|
62
68
|
return_type = opts[:return_type] || 'Screenshot'
|
@@ -8,6 +8,9 @@ module Phrase
|
|
8
8
|
# Locale codes
|
9
9
|
attr_accessor :locale_codes
|
10
10
|
|
11
|
+
# Keep the content and add missing plural forms for each locale
|
12
|
+
attr_accessor :keep_content
|
13
|
+
|
11
14
|
# Indicates whether the zero form should be included or excluded in the returned skeletons
|
12
15
|
attr_accessor :zero_form_enabled
|
13
16
|
|
@@ -16,6 +19,7 @@ module Phrase
|
|
16
19
|
{
|
17
20
|
:'content' => :'content',
|
18
21
|
:'locale_codes' => :'locale_codes',
|
22
|
+
:'keep_content' => :'keep_content',
|
19
23
|
:'zero_form_enabled' => :'zero_form_enabled'
|
20
24
|
}
|
21
25
|
end
|
@@ -25,6 +29,7 @@ module Phrase
|
|
25
29
|
{
|
26
30
|
:'content' => :'String',
|
27
31
|
:'locale_codes' => :'Array<String>',
|
32
|
+
:'keep_content' => :'Boolean',
|
28
33
|
:'zero_form_enabled' => :'Boolean'
|
29
34
|
}
|
30
35
|
end
|
@@ -60,6 +65,10 @@ module Phrase
|
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
68
|
+
if attributes.key?(:'keep_content')
|
69
|
+
self.keep_content = attributes[:'keep_content']
|
70
|
+
end
|
71
|
+
|
63
72
|
if attributes.key?(:'zero_form_enabled')
|
64
73
|
self.zero_form_enabled = attributes[:'zero_form_enabled']
|
65
74
|
end
|
@@ -85,6 +94,7 @@ module Phrase
|
|
85
94
|
self.class == o.class &&
|
86
95
|
content == o.content &&
|
87
96
|
locale_codes == o.locale_codes &&
|
97
|
+
keep_content == o.keep_content &&
|
88
98
|
zero_form_enabled == o.zero_form_enabled
|
89
99
|
end
|
90
100
|
|
@@ -97,7 +107,7 @@ module Phrase
|
|
97
107
|
# Calculates hash code according to all attributes.
|
98
108
|
# @return [Integer] Hash code
|
99
109
|
def hash
|
100
|
-
[content, locale_codes, zero_form_enabled].hash
|
110
|
+
[content, locale_codes, keep_content, zero_form_enabled].hash
|
101
111
|
end
|
102
112
|
|
103
113
|
# Builds the object from hash
|
@@ -14,6 +14,8 @@ module Phrase
|
|
14
14
|
|
15
15
|
attr_accessor :locales
|
16
16
|
|
17
|
+
attr_accessor :teams
|
18
|
+
|
17
19
|
attr_accessor :default_locale_codes
|
18
20
|
|
19
21
|
attr_accessor :permissions
|
@@ -28,8 +30,6 @@ module Phrase
|
|
28
30
|
|
29
31
|
attr_accessor :spaces
|
30
32
|
|
31
|
-
attr_accessor :teams
|
32
|
-
|
33
33
|
attr_accessor :project_role
|
34
34
|
|
35
35
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -41,6 +41,7 @@ module Phrase
|
|
41
41
|
:'state' => :'state',
|
42
42
|
:'projects' => :'projects',
|
43
43
|
:'locales' => :'locales',
|
44
|
+
:'teams' => :'teams',
|
44
45
|
:'default_locale_codes' => :'default_locale_codes',
|
45
46
|
:'permissions' => :'permissions',
|
46
47
|
:'locale_ids' => :'locale_ids',
|
@@ -48,7 +49,6 @@ module Phrase
|
|
48
49
|
:'updated_at' => :'updated_at',
|
49
50
|
:'accepted_at' => :'accepted_at',
|
50
51
|
:'spaces' => :'spaces',
|
51
|
-
:'teams' => :'teams',
|
52
52
|
:'project_role' => :'project_role'
|
53
53
|
}
|
54
54
|
end
|
@@ -62,14 +62,14 @@ module Phrase
|
|
62
62
|
:'state' => :'String',
|
63
63
|
:'projects' => :'Array<ProjectShort>',
|
64
64
|
:'locales' => :'Array<LocalePreview>',
|
65
|
+
:'teams' => :'Array<TeamShort>',
|
65
66
|
:'default_locale_codes' => :'Array<String>',
|
66
67
|
:'permissions' => :'Object',
|
67
68
|
:'locale_ids' => :'Array<String>',
|
68
69
|
:'created_at' => :'DateTime',
|
69
70
|
:'updated_at' => :'DateTime',
|
70
71
|
:'accepted_at' => :'DateTime',
|
71
|
-
:'spaces' => :'Array<
|
72
|
-
:'teams' => :'Array<Items>',
|
72
|
+
:'spaces' => :'Array<Space>',
|
73
73
|
:'project_role' => :'Array<MemberProjectDetailProjectRoles>'
|
74
74
|
}
|
75
75
|
end
|
@@ -123,6 +123,12 @@ module Phrase
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
+
if attributes.key?(:'teams')
|
127
|
+
if (value = attributes[:'teams']).is_a?(Array)
|
128
|
+
self.teams = value
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
126
132
|
if attributes.key?(:'default_locale_codes')
|
127
133
|
if (value = attributes[:'default_locale_codes']).is_a?(Array)
|
128
134
|
self.default_locale_codes = value
|
@@ -157,12 +163,6 @@ module Phrase
|
|
157
163
|
end
|
158
164
|
end
|
159
165
|
|
160
|
-
if attributes.key?(:'teams')
|
161
|
-
if (value = attributes[:'teams']).is_a?(Array)
|
162
|
-
self.teams = value
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
166
|
if attributes.key?(:'project_role')
|
167
167
|
if (value = attributes[:'project_role']).is_a?(Array)
|
168
168
|
self.project_role = value
|
@@ -194,6 +194,7 @@ module Phrase
|
|
194
194
|
state == o.state &&
|
195
195
|
projects == o.projects &&
|
196
196
|
locales == o.locales &&
|
197
|
+
teams == o.teams &&
|
197
198
|
default_locale_codes == o.default_locale_codes &&
|
198
199
|
permissions == o.permissions &&
|
199
200
|
locale_ids == o.locale_ids &&
|
@@ -201,7 +202,6 @@ module Phrase
|
|
201
202
|
updated_at == o.updated_at &&
|
202
203
|
accepted_at == o.accepted_at &&
|
203
204
|
spaces == o.spaces &&
|
204
|
-
teams == o.teams &&
|
205
205
|
project_role == o.project_role
|
206
206
|
end
|
207
207
|
|
@@ -214,7 +214,7 @@ module Phrase
|
|
214
214
|
# Calculates hash code according to all attributes.
|
215
215
|
# @return [Integer] Hash code
|
216
216
|
def hash
|
217
|
-
[id, email, role, state, projects, locales, default_locale_codes, permissions, locale_ids, created_at, updated_at, accepted_at, spaces,
|
217
|
+
[id, email, role, state, projects, locales, teams, default_locale_codes, permissions, locale_ids, created_at, updated_at, accepted_at, spaces, project_role].hash
|
218
218
|
end
|
219
219
|
|
220
220
|
# Builds the object from hash
|
@@ -0,0 +1,250 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class JobComment
|
5
|
+
attr_accessor :id
|
6
|
+
|
7
|
+
attr_accessor :message
|
8
|
+
|
9
|
+
attr_accessor :job_id
|
10
|
+
|
11
|
+
attr_accessor :user
|
12
|
+
|
13
|
+
attr_accessor :created_at
|
14
|
+
|
15
|
+
attr_accessor :updated_at
|
16
|
+
|
17
|
+
attr_accessor :mentioned_users
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'id' => :'id',
|
23
|
+
:'message' => :'message',
|
24
|
+
:'job_id' => :'job_id',
|
25
|
+
:'user' => :'user',
|
26
|
+
:'created_at' => :'created_at',
|
27
|
+
:'updated_at' => :'updated_at',
|
28
|
+
:'mentioned_users' => :'mentioned_users'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'id' => :'String',
|
36
|
+
:'message' => :'String',
|
37
|
+
:'job_id' => :'String',
|
38
|
+
:'user' => :'UserPreview',
|
39
|
+
:'created_at' => :'DateTime',
|
40
|
+
:'updated_at' => :'DateTime',
|
41
|
+
:'mentioned_users' => :'Array<UserPreview>'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobComment` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobComment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
+
end
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:'id')
|
67
|
+
self.id = attributes[:'id']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'message')
|
71
|
+
self.message = attributes[:'message']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'job_id')
|
75
|
+
self.job_id = attributes[:'job_id']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'user')
|
79
|
+
self.user = attributes[:'user']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'created_at')
|
83
|
+
self.created_at = attributes[:'created_at']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'updated_at')
|
87
|
+
self.updated_at = attributes[:'updated_at']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'mentioned_users')
|
91
|
+
if (value = attributes[:'mentioned_users']).is_a?(Array)
|
92
|
+
self.mentioned_users = value
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
98
|
+
# @return Array for valid properties with the reasons
|
99
|
+
def list_invalid_properties
|
100
|
+
invalid_properties = Array.new
|
101
|
+
invalid_properties
|
102
|
+
end
|
103
|
+
|
104
|
+
# Check to see if the all the properties in the model are valid
|
105
|
+
# @return true if the model is valid
|
106
|
+
def valid?
|
107
|
+
true
|
108
|
+
end
|
109
|
+
|
110
|
+
# Checks equality by comparing each attribute.
|
111
|
+
# @param [Object] Object to be compared
|
112
|
+
def ==(o)
|
113
|
+
return true if self.equal?(o)
|
114
|
+
self.class == o.class &&
|
115
|
+
id == o.id &&
|
116
|
+
message == o.message &&
|
117
|
+
job_id == o.job_id &&
|
118
|
+
user == o.user &&
|
119
|
+
created_at == o.created_at &&
|
120
|
+
updated_at == o.updated_at &&
|
121
|
+
mentioned_users == o.mentioned_users
|
122
|
+
end
|
123
|
+
|
124
|
+
# @see the `==` method
|
125
|
+
# @param [Object] Object to be compared
|
126
|
+
def eql?(o)
|
127
|
+
self == o
|
128
|
+
end
|
129
|
+
|
130
|
+
# Calculates hash code according to all attributes.
|
131
|
+
# @return [Integer] Hash code
|
132
|
+
def hash
|
133
|
+
[id, message, job_id, user, created_at, updated_at, mentioned_users].hash
|
134
|
+
end
|
135
|
+
|
136
|
+
# Builds the object from hash
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
138
|
+
# @return [Object] Returns the model itself
|
139
|
+
def self.build_from_hash(attributes)
|
140
|
+
new.build_from_hash(attributes)
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def build_from_hash(attributes)
|
147
|
+
return nil unless attributes.is_a?(Hash)
|
148
|
+
self.class.openapi_types.each_pair do |key, type|
|
149
|
+
if type =~ /\AArray<(.*)>/i
|
150
|
+
# check to ensure the input is an array given that the attribute
|
151
|
+
# is documented as an array but the input is not
|
152
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
153
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
154
|
+
end
|
155
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
157
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
158
|
+
end
|
159
|
+
|
160
|
+
self
|
161
|
+
end
|
162
|
+
|
163
|
+
# Deserializes the data based on type
|
164
|
+
# @param string type Data type
|
165
|
+
# @param string value Value to be deserialized
|
166
|
+
# @return [Object] Deserialized data
|
167
|
+
def _deserialize(type, value)
|
168
|
+
case type.to_sym
|
169
|
+
when :DateTime
|
170
|
+
DateTime.parse(value)
|
171
|
+
when :Date
|
172
|
+
Date.parse(value)
|
173
|
+
when :String
|
174
|
+
value.to_s
|
175
|
+
when :Integer
|
176
|
+
value.to_i
|
177
|
+
when :Float
|
178
|
+
value.to_f
|
179
|
+
when :Boolean
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
Phrase.const_get(type).build_from_hash(value)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returns the string representation of the object
|
205
|
+
# @return [String] String presentation of the object
|
206
|
+
def to_s
|
207
|
+
to_hash.to_s
|
208
|
+
end
|
209
|
+
|
210
|
+
# to_body is an alias to to_hash (backward compatibility)
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
212
|
+
def to_body
|
213
|
+
to_hash
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the object in the form of hash
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
218
|
+
def to_hash
|
219
|
+
hash = {}
|
220
|
+
self.class.attribute_map.each_pair do |attr, param|
|
221
|
+
value = self.send(attr)
|
222
|
+
if value.nil?
|
223
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
224
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
225
|
+
end
|
226
|
+
|
227
|
+
hash[param] = _to_hash(value)
|
228
|
+
end
|
229
|
+
hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Outputs non-array value in the form of hash
|
233
|
+
# For object, use to_hash. Otherwise, just return the value
|
234
|
+
# @param [Object] value Any valid value
|
235
|
+
# @return [Hash] Returns the value in the form of hash
|
236
|
+
def _to_hash(value)
|
237
|
+
if value.is_a?(Array)
|
238
|
+
value.compact.map { |v| _to_hash(v) }
|
239
|
+
elsif value.is_a?(Hash)
|
240
|
+
{}.tap do |hash|
|
241
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
242
|
+
end
|
243
|
+
elsif value.respond_to? :to_hash
|
244
|
+
value.to_hash
|
245
|
+
else
|
246
|
+
value
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|