phrase 4.34.0 → 4.36.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +14 -3
  4. data/docs/Note.md +25 -0
  5. data/docs/ProjectDetails.md +3 -1
  6. data/docs/ProjectNoteUpdateParameters.md +19 -0
  7. data/docs/ProjectNotesApi.md +203 -0
  8. data/docs/RepoSync.md +7 -1
  9. data/docs/RepoSyncCreateParameters.md +7 -1
  10. data/docs/RepoSyncCreateParametersExportSchedule.md +27 -0
  11. data/docs/RepoSyncExportSchedule.md +23 -0
  12. data/docs/RepoSyncUpdateParameters.md +23 -0
  13. data/docs/RepoSyncUpdateParametersExportSchedule.md +27 -0
  14. data/docs/RepoSyncsApi.md +66 -0
  15. data/docs/UserShort.md +23 -0
  16. data/lib/phrase/api/project_notes_api.rb +223 -0
  17. data/lib/phrase/api/repo_syncs_api.rb +80 -0
  18. data/lib/phrase/models/note.rb +225 -0
  19. data/lib/phrase/models/project_details.rb +13 -4
  20. data/lib/phrase/models/project_note_update_parameters.rb +202 -0
  21. data/lib/phrase/models/repo_sync.rb +58 -5
  22. data/lib/phrase/models/repo_sync_create_parameters.rb +35 -4
  23. data/lib/phrase/models/repo_sync_create_parameters_export_schedule.rb +281 -0
  24. data/lib/phrase/models/repo_sync_export_schedule.rb +263 -0
  25. data/lib/phrase/models/repo_sync_update_parameters.rb +250 -0
  26. data/lib/phrase/models/repo_sync_update_parameters_export_schedule.rb +276 -0
  27. data/lib/phrase/models/user_short.rb +223 -0
  28. data/lib/phrase/version.rb +1 -1
  29. data/lib/phrase.rb +8 -0
  30. data/spec/api/project_notes_api_spec.rb +66 -0
  31. data/spec/api/repo_syncs_api_spec.rb +15 -0
  32. data/spec/models/note_spec.rb +47 -0
  33. data/spec/models/project_details_spec.rb +6 -0
  34. data/spec/models/project_note_update_parameters_spec.rb +29 -0
  35. data/spec/models/repo_sync_create_parameters_export_schedule_spec.rb +63 -0
  36. data/spec/models/repo_sync_create_parameters_spec.rb +22 -0
  37. data/spec/models/repo_sync_export_schedule_spec.rb +51 -0
  38. data/spec/models/repo_sync_spec.rb +22 -0
  39. data/spec/models/repo_sync_update_parameters_export_schedule_spec.rb +63 -0
  40. data/spec/models/repo_sync_update_parameters_spec.rb +51 -0
  41. data/spec/models/user_short_spec.rb +47 -0
  42. metadata +300 -268
