phrase 2.23.0 → 2.25.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +23 -3
  4. data/docs/KeyCreateParameters.md +1 -1
  5. data/docs/KeyLink.md +29 -0
  6. data/docs/KeyLinksBatchDestroyParameters.md +17 -0
  7. data/docs/KeyLinksCreateParameters.md +17 -0
  8. data/docs/KeyLinksIndex400Response.md +17 -0
  9. data/docs/KeyUpdateParameters.md +1 -1
  10. data/docs/LinkedKeysApi.md +270 -0
  11. data/docs/ProjectCreateParameters.md +1 -1
  12. data/docs/ProjectUpdateParameters.md +1 -1
  13. data/docs/RepoSync.md +33 -0
  14. data/docs/RepoSyncEvent.md +27 -0
  15. data/docs/RepoSyncEventErrorsInner.md +16 -0
  16. data/docs/RepoSyncExport.md +17 -0
  17. data/docs/RepoSyncImport.md +17 -0
  18. data/docs/RepoSyncsApi.md +454 -0
  19. data/docs/ScreenshotUpdateParameters.md +1 -1
  20. data/lib/phrase/api/linked_keys_api.rb +323 -0
  21. data/lib/phrase/api/repo_syncs_api.rb +508 -0
  22. data/lib/phrase/models/key_link.rb +290 -0
  23. data/lib/phrase/models/key_links_batch_destroy_parameters.rb +204 -0
  24. data/lib/phrase/models/key_links_create_parameters.rb +204 -0
  25. data/lib/phrase/models/key_links_index400_response.rb +196 -0
  26. data/lib/phrase/models/repo_sync.rb +268 -0
  27. data/lib/phrase/models/repo_sync_event.rb +292 -0
  28. data/lib/phrase/models/repo_sync_event_errors_inner.rb +207 -0
  29. data/lib/phrase/models/repo_sync_export.rb +196 -0
  30. data/lib/phrase/models/repo_sync_import.rb +196 -0
  31. data/lib/phrase/version.rb +1 -1
  32. data/lib/phrase.rb +11 -0
  33. data/spec/api/linked_keys_api_spec.rb +83 -0
  34. data/spec/api/repo_syncs_api_spec.rb +120 -0
  35. data/spec/models/key_link_spec.rb +65 -0
  36. data/spec/models/key_links_batch_destroy_parameters_spec.rb +29 -0
  37. data/spec/models/key_links_create_parameters_spec.rb +29 -0
  38. data/spec/models/key_links_index400_response_spec.rb +29 -0
  39. data/spec/models/repo_sync_event_errors_inner_spec.rb +23 -0
  40. data/spec/models/repo_sync_event_spec.rb +67 -0
  41. data/spec/models/repo_sync_export_spec.rb +29 -0
  42. data/spec/models/repo_sync_import_spec.rb +29 -0
  43. data/spec/models/repo_sync_spec.rb +77 -0
  44. metadata +267 -223
