phrase 2.15.0 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/Gemfile +1 -0
  4. data/README.md +13 -3
  5. data/docs/FigmaAttachment.md +23 -0
  6. data/docs/FigmaAttachmentCreateParameters.md +19 -0
  7. data/docs/FigmaAttachmentUpdateParameters.md +19 -0
  8. data/docs/FigmaAttachmentsApi.md +341 -0
  9. data/docs/KeysFigmaAttachmentsApi.md +142 -0
  10. data/docs/LocalesApi.md +8 -8
  11. data/docs/TranslationsApi.md +2 -2
  12. data/docs/UploadCreateParameters.md +3 -1
  13. data/docs/UploadsApi.md +3 -1
  14. data/lib/phrase/api/figma_attachments_api.rb +393 -0
  15. data/lib/phrase/api/keys_figma_attachments_api.rb +168 -0
  16. data/lib/phrase/api/locales_api.rb +8 -8
  17. data/lib/phrase/api/translations_api.rb +2 -2
  18. data/lib/phrase/api/uploads_api.rb +3 -0
  19. data/lib/phrase/models/figma_attachment.rb +221 -0
  20. data/lib/phrase/models/figma_attachment_create_parameters.rb +205 -0
  21. data/lib/phrase/models/figma_attachment_update_parameters.rb +205 -0
  22. data/lib/phrase/models/upload_create_parameters.rb +16 -4
  23. data/lib/phrase/version.rb +1 -1
  24. data/lib/phrase.rb +5 -0
  25. data/spec/api/figma_attachments_api_spec.rb +100 -0
  26. data/spec/api/keys_figma_attachments_api_spec.rb +55 -0
  27. data/spec/api/locales_api_spec.rb +112 -8
  28. data/spec/api/translations_api_spec.rb +1 -1
  29. data/spec/api/uploads_api_spec.rb +16 -1
  30. data/spec/models/figma_attachment_create_parameters_spec.rb +35 -0
  31. data/spec/models/figma_attachment_spec.rb +47 -0
  32. data/spec/models/figma_attachment_update_parameters_spec.rb +35 -0
  33. data/spec/models/upload_create_parameters_spec.rb +6 -0
  34. data/spec/spec_helper.rb +1 -0
  35. metadata +239 -219