@@ -0,0 +1,223 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class ProjectNotesApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # Delete a project note
11
+ # Deletes the note associated with a project. This operation is idempotent — it succeeds silently even when no note exists. The note is resolved against the main project — branch projects delete the main project's note. Requires manage permissions on the project and the `write` OAuth scope.
12
+ # @param project_id [String] Project ID
13
+ # @param [Hash] opts the optional parameters
14
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
15
+ # @option opts [String] :branch Branch to use
16
+ # @return [nil]
17
+ def project_note_destroy(project_id, opts = {})
18
+ data, _status_code, _headers = project_note_destroy_with_http_info(project_id, opts)
19
+ data
20
+ end
21
+
22
+ # Delete a project note
23
+ # Deletes the note associated with a project. This operation is idempotent — it succeeds silently even when no note exists. The note is resolved against the main project — branch projects delete the main project's note. Requires manage permissions on the project and the `write` OAuth scope.
24
+ # @param project_id [String] Project ID
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
27
+ # @option opts [String] :branch Branch to use
28
+ # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
29
+ def project_note_destroy_with_http_info(project_id, opts = {})
30
+ if @api_client.config.debugging
31
+ @api_client.config.logger.debug 'Calling API: ProjectNotesApi.project_note_destroy ...'
32
+ end
33
+ # verify the required parameter 'project_id' is set
34
+ if @api_client.config.client_side_validation && project_id.nil?
35
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectNotesApi.project_note_destroy"
36
+ end
37
+ # resource path
38
+ local_var_path = '/projects/{project_id}/note'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
39
+
40
+ # query parameters
41
+ query_params = opts[:query_params] || {}
42
+ query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
43
+
44
+ # header parameters
45
+ header_params = opts[:header_params] || {}
46
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
47
+
48
+ # form parameters
49
+ form_params = opts[:form_params] || {}
50
+
51
+ # http body (model)
52
+ post_body = opts[:body]
53
+
54
+ # return_type
55
+ return_type = opts[:return_type]
56
+
57
+ # auth_names
58
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
59
+
60
+ new_options = opts.merge(
61
+ :header_params => header_params,
62
+ :query_params => query_params,
63
+ :form_params => form_params,
64
+ :body => post_body,
65
+ :auth_names => auth_names,
66
+ :return_type => return_type
67
+ )
68
+
69
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug "API called: ProjectNotesApi#project_note_destroy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
72
+ end
73
+ response = ::Phrase::Response.new(data, headers)
74
+ return response, status_code, headers
75
+ end
76
+
77
+ # Get a project note
78
+ # Returns the Markdown-formatted note attached to a project. The note is resolved against the main project — branch projects return the main project's note. Returns 404 when no note has been created yet. Requires the `read` OAuth scope.
79
+ # @param project_id [String] Project ID
80
+ # @param [Hash] opts the optional parameters
81
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
82
+ # @option opts [String] :branch Branch to use
83
+ # @return [Note]
84
+ def project_note_show(project_id, opts = {})
85
+ data, _status_code, _headers = project_note_show_with_http_info(project_id, opts)
86
+ data
87
+ end
88
+
89
+ # Get a project note
90
+ # Returns the Markdown-formatted note attached to a project. The note is resolved against the main project — branch projects return the main project&#39;s note. Returns 404 when no note has been created yet. Requires the &#x60;read&#x60; OAuth scope.
91
+ # @param project_id [String] Project ID
92
+ # @param [Hash] opts the optional parameters
93
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
94
+ # @option opts [String] :branch Branch to use
95
+ # @return [Array<(Response<(Note)>, Integer, Hash)>] Response<(Note)> data, response status code and response headers
96
+ def project_note_show_with_http_info(project_id, opts = {})
97
+ if @api_client.config.debugging
98
+ @api_client.config.logger.debug 'Calling API: ProjectNotesApi.project_note_show ...'
99
+ end
100
+ # verify the required parameter 'project_id' is set
101
+ if @api_client.config.client_side_validation && project_id.nil?
102
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectNotesApi.project_note_show"
103
+ end
104
+ # resource path
105
+ local_var_path = '/projects/{project_id}/note'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
106
+
107
+ # query parameters
108
+ query_params = opts[:query_params] || {}
109
+ query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
110
+
111
+ # header parameters
112
+ header_params = opts[:header_params] || {}
113
+ # HTTP header 'Accept' (if needed)
114
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
115
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
116
+
117
+ # form parameters
118
+ form_params = opts[:form_params] || {}
119
+
120
+ # http body (model)
121
+ post_body = opts[:body]
122
+
123
+ # return_type
124
+ return_type = opts[:return_type] || 'Note'
125
+
126
+ # auth_names
127
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
128
+
129
+ new_options = opts.merge(
130
+ :header_params => header_params,
131
+ :query_params => query_params,
132
+ :form_params => form_params,
133
+ :body => post_body,
134
+ :auth_names => auth_names,
135
+ :return_type => return_type
136
+ )
137
+
138
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
139
+ if @api_client.config.debugging
140
+ @api_client.config.logger.debug "API called: ProjectNotesApi#project_note_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
141
+ end
142
+ response = ::Phrase::Response.new(data, headers)
143
+ return response, status_code, headers
144
+ end
145
+
146
+ # Create or update a project note
147
+ # Creates or updates the Markdown-formatted note for a project. If a note already exists it is updated in place; otherwise a new note is created. The note is stored on the main project — branch projects write to the main project's note. `body` is required. Requires manage permissions on the project and the `write` OAuth scope.
148
+ # @param project_id [String] Project ID
149
+ # @param project_note_update_parameters [ProjectNoteUpdateParameters]
150
+ # @param [Hash] opts the optional parameters
151
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
152
+ # @option opts [String] :branch Branch to use
153
+ # @return [Note]
154
+ def project_note_update(project_id, project_note_update_parameters, opts = {})
155
+ data, _status_code, _headers = project_note_update_with_http_info(project_id, project_note_update_parameters, opts)
156
+ data
157
+ end
158
+
159
+ # Create or update a project note
160
+ # Creates or updates the Markdown-formatted note for a project. If a note already exists it is updated in place; otherwise a new note is created. The note is stored on the main project — branch projects write to the main project&#39;s note. &#x60;body&#x60; is required. Requires manage permissions on the project and the &#x60;write&#x60; OAuth scope.
161
+ # @param project_id [String] Project ID
162
+ # @param project_note_update_parameters [ProjectNoteUpdateParameters]
163
+ # @param [Hash] opts the optional parameters
164
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
165
+ # @option opts [String] :branch Branch to use
166
+ # @return [Array<(Response<(Note)>, Integer, Hash)>] Response<(Note)> data, response status code and response headers
167
+ def project_note_update_with_http_info(project_id, project_note_update_parameters, opts = {})
168
+ if @api_client.config.debugging
169
+ @api_client.config.logger.debug 'Calling API: ProjectNotesApi.project_note_update ...'
170
+ end
171
+ # verify the required parameter 'project_id' is set
172
+ if @api_client.config.client_side_validation && project_id.nil?
173
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectNotesApi.project_note_update"
174
+ end
175
+ # verify the required parameter 'project_note_update_parameters' is set
176
+ if @api_client.config.client_side_validation && project_note_update_parameters.nil?
177
+ fail ArgumentError, "Missing the required parameter 'project_note_update_parameters' when calling ProjectNotesApi.project_note_update"
178
+ end
179
+ # resource path
180
+ local_var_path = '/projects/{project_id}/note'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
181
+
182
+ # query parameters
183
+ query_params = opts[:query_params] || {}
184
+ query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
185
+
186
+ # header parameters
187
+ header_params = opts[:header_params] || {}
188
+ # HTTP header 'Accept' (if needed)
189
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
190
+ # HTTP header 'Content-Type'
191
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
192
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
193
+
194
+ # form parameters
195
+ form_params = opts[:form_params] || {}
196
+
197
+ # http body (model)
198
+ post_body = opts[:body] || @api_client.object_to_http_body(project_note_update_parameters)
199
+
200
+ # return_type
201
+ return_type = opts[:return_type] || 'Note'
202
+
203
+ # auth_names
204
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
205
+
206
+ new_options = opts.merge(
207
+ :header_params => header_params,
208
+ :query_params => query_params,
209
+ :form_params => form_params,
210
+ :body => post_body,
211
+ :auth_names => auth_names,
212
+ :return_type => return_type
213
+ )
214
+
215
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called: ProjectNotesApi#project_note_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
+ end
219
+ response = ::Phrase::Response.new(data, headers)
220
+ return response, status_code, headers
221
+ end
222
+ end
223
+ end
@@ -520,5 +520,85 @@ module Phrase
520
520
  response = ::Phrase::Response.new(data, headers)