@@ -0,0 +1,196 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class KeyLinksIndex400Response
5
+ attr_accessor :message
6
+
7
+ # Attribute mapping from ruby-style variable name to JSON key.
8
+ def self.attribute_map
9
+ {
10
+ :'message' => :'message'
11
+ }
12
+ end
13
+
14
+ # Attribute type mapping.
15
+ def self.openapi_types
16
+ {
17
+ :'message' => :'String'
18
+ }
19
+ end
20
+
21
+ # List of attributes with nullable: true
22
+ def self.openapi_nullable
23
+ Set.new([
24
+ ])
25
+ end
26
+
27
+ # Initializes the object
28
+ # @param [Hash] attributes Model attributes in the form of hash
29
+ def initialize(attributes = {})
30
+ if (!attributes.is_a?(Hash))
31
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::KeyLinksIndex400Response` initialize method"
32
+ end
33
+
34
+ # check to see if the attribute exists and convert string to symbol for hash key
35
+ attributes = attributes.each_with_object({}) { |(k, v), h|
36
+ if (!self.class.attribute_map.key?(k.to_sym))
37
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::KeyLinksIndex400Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
38
+ end
39
+ h[k.to_sym] = v
40
+ }
41
+
42
+ if attributes.key?(:'message')
43
+ self.message = attributes[:'message']
44
+ end
45
+ end
46
+
47
+ # Show invalid properties with the reasons. Usually used together with valid?
48
+ # @return Array for valid properties with the reasons
49
+ def list_invalid_properties
50
+ invalid_properties = Array.new
51
+ invalid_properties
52
+ end
53
+
54
+ # Check to see if the all the properties in the model are valid
55
+ # @return true if the model is valid
56
+ def valid?
57
+ true
58
+ end
59
+
60
+ # Checks equality by comparing each attribute.
61
+ # @param [Object] Object to be compared
62
+ def ==(o)
63
+ return true if self.equal?(o)
64
+ self.class == o.class &&
65
+ message == o.message
66
+ end
67
+
68
+ # @see the `==` method
69
+ # @param [Object] Object to be compared
70
+ def eql?(o)
71
+ self == o
72
+ end
73
+
74
+ # Calculates hash code according to all attributes.
75
+ # @return [Integer] Hash code
76
+ def hash
77
+ [message].hash
78
+ end
79
+
80
+ # Builds the object from hash
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ # @return [Object] Returns the model itself
83
+ def self.build_from_hash(attributes)
84
+ new.build_from_hash(attributes)
85
+ end
86
+
87
+ # Builds the object from hash
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ # @return [Object] Returns the model itself
90
+ def build_from_hash(attributes)
91
+ return nil unless attributes.is_a?(Hash)
92
+ self.class.openapi_types.each_pair do |key, type|
93
+ if type =~ /\AArray<(.*)>/i
94
+ # check to ensure the input is an array given that the attribute
95
+ # is documented as an array but the input is not
96
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
97
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
98
+ end
99
+ elsif !attributes[self.class.attribute_map[key]].nil?
100
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
101
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
102
+ end
103
+
104
+ self
105
+ end
106
+
107
+ # Deserializes the data based on type
108
+ # @param string type Data type
109
+ # @param string value Value to be deserialized
110
+ # @return [Object] Deserialized data
111
+ def _deserialize(type, value)
112
+ case type.to_sym
113
+ when :DateTime
114
+ DateTime.parse(value)
115
+ when :Date
116
+ Date.parse(value)
117
+ when :Time
118
+ Time.parse(value)
119
+ when :String
120
+ value.to_s
121
+ when :Integer
122
+ value.to_i
123
+ when :Float
124
+ value.to_f
125
+ when :Boolean
126
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
127
+ true
128
+ else
129
+ false
130
+ end
131
+ when :Object
132
+ # generic object (usually a Hash), return directly
133
+ value
134
+ when /\AArray<(?<inner_type>.+)>\z/
135
+ inner_type = Regexp.last_match[:inner_type]
136
+ value.map { |v| _deserialize(inner_type, v) }
137
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
138
+ k_type = Regexp.last_match[:k_type]
139
+ v_type = Regexp.last_match[:v_type]
140
+ {}.tap do |hash|
141
+ value.each do |k, v|
142
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
143
+ end
144
+ end
145
+ else # model
146
+ Phrase.const_get(type).build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ if value.nil?
169
+ is_nullable = self.class.openapi_nullable.include?(attr)
170
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
171
+ end
172
+
173
+ hash[param] = _to_hash(value)
174
+ end
175
+ hash
176
+ end
177
+
178
+ # Outputs non-array value in the form of hash
179
+ # For object, use to_hash. Otherwise, just return the value
180
+ # @param [Object] value Any valid value
181
+ # @return [Hash] Returns the value in the form of hash
182
+ def _to_hash(value)
183
+ if value.is_a?(Array)
184
+ value.compact.map { |v| _to_hash(v) }
185
+ elsif value.is_a?(Hash)
186
+ {}.tap do |hash|
187
+ value.each { |k, v| hash[k] = _to_hash(v) }
188
+ end
189
+ elsif value.respond_to? :to_hash
190
+ value.to_hash
191
+ else
192
+ value
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,268 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class RepoSync
5
+ attr_accessor :id
6
+
7
+ attr_accessor :project
8
+
9
+ attr_accessor :provider
10
+
11
+ attr_accessor :enabled
12
+
13
+ attr_accessor :auto_import
14
+
15
+ attr_accessor :repo_name
16
+
17
+ attr_accessor :created_at
18
+
19
+ attr_accessor :last_import_at
20
+
21
+ attr_accessor :last_export_at
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'id' => :'id',
27
+ :'project' => :'project',
28
+ :'provider' => :'provider',
29
+ :'enabled' => :'enabled',
30
+ :'auto_import' => :'auto_import',
31
+ :'repo_name' => :'repo_name',
32
+ :'created_at' => :'created_at',
33
+ :'last_import_at' => :'last_import_at',
34
+ :'last_export_at' => :'last_export_at'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'id' => :'String',
42
+ :'project' => :'ProjectShort',
43
+ :'provider' => :'String',
44
+ :'enabled' => :'Boolean',
45
+ :'auto_import' => :'Boolean',
46
+ :'repo_name' => :'String',
47
+ :'created_at' => :'DateTime',
48
+ :'last_import_at' => :'DateTime',
49
+ :'last_export_at' => :'DateTime'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSync` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSync`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'id')
75
+ self.id = attributes[:'id']
76
+ end
77
+
78
+ if attributes.key?(:'project')
79
+ self.project = attributes[:'project']
80
+ end
81
+
82
+ if attributes.key?(:'provider')
83
+ self.provider = attributes[:'provider']
84
+ end
85
+
86
+ if attributes.key?(:'enabled')
87
+ self.enabled = attributes[:'enabled']
88
+ end
89
+
90
+ if attributes.key?(:'auto_import')
91
+ self.auto_import = attributes[:'auto_import']
92
+ end
93
+
94
+ if attributes.key?(:'repo_name')
95
+ self.repo_name = attributes[:'repo_name']
96
+ end
97
+
98
+ if attributes.key?(:'created_at')
99
+ self.created_at = attributes[:'created_at']
100
+ end
101
+
102
+ if attributes.key?(:'last_import_at')
103
+ self.last_import_at = attributes[:'last_import_at']
104
+ end
105
+
106
+ if attributes.key?(:'last_export_at')
107
+ self.last_export_at = attributes[:'last_export_at']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ id == o.id &&
130
+ project == o.project &&
131
+ provider == o.provider &&
132
+ enabled == o.enabled &&
133
+ auto_import == o.auto_import &&
134
+ repo_name == o.repo_name &&
135
+ created_at == o.created_at &&
136
+ last_import_at == o.last_import_at &&
137
+ last_export_at == o.last_export_at
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [id, project, provider, enabled, auto_import, repo_name, created_at, last_import_at, last_export_at].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ new.build_from_hash(attributes)
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.openapi_types.each_pair do |key, type|
165
+ if type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :Time
190
+ Time.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :Boolean
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ Phrase.const_get(type).build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+ end
268
+ end