@@ -0,0 +1,168 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class KeysFigmaAttachmentsApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # Attach the Figma attachment to a key
11
+ # Attach the Figma attachment to a key
12
+ # @param project_id [String] Project ID
13
+ # @param figma_attachment_id [String] Figma attachment ID
14
+ # @param id [String] ID
15
+ # @param [Hash] opts the optional parameters
16
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
17
+ # @option opts [String] :branch specify the branch to use
18
+ # @return [nil]
19
+ def figma_attachment_attach_to_key(project_id, figma_attachment_id, id, opts = {})
20
+ data, _status_code, _headers = figma_attachment_attach_to_key_with_http_info(project_id, figma_attachment_id, id, opts)
21
+ data
22
+ end
23
+
24
+ # Attach the Figma attachment to a key
25
+ # Attach the Figma attachment to a key
26
+ # @param project_id [String] Project ID
27
+ # @param figma_attachment_id [String] Figma attachment ID
28
+ # @param id [String] ID
29
+ # @param [Hash] opts the optional parameters
30
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
31
+ # @option opts [String] :branch specify the branch to use
32
+ # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
33
+ def figma_attachment_attach_to_key_with_http_info(project_id, figma_attachment_id, id, opts = {})
34
+ if @api_client.config.debugging
35
+ @api_client.config.logger.debug 'Calling API: KeysFigmaAttachmentsApi.figma_attachment_attach_to_key ...'
36
+ end
37
+ # verify the required parameter 'project_id' is set
38
+ if @api_client.config.client_side_validation && project_id.nil?
39
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysFigmaAttachmentsApi.figma_attachment_attach_to_key"
40
+ end
41
+ # verify the required parameter 'figma_attachment_id' is set
42
+ if @api_client.config.client_side_validation && figma_attachment_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'figma_attachment_id' when calling KeysFigmaAttachmentsApi.figma_attachment_attach_to_key"
44
+ end
45
+ # verify the required parameter 'id' is set
46
+ if @api_client.config.client_side_validation && id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'id' when calling KeysFigmaAttachmentsApi.figma_attachment_attach_to_key"
48
+ end
49
+ # resource path
50
+ local_var_path = '/projects/{project_id}/figma_attachments/{figma_attachment_id}/keys'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'figma_attachment_id' + '}', CGI.escape(figma_attachment_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
51
+
52
+ # query parameters
53
+ query_params = opts[:query_params] || {}
54
+ query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
55
+
56
+ # header parameters
57
+ header_params = opts[:header_params] || {}
58
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
59
+
60
+ # form parameters
61
+ form_params = opts[:form_params] || {}
62
+
63
+ # http body (model)
64
+ post_body = opts[:body]
65
+
66
+ # return_type
67
+ return_type = opts[:return_type]
68
+
69
+ # auth_names
70
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
71
+
72
+ new_options = opts.merge(
73
+ :header_params => header_params,
74
+ :query_params => query_params,
75
+ :form_params => form_params,
76
+ :body => post_body,
77
+ :auth_names => auth_names,
78
+ :return_type => return_type
79
+ )
80
+
81
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
82
+ if @api_client.config.debugging
83
+ @api_client.config.logger.debug "API called: KeysFigmaAttachmentsApi#figma_attachment_attach_to_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
84
+ end
85
+ response = ::Phrase::Response.new(data, headers)
86
+ return response, status_code, headers
87
+ end
88
+
89
+ # Detach the Figma attachment from a key
90
+ # Detach the Figma attachment from a key
91
+ # @param project_id [String] Project ID
92
+ # @param figma_attachment_id [String] Figma attachment ID
93
+ # @param id [String] ID
94
+ # @param [Hash] opts the optional parameters
95
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
96
+ # @option opts [String] :branch specify the branch to use
97
+ # @return [nil]
98
+ def figma_attachment_detach_from_key(project_id, figma_attachment_id, id, opts = {})
99
+ data, _status_code, _headers = figma_attachment_detach_from_key_with_http_info(project_id, figma_attachment_id, id, opts)
100
+ data
101
+ end
102
+
103
+ # Detach the Figma attachment from a key
104
+ # Detach the Figma attachment from a key
105
+ # @param project_id [String] Project ID
106
+ # @param figma_attachment_id [String] Figma attachment ID
107
+ # @param id [String] ID
108
+ # @param [Hash] opts the optional parameters
109
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
110
+ # @option opts [String] :branch specify the branch to use
111
+ # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
112
+ def figma_attachment_detach_from_key_with_http_info(project_id, figma_attachment_id, id, opts = {})
113
+ if @api_client.config.debugging
114
+ @api_client.config.logger.debug 'Calling API: KeysFigmaAttachmentsApi.figma_attachment_detach_from_key ...'
115
+ end
116
+ # verify the required parameter 'project_id' is set
117
+ if @api_client.config.client_side_validation && project_id.nil?
118
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysFigmaAttachmentsApi.figma_attachment_detach_from_key"
119
+ end
120
+ # verify the required parameter 'figma_attachment_id' is set
121
+ if @api_client.config.client_side_validation && figma_attachment_id.nil?
122
+ fail ArgumentError, "Missing the required parameter 'figma_attachment_id' when calling KeysFigmaAttachmentsApi.figma_attachment_detach_from_key"
123
+ end
124
+ # verify the required parameter 'id' is set
125
+ if @api_client.config.client_side_validation && id.nil?
126
+ fail ArgumentError, "Missing the required parameter 'id' when calling KeysFigmaAttachmentsApi.figma_attachment_detach_from_key"
127
+ end
128
+ # resource path
129
+ local_var_path = '/projects/{project_id}/figma_attachments/{figma_attachment_id}/keys/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'figma_attachment_id' + '}', CGI.escape(figma_attachment_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
130
+
131
+ # query parameters
132
+ query_params = opts[:query_params] || {}
133
+ query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
134
+
135
+ # header parameters
136
+ header_params = opts[:header_params] || {}
137
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
138
+
139
+ # form parameters
140
+ form_params = opts[:form_params] || {}
141
+
142
+ # http body (model)
143
+ post_body = opts[:body]
144
+
145
+ # return_type
146
+ return_type = opts[:return_type]
147
+
148
+ # auth_names
149
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
150
+
151
+ new_options = opts.merge(
152
+ :header_params => header_params,
153
+ :query_params => query_params,
154
+ :form_params => form_params,
155
+ :body => post_body,
156
+ :auth_names => auth_names,
157
+ :return_type => return_type
158
+ )
159
+
160
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
161
+ if @api_client.config.debugging
162
+ @api_client.config.logger.debug "API called: KeysFigmaAttachmentsApi#figma_attachment_detach_from_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
163
+ end
164
+ response = ::Phrase::Response.new(data, headers)
165
+ return response, status_code, headers
166
+ end
167
+ end
168
+ end
@@ -156,7 +156,7 @@ module Phrase
156
156
  # Delete a locale