521
521
  return response, status_code, headers
522
522
  end
523
+
524
+ # Update a repo sync
525
+ # Update settings for an existing Repo Sync. Sending `owner_id`, `export_triggers`, or `export_schedule` requires the caller to have `manage_github_sync?` permission on the project (returns `403` otherwise). Sending `export_triggers` or `export_schedule` when the automatic export feature is not enabled for the account returns `422`.
526
+ # @param account_id [String] Account ID
527
+ # @param id [String] ID
528
+ # @param repo_sync_update_parameters [RepoSyncUpdateParameters]
529
+ # @param [Hash] opts the optional parameters
530
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
531
+ # @return [RepoSync]
532
+ def repo_sync_update(account_id, id, repo_sync_update_parameters, opts = {})
533
+ data, _status_code, _headers = repo_sync_update_with_http_info(account_id, id, repo_sync_update_parameters, opts)
534
+ data
535
+ end
536
+
537
+ # Update a repo sync
538
+ # Update settings for an existing Repo Sync. Sending &#x60;owner_id&#x60;, &#x60;export_triggers&#x60;, or &#x60;export_schedule&#x60; requires the caller to have &#x60;manage_github_sync?&#x60; permission on the project (returns &#x60;403&#x60; otherwise). Sending &#x60;export_triggers&#x60; or &#x60;export_schedule&#x60; when the automatic export feature is not enabled for the account returns &#x60;422&#x60;.
539
+ # @param account_id [String] Account ID
540
+ # @param id [String] ID
541
+ # @param repo_sync_update_parameters [RepoSyncUpdateParameters]
542
+ # @param [Hash] opts the optional parameters
543
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
544
+ # @return [Array<(Response<(RepoSync)>, Integer, Hash)>] Response<(RepoSync)> data, response status code and response headers
545
+ def repo_sync_update_with_http_info(account_id, id, repo_sync_update_parameters, opts = {})
546
+ if @api_client.config.debugging
547
+ @api_client.config.logger.debug 'Calling API: RepoSyncsApi.repo_sync_update ...'
548
+ end
549
+ # verify the required parameter 'account_id' is set
550
+ if @api_client.config.client_side_validation && account_id.nil?
551
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling RepoSyncsApi.repo_sync_update"
552
+ end
553
+ # verify the required parameter 'id' is set
554
+ if @api_client.config.client_side_validation && id.nil?
555
+ fail ArgumentError, "Missing the required parameter 'id' when calling RepoSyncsApi.repo_sync_update"
556
+ end
557
+ # verify the required parameter 'repo_sync_update_parameters' is set
558
+ if @api_client.config.client_side_validation && repo_sync_update_parameters.nil?
559
+ fail ArgumentError, "Missing the required parameter 'repo_sync_update_parameters' when calling RepoSyncsApi.repo_sync_update"
560
+ end
561
+ # resource path
562
+ local_var_path = '/accounts/{account_id}/repo_syncs/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
563
+
564
+ # query parameters
565
+ query_params = opts[:query_params] || {}
566
+
567
+ # header parameters
568
+ header_params = opts[:header_params] || {}
569
+ # HTTP header 'Accept' (if needed)
570
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
571
+ # HTTP header 'Content-Type'
572
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
573
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
574
+
575
+ # form parameters
576
+ form_params = opts[:form_params] || {}
577
+
578
+ # http body (model)
579
+ post_body = opts[:body] || @api_client.object_to_http_body(repo_sync_update_parameters)
580
+
581
+ # return_type
582
+ return_type = opts[:return_type] || 'RepoSync'
583
+
584
+ # auth_names
585
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
586
+
587
+ new_options = opts.merge(
588
+ :header_params => header_params,
589
+ :query_params => query_params,
590
+ :form_params => form_params,
591
+ :body => post_body,
592
+ :auth_names => auth_names,
593
+ :return_type => return_type
594
+ )
595
+
596
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
597
+ if @api_client.config.debugging
598
+ @api_client.config.logger.debug "API called: RepoSyncsApi#repo_sync_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
599
+ end
600
+ response = ::Phrase::Response.new(data, headers)
601
+ return response, status_code, headers
602
+ end
523
603
  end
