phrase 2.16.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile +1 -0
- data/README.md +13 -3
- data/docs/CommentRepliesApi.md +3 -1
- data/docs/CommentsApi.md +3 -1
- data/docs/CommentsListParameters.md +3 -1
- data/docs/DistributionCreateParameters.md +1 -1
- data/docs/FigmaAttachment.md +23 -0
- data/docs/FigmaAttachmentCreateParameters.md +19 -0
- data/docs/FigmaAttachmentUpdateParameters.md +19 -0
- data/docs/FigmaAttachmentsApi.md +341 -0
- data/docs/JobCommentsApi.md +3 -1
- data/docs/KeysFigmaAttachmentsApi.md +142 -0
- data/docs/RepliesListParameters.md +3 -1
- data/lib/phrase/api/comment_replies_api.rb +3 -0
- data/lib/phrase/api/comments_api.rb +3 -0
- data/lib/phrase/api/figma_attachments_api.rb +393 -0
- data/lib/phrase/api/job_comments_api.rb +3 -0
- data/lib/phrase/api/keys_figma_attachments_api.rb +168 -0
- data/lib/phrase/models/comments_list_parameters.rb +14 -4
- data/lib/phrase/models/distribution_create_parameters.rb +1 -1
- data/lib/phrase/models/figma_attachment.rb +221 -0
- data/lib/phrase/models/figma_attachment_create_parameters.rb +205 -0
- data/lib/phrase/models/figma_attachment_update_parameters.rb +205 -0
- data/lib/phrase/models/replies_list_parameters.rb +14 -4
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +5 -0
- data/spec/api/comment_replies_api_spec.rb +1 -0
- data/spec/api/comments_api_spec.rb +1 -0
- data/spec/api/figma_attachments_api_spec.rb +100 -0
- data/spec/api/job_comments_api_spec.rb +1 -0
- data/spec/api/keys_figma_attachments_api_spec.rb +55 -0
- data/spec/api/locales_api_spec.rb +108 -4
- data/spec/api/uploads_api_spec.rb +15 -1
- data/spec/models/comments_list_parameters_spec.rb +6 -0
- data/spec/models/figma_attachment_create_parameters_spec.rb +35 -0
- data/spec/models/figma_attachment_spec.rb +47 -0
- data/spec/models/figma_attachment_update_parameters_spec.rb +35 -0
- data/spec/models/replies_list_parameters_spec.rb +6 -0
- data/spec/spec_helper.rb +1 -0
- metadata +236 -216
@@ -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
|
@@ -14,13 +14,17 @@ module Phrase
|
|
14
14
|
# Specify filters to find comments by
|
15
15
|
attr_accessor :filters
|
16
16
|
|
17
|
+
# Specify ordering of comments
|
18
|
+
attr_accessor :order
|
19
|
+
|
17
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|
18
21
|
def self.attribute_map
|
19
22
|
{
|
20
23
|
:'branch' => :'branch',
|
21
24
|
:'query' => :'query',
|
22
25
|
:'locale_ids' => :'locale_ids',
|
23
|
-
:'filters' => :'filters'
|
26
|
+
:'filters' => :'filters',
|
27
|
+
:'order' => :'order'
|
24
28
|
}
|
25
29
|
end
|
26
30
|
|
@@ -30,7 +34,8 @@ module Phrase
|
|
30
34
|
:'branch' => :'String',
|
31
35
|
:'query' => :'String',
|
32
36
|
:'locale_ids' => :'Array<String>',
|
33
|
-
:'filters' => :'Array<String>'
|
37
|
+
:'filters' => :'Array<String>',
|
38
|
+
:'order' => :'String'
|
34
39
|
}
|
35
40
|
end
|
36
41
|
|
@@ -74,6 +79,10 @@ module Phrase
|
|
74
79
|
self.filters = value
|
75
80
|
end
|
76
81
|
end
|
82
|
+
|
83
|
+
if attributes.key?(:'order')
|
84
|
+
self.order = attributes[:'order']
|
85
|
+
end
|
77
86
|
end
|
78
87
|
|
79
88
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -97,7 +106,8 @@ module Phrase
|
|
97
106
|
branch == o.branch &&
|
98
107
|
query == o.query &&
|
99
108
|
locale_ids == o.locale_ids &&
|
100
|
-
filters == o.filters
|
109
|
+
filters == o.filters &&
|
110
|
+
order == o.order
|
101
111
|
end
|
102
112
|
|
103
113
|
# @see the `==` method
|
@@ -109,7 +119,7 @@ module Phrase
|
|
109
119
|
# Calculates hash code according to all attributes.
|
110
120
|
# @return [Integer] Hash code
|
111
121
|
def hash
|
112
|
-
[branch, query, locale_ids, filters].hash
|
122
|
+
[branch, query, locale_ids, filters, order].hash
|
113
123
|
end
|
114
124
|
|
115
125
|
# Builds the object from hash
|
@@ -8,7 +8,7 @@ module Phrase
|
|
8
8
|
# Project id the distribution should be assigned to.
|
9
9
|
attr_accessor :project_id
|
10
10
|
|
11
|
-
# List of platforms the distribution should support. Valid values are: * `android` * `ios` * `flutter` * `i18next`
|
11
|
+
# List of platforms the distribution should support. Valid values are: * `android` * `ios` * `flutter` * `i18next` * `rails`
|
12
12
|
attr_accessor :platforms
|
13
13
|
|
14
14
|
# List of locale ids that will be part of distribution releases
|
@@ -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
|
@@ -0,0 +1,205 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class FigmaAttachmentCreateParameters
|
5
|
+
# specify the branch to use
|
6
|
+
attr_accessor :branch
|
7
|
+
|
8
|
+
# Figma file url
|
9
|
+
attr_accessor :url
|
10
|
+
|
11
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
12
|
+
def self.attribute_map
|
13
|
+
{
|
14
|
+
:'branch' => :'branch',
|
15
|
+
:'url' => :'url'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Attribute type mapping.
|
20
|
+
def self.openapi_types
|
21
|
+
{
|
22
|
+
:'branch' => :'String',
|
23
|
+
:'url' => :'String'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# List of attributes with nullable: true
|
28
|
+
def self.openapi_nullable
|
29
|
+
Set.new([
|
30
|
+
])
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
if (!attributes.is_a?(Hash))
|
37
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::FigmaAttachmentCreateParameters` initialize method"
|
38
|
+
end
|
39
|
+
|
40
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
42
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
43
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::FigmaAttachmentCreateParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
44
|
+
end
|
45
|
+
h[k.to_sym] = v
|
46
|
+
}
|
47
|
+
|
48
|
+
if attributes.key?(:'branch')
|
49
|
+
self.branch = attributes[:'branch']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.key?(:'url')
|
53
|
+
self.url = attributes[:'url']
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
58
|
+
# @return Array for valid properties with the reasons
|
59
|
+
def list_invalid_properties
|
60
|
+
invalid_properties = Array.new
|
61
|
+
invalid_properties
|
62
|
+
end
|
63
|
+
|
64
|
+
# Check to see if the all the properties in the model are valid
|
65
|
+
# @return true if the model is valid
|
66
|
+
def valid?
|
67
|
+
true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Checks equality by comparing each attribute.
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def ==(o)
|
73
|
+
return true if self.equal?(o)
|
74
|
+
self.class == o.class &&
|
75
|
+
branch == o.branch &&
|
76
|
+
url == o.url
|
77
|
+
end
|
78
|
+
|
79
|
+
# @see the `==` method
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def eql?(o)
|
82
|
+
self == o
|
83
|
+
end
|
84
|
+
|
85
|
+
# Calculates hash code according to all attributes.
|
86
|
+
# @return [Integer] Hash code
|
87
|
+
def hash
|
88
|
+
[branch, url].hash
|
89
|
+
end
|
90
|
+
|
91
|
+
# Builds the object from hash
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
# @return [Object] Returns the model itself
|
94
|
+
def self.build_from_hash(attributes)
|
95
|
+
new.build_from_hash(attributes)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def build_from_hash(attributes)
|
102
|
+
return nil unless attributes.is_a?(Hash)
|
103
|
+
self.class.openapi_types.each_pair do |key, type|
|
104
|
+
if type =~ /\AArray<(.*)>/i
|
105
|
+
# check to ensure the input is an array given that the attribute
|
106
|
+
# is documented as an array but the input is not
|
107
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
108
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
109
|
+
end
|
110
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
111
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
112
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
113
|
+
end
|
114
|
+
|
115
|
+
self
|
116
|
+
end
|
117
|
+
|
118
|
+
# Deserializes the data based on type
|
119
|
+
# @param string type Data type
|
120
|
+
# @param string value Value to be deserialized
|
121
|
+
# @return [Object] Deserialized data
|
122
|
+
def _deserialize(type, value)
|
123
|
+
case type.to_sym
|
124
|
+
when :DateTime
|
125
|
+
DateTime.parse(value)
|
126
|
+
when :Date
|
127
|
+
Date.parse(value)
|
128
|
+
when :String
|
129
|
+
value.to_s
|
130
|
+
when :Integer
|
131
|
+
value.to_i
|
132
|
+
when :Float
|
133
|
+
value.to_f
|
134
|
+
when :Boolean
|
135
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
136
|
+
true
|
137
|
+
else
|
138
|
+
false
|
139
|
+
end
|
140
|
+
when :Object
|
141
|
+
# generic object (usually a Hash), return directly
|
142
|
+
value
|
143
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
144
|
+
inner_type = Regexp.last_match[:inner_type]
|
145
|
+
value.map { |v| _deserialize(inner_type, v) }
|
146
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
147
|
+
k_type = Regexp.last_match[:k_type]
|
148
|
+
v_type = Regexp.last_match[:v_type]
|
149
|
+
{}.tap do |hash|
|
150
|
+
value.each do |k, v|
|
151
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
else # model
|
155
|
+
Phrase.const_get(type).build_from_hash(value)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the string representation of the object
|
160
|
+
# @return [String] String presentation of the object
|
161
|
+
def to_s
|
162
|
+
to_hash.to_s
|
163
|
+
end
|
164
|
+
|
165
|
+
# to_body is an alias to to_hash (backward compatibility)
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_body
|
168
|
+
to_hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the object in the form of hash
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_hash
|
174
|
+
hash = {}
|
175
|
+
self.class.attribute_map.each_pair do |attr, param|
|
176
|
+
value = self.send(attr)
|
177
|
+
if value.nil?
|
178
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
179
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
180
|
+
end
|
181
|
+
|
182
|
+
hash[param] = _to_hash(value)
|
183
|
+
end
|
184
|
+
hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Outputs non-array value in the form of hash
|
188
|
+
# For object, use to_hash. Otherwise, just return the value
|
189
|
+
# @param [Object] value Any valid value
|
190
|
+
# @return [Hash] Returns the value in the form of hash
|
191
|
+
def _to_hash(value)
|
192
|
+
if value.is_a?(Array)
|
193
|
+
value.compact.map { |v| _to_hash(v) }
|
194
|
+
elsif value.is_a?(Hash)
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
197
|
+
end
|
198
|
+
elsif value.respond_to? :to_hash
|
199
|
+
value.to_hash
|
200
|
+
else
|
201
|
+
value
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|