157
157
  # Delete an existing locale.
158
158
  # @param project_id [String] Project ID
159
- # @param id [String] ID
159
+ # @param id [String] Locale ID or locale name
160
160
  # @param [Hash] opts the optional parameters
161
161
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
162
162
  # @option opts [String] :branch specify the branch to use
@@ -169,7 +169,7 @@ module Phrase
169
169
  # Delete a locale
170
170
  # Delete an existing locale.
171
171
  # @param project_id [String] Project ID
172
- # @param id [String] ID
172
+ # @param id [String] Locale ID or locale name
173
173
  # @param [Hash] opts the optional parameters
174
174
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
175
175
  # @option opts [String] :branch specify the branch to use
@@ -229,7 +229,7 @@ module Phrase
229
229
  # Download a locale
230
230
  # Download a locale in a specific file format.
231
231
  # @param project_id [String] Project ID
232
- # @param id [String] ID
232
+ # @param id [String] Locale ID or locale name
233
233
  # @param [Hash] opts the optional parameters
234
234
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
235
235
  # @option opts [String] :if_modified_since Last modified condition, see &lt;a href&#x3D;\&quot;#overview--conditional-get-requests--http-caching\&quot;&gt;Conditional GET requests / HTTP Caching&lt;/a&gt; (optional)
@@ -259,7 +259,7 @@ module Phrase
259
259
  # Download a locale
260
260
  # Download a locale in a specific file format.
261
261
  # @param project_id [String] Project ID
262
- # @param id [String] ID
262
+ # @param id [String] Locale ID or locale name
263
263
  # @param [Hash] opts the optional parameters
264
264
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
265
265
  # @option opts [String] :if_modified_since Last modified condition, see &lt;a href&#x3D;\&quot;#overview--conditional-get-requests--http-caching\&quot;&gt;Conditional GET requests / HTTP Caching&lt;/a&gt; (optional)
@@ -355,7 +355,7 @@ module Phrase
355
355
  # Get a single locale
356
356
  # Get details on a single locale for a given project.
357
357
  # @param project_id [String] Project ID
358
- # @param id [String] ID
358
+ # @param id [String] Locale ID or locale name
359
359
  # @param [Hash] opts the optional parameters
360
360
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
361
361
  # @option opts [String] :branch specify the branch to use
@@ -368,7 +368,7 @@ module Phrase
368
368
  # Get a single locale
369
369
  # Get details on a single locale for a given project.
370
370
  # @param project_id [String] Project ID
371
- # @param id [String] ID
371
+ # @param id [String] Locale ID or locale name
372
372
  # @param [Hash] opts the optional parameters
373
373
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
374
374
  # @option opts [String] :branch specify the branch to use
@@ -430,7 +430,7 @@ module Phrase
430
430
  # Update a locale
431
431
  # Update an existing locale.
432
432
  # @param project_id [String] Project ID
433
- # @param id [String] ID
433
+ # @param id [String] Locale ID or locale name
434
434
  # @param locale_update_parameters [LocaleUpdateParameters]
435
435
  # @param [Hash] opts the optional parameters
436
436
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
@@ -443,7 +443,7 @@ module Phrase
443
443
  # Update a locale
444
444
  # Update an existing locale.
445
445
  # @param project_id [String] Project ID
446
- # @param id [String] ID
446
+ # @param id [String] Locale ID or locale name
447
447
  # @param locale_update_parameters [LocaleUpdateParameters]
448
448
  # @param [Hash] opts the optional parameters
449
449
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
@@ -976,7 +976,7 @@ module Phrase
976
976
  # @option opts [String] :branch specify the branch to use
977
977
  # @option opts [String] :sort Sort criteria. Can be one of: key_name, created_at, updated_at.
978
978
  # @option opts [String] :order Order direction. Can be one of: asc, desc.