524
604
  end
@@ -0,0 +1,225 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class Note
5
+ # Unique code identifying the note.
6
+ attr_accessor :id
7
+
8
+ # Markdown-formatted content of the note (max 65,535 characters).
9
+ attr_accessor :body
10
+
11
+ attr_accessor :created_at
12
+
13
+ attr_accessor :updated_at
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :'id' => :'id',
19
+ :'body' => :'body',
20
+ :'created_at' => :'created_at',
21
+ :'updated_at' => :'updated_at'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'id' => :'String',
29
+ :'body' => :'String',
30
+ :'created_at' => :'DateTime',
31
+ :'updated_at' => :'DateTime'
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new([
38
+ ])
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::Note` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::Note`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'id')
57
+ self.id = attributes[:'id']
58
+ end
59
+
60
+ if attributes.key?(:'body')
61
+ self.body = attributes[:'body']
62
+ end
63
+
64
+ if attributes.key?(:'created_at')
65
+ self.created_at = attributes[:'created_at']
66
+ end
67
+
68
+ if attributes.key?(:'updated_at')
69
+ self.updated_at = attributes[:'updated_at']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ id == o.id &&
92
+ body == o.body &&
93
+ created_at == o.created_at &&
94
+ updated_at == o.updated_at
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [id, body, created_at, updated_at].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.openapi_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :Time
147
+ Time.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ Phrase.const_get(type).build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+ end
225
+ end
@@ -70,6 +70,8 @@ module Phrase
70
70
 