979
- # @option opts [String] :q Specify a query to find translations by content (including wildcards).&lt;br&gt;&lt;br&gt; &lt;i&gt;Note: Search is limited to 10000 results and may not include recently updated data (depending on the project size).&lt;/i&gt;&lt;br&gt; The following qualifiers are supported in the query:&lt;br&gt; &lt;ul&gt; &lt;li&gt;&lt;code&gt;id:translation_id,...&lt;/code&gt; for queries on a comma-separated list of ids&lt;/li&gt; &lt;li&gt;&lt;code&gt;tags:XYZ&lt;/code&gt; for tags on the translation&lt;/li&gt; &lt;li&gt;&lt;code&gt;unverified:{true|false}&lt;/code&gt; for verification status&lt;/li&gt; &lt;li&gt;&lt;code&gt;excluded:{true|false}&lt;/code&gt; for exclusion status&lt;/li&gt; &lt;li&gt;&lt;code&gt;updated_at:{&gt;&#x3D;|&lt;&#x3D;}2013-02-21T00:00:00Z&lt;/code&gt; for date range queries&lt;/li&gt; &lt;/ul&gt; Find more examples &lt;a href&#x3D;\&quot;#overview--usage-examples\&quot;&gt;here&lt;/a&gt;.
979
+ # @option opts [String] :q Specify a query to find translations by content (including wildcards).&lt;br&gt;&lt;br&gt; &lt;i&gt;Note: Search is limited to 10000 results and may not include recently updated data (depending on the project size).&lt;/i&gt;&lt;br&gt; The following qualifiers are supported in the query:&lt;br&gt; &lt;ul&gt; &lt;li&gt;&lt;code&gt;id:translation_id,...&lt;/code&gt; for queries on a comma-separated list of ids&lt;/li&gt; &lt;li&gt;&lt;code&gt;tags:XYZ&lt;/code&gt; for tags on the translation&lt;/li&gt; &lt;li&gt;&lt;code&gt;unverified:{true|false}&lt;/code&gt; for verification status&lt;/li&gt; &lt;li&gt;&lt;code&gt;excluded:{true|false}&lt;/code&gt; for exclusion status&lt;/li&gt; &lt;li&gt;&lt;code&gt;updated_at:{&gt;&#x3D;|&lt;&#x3D;}2013-02-21T00:00:00Z&lt;/code&gt; for date range queries&lt;/li&gt; &lt;li&gt;&lt;code&gt;reviewed_after:2013-02-21T00:00:00Z&lt;/code&gt; for fetching translations that were reviewed after the given timestamp&lt;/li&gt; &lt;/ul&gt; Find more examples &lt;a href&#x3D;\&quot;#overview--usage-examples\&quot;&gt;here&lt;/a&gt;.
980
980
  # @return [Array<Translation>]
981
981
  def translations_list(project_id, opts = {})
982
982
  data, _status_code, _headers = translations_list_with_http_info(project_id, opts)
@@ -995,7 +995,7 @@ module Phrase
995
995
  # @option opts [String] :branch specify the branch to use
996
996
  # @option opts [String] :sort Sort criteria. Can be one of: key_name, created_at, updated_at.
997
997
  # @option opts [String] :order Order direction. Can be one of: asc, desc.
998
- # @option opts [String] :q Specify a query to find translations by content (including wildcards).&lt;br&gt;&lt;br&gt; &lt;i&gt;Note: Search is limited to 10000 results and may not include recently updated data (depending on the project size).&lt;/i&gt;&lt;br&gt; The following qualifiers are supported in the query:&lt;br&gt; &lt;ul&gt; &lt;li&gt;&lt;code&gt;id:translation_id,...&lt;/code&gt; for queries on a comma-separated list of ids&lt;/li&gt; &lt;li&gt;&lt;code&gt;tags:XYZ&lt;/code&gt; for tags on the translation&lt;/li&gt; &lt;li&gt;&lt;code&gt;unverified:{true|false}&lt;/code&gt; for verification status&lt;/li&gt; &lt;li&gt;&lt;code&gt;excluded:{true|false}&lt;/code&gt; for exclusion status&lt;/li&gt; &lt;li&gt;&lt;code&gt;updated_at:{&gt;&#x3D;|&lt;&#x3D;}2013-02-21T00:00:00Z&lt;/code&gt; for date range queries&lt;/li&gt; &lt;/ul&gt; Find more examples &lt;a href&#x3D;\&quot;#overview--usage-examples\&quot;&gt;here&lt;/a&gt;.
998
+ # @option opts [String] :q Specify a query to find translations by content (including wildcards).&lt;br&gt;&lt;br&gt; &lt;i&gt;Note: Search is limited to 10000 results and may not include recently updated data (depending on the project size).&lt;/i&gt;&lt;br&gt; The following qualifiers are supported in the query:&lt;br&gt; &lt;ul&gt; &lt;li&gt;&lt;code&gt;id:translation_id,...&lt;/code&gt; for queries on a comma-separated list of ids&lt;/li&gt; &lt;li&gt;&lt;code&gt;tags:XYZ&lt;/code&gt; for tags on the translation&lt;/li&gt; &lt;li&gt;&lt;code&gt;unverified:{true|false}&lt;/code&gt; for verification status&lt;/li&gt; &lt;li&gt;&lt;code&gt;excluded:{true|false}&lt;/code&gt; for exclusion status&lt;/li&gt; &lt;li&gt;&lt;code&gt;updated_at:{&gt;&#x3D;|&lt;&#x3D;}2013-02-21T00:00:00Z&lt;/code&gt; for date range queries&lt;/li&gt; &lt;li&gt;&lt;code&gt;reviewed_after:2013-02-21T00:00:00Z&lt;/code&gt; for fetching translations that were reviewed after the given timestamp&lt;/li&gt; &lt;/ul&gt; Find more examples &lt;a href&#x3D;\&quot;#overview--usage-examples\&quot;&gt;here&lt;/a&gt;.
999
999
  # @return [Array<(Response<(Array<Translation>)>, Integer, Hash)>] Response<(Array<Translation>)> data, response status code and response headers
1000
1000
  def translations_list_with_http_info(project_id, opts = {})
1001
1001
  if @api_client.config.debugging
@@ -27,6 +27,7 @@ module Phrase
27
27
  # @option opts [Object] :format_options Additional options available for specific formats. See our format guide for complete list.
28
28
  # @option opts [Boolean] :autotranslate If set, translations for the uploaded language will be fetched automatically.
29
29
  # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project.
30
+ # @option opts [Boolean] :tag_only_affected_keys Indicates whether only keys affected (created or updated) by the upload should be tagged. The default is &#x60;false&#x60; (default to false)
30
31
  # @return [Upload]
31
32
  def upload_create(project_id, opts = {})
32
33
  data, _status_code, _headers = upload_create_with_http_info(project_id, opts)
@@ -53,6 +54,7 @@ module Phrase
53
54
  # @option opts [Object] :format_options Additional options available for specific formats. See our format guide for complete list.
54
55
  # @option opts [Boolean] :autotranslate If set, translations for the uploaded language will be fetched automatically.
55
56
  # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project.
57
+ # @option opts [Boolean] :tag_only_affected_keys Indicates whether only keys affected (created or updated) by the upload should be tagged. The default is &#x60;false&#x60;
56
58
  # @return [Array<(Response<(Upload)>, Integer, Hash)>] Response<(Upload)> data, response status code and response headers
57
59
  def upload_create_with_http_info(project_id, opts = {})
58
60
  if @api_client.config.debugging
@@ -93,6 +95,7 @@ module Phrase
93
95
  form_params['format_options'] = opts[:'format_options'] if !opts[:'format_options'].nil?
94
96
  form_params['autotranslate'] = opts[:'autotranslate'] if !opts[:'autotranslate'].nil?
95
97
  form_params['mark_reviewed'] = opts[:'mark_reviewed'] if !opts[:'mark_reviewed'].nil?
98
+ form_params['tag_only_affected_keys'] = opts[:'tag_only_affected_keys'] if !opts[:'tag_only_affected_keys'].nil?
96
99
 
97
100
  # http body (model)
98
101
  post_body = opts[:body]
@@ -0,0 +1,221 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class FigmaAttachment
5
+ attr_accessor :id
6
+
7
+ attr_accessor :url
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :'id' => :'id',
17
+ :'url' => :'url',
18
+ :'created_at' => :'created_at',
19
+ :'updated_at' => :'updated_at'
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.openapi_types
25
+ {
26
+ :'id' => :'String',
27
+ :'url' => :'String',
28
+ :'created_at' => :'DateTime',
29
+ :'updated_at' => :'DateTime'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::FigmaAttachment` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::FigmaAttachment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'id')
55
+ self.id = attributes[:'id']
56
+ end
57
+
58
+ if attributes.key?(:'url')
59
+ self.url = attributes[:'url']
60
+ end
61
+
62
+ if attributes.key?(:'created_at')
63
+ self.created_at = attributes[:'created_at']
64
+ end
65
+
66
+ if attributes.key?(:'updated_at')
67
+ self.updated_at = attributes[:'updated_at']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ id == o.id &&
90
+ url == o.url &&
91
+ created_at == o.created_at &&
92
+ updated_at == o.updated_at
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [id, url, created_at, updated_at].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ Phrase.const_get(type).build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end