71
71
  attr_accessor :branch
72
72
 
73
+ attr_accessor :note
74
+
73
75
  class EnumAttributeValidator
74
76
  attr_reader :datatype
75
77
  attr_reader :allowable_values
@@ -128,7 +130,8 @@ module Phrase
128
130
  :'translation_keys_sort_collation' => :'translation_keys_sort_collation',
129
131
  :'job_locking_enabled' => :'job_locking_enabled',
130
132
  :'placeholder_styles' => :'placeholder_styles',
131
- :'branch' => :'branch'
133
+ :'branch' => :'branch',
134
+ :'note' => :'note'
132
135
  }
133
136
  end
134
137
 
@@ -168,7 +171,8 @@ module Phrase
168
171
  :'translation_keys_sort_collation' => :'String',
169
172
  :'job_locking_enabled' => :'Boolean',
170
173
  :'placeholder_styles' => :'Array<String>',
171
- :'branch' => :'Branch'
174
+ :'branch' => :'Branch',
175
+ :'note' => :'Note'
172
176
  }
173
177
  end
174
178
 
@@ -337,6 +341,10 @@ module Phrase
337
341
  if attributes.key?(:'branch')
338
342
  self.branch = attributes[:'branch']
339
343
  end
344
+
345
+ if attributes.key?(:'note')
346
+ self.note = attributes[:'note']
347
+ end
340
348
  end
341
349
 
342
350
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -402,7 +410,8 @@ module Phrase
402
410
  translation_keys_sort_collation == o.translation_keys_sort_collation &&
403
411
  job_locking_enabled == o.job_locking_enabled &&
404
412
  placeholder_styles == o.placeholder_styles &&
405
- branch == o.branch
413
+ branch == o.branch &&
414
+ note == o.note
406
415
  end
407
416
 
408
417
  # @see the `==` method
@@ -414,7 +423,7 @@ module Phrase
414
423
  # Calculates hash code according to all attributes.
415
424
  # @return [Integer] Hash code
416
425
  def hash
417
- [id, name, slug, main_format, project_image_url, media, account, space, point_of_contact, created_at, updated_at, shares_translation_memory, machine_translation_enabled, zero_plural_form_enabled, enable_all_data_type_translation_keys_for_translators, enable_icu_message_format, enable_branching, protect_master_branch, autotranslate_enabled, autotranslate_check_new_translation_keys, autotranslate_check_new_uploads, autotranslate_check_new_locales, autotranslate_mark_as_unverified, autotranslate_use_machine_translation, autotranslate_use_translation_memory, autotranslate_overwrite_unverified_translations, fallback_for_unverified_translations, autocomplete_job_enabled, default_encoding, cldr_version, translation_keys_sort_collation, job_locking_enabled, placeholder_styles, branch].hash
426
+ [id, name, slug, main_format, project_image_url, media, account, space, point_of_contact, created_at, updated_at, shares_translation_memory, machine_translation_enabled, zero_plural_form_enabled, enable_all_data_type_translation_keys_for_translators, enable_icu_message_format, enable_branching, protect_master_branch, autotranslate_enabled, autotranslate_check_new_translation_keys, autotranslate_check_new_uploads, autotranslate_check_new_locales, autotranslate_mark_as_unverified, autotranslate_use_machine_translation, autotranslate_use_translation_memory, autotranslate_overwrite_unverified_translations, fallback_for_unverified_translations, autocomplete_job_enabled, default_encoding, cldr_version, translation_keys_sort_collation, job_locking_enabled, placeholder_styles, branch, note].hash
418
427
  end
419
428
 
420
429
  # Builds the object from hash