phrase 4.16.1 → 4.17.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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +139 -123
  3. data/README.md +8 -3
  4. data/docs/KeyCreateParameters.md +1 -1
  5. data/docs/KeyUpdateParameters.md +1 -1
  6. data/docs/LocaleDownloadCreateParameters.md +2 -2
  7. data/docs/LocalePreview1.md +1 -3
  8. data/docs/ProjectCreateParameters.md +1 -1
  9. data/docs/ProjectUpdateParameters.md +1 -1
  10. data/docs/RepoSyncExportParameters.md +17 -0
  11. data/docs/RepoSyncImportParameters.md +17 -0
  12. data/docs/RepoSyncsApi.md +10 -4
  13. data/docs/ScreenshotUpdateParameters.md +1 -1
  14. data/docs/UploadBatch.md +29 -0
  15. data/docs/UploadBatchesApi.md +72 -0
  16. data/docs/UploadBatchesCreateParameters.md +21 -0
  17. data/docs/VersionsHistoryApi.md +5 -3
  18. data/lib/phrase/api/repo_syncs_api.rb +13 -2
  19. data/lib/phrase/api/upload_batches_api.rb +84 -0
  20. data/lib/phrase/api/versions_history_api.rb +6 -3
  21. data/lib/phrase/configuration.rb +5 -1
  22. data/lib/phrase/models/locale_download_create_parameters.rb +1 -1
  23. data/lib/phrase/models/locale_preview1.rb +4 -13
  24. data/lib/phrase/models/repo_sync_export_parameters.rb +197 -0
  25. data/lib/phrase/models/repo_sync_import_parameters.rb +197 -0
  26. data/lib/phrase/models/upload_batch.rb +288 -0
  27. data/lib/phrase/models/upload_batches_create_parameters.rb +224 -0
  28. data/lib/phrase/version.rb +1 -1
  29. data/lib/phrase.rb +5 -0
  30. data/spec/api/repo_syncs_api_spec.rb +3 -0
  31. data/spec/api/upload_batches_api_spec.rb +37 -0
  32. data/spec/api/versions_history_api_spec.rb +2 -1
  33. data/spec/models/locale_preview1_spec.rb +0 -6
  34. data/spec/models/repo_sync_export_parameters_spec.rb +29 -0
  35. data/spec/models/repo_sync_import_parameters_spec.rb +29 -0
  36. data/spec/models/upload_batch_spec.rb +69 -0
  37. data/spec/models/upload_batches_create_parameters_spec.rb +41 -0
  38. metadata +258 -238
@@ -6,14 +6,11 @@ module Phrase
6
6
 
7
7
  attr_accessor :code
8
8
 
9
- attr_accessor :project
10
-
11
9
  # Attribute mapping from ruby-style variable name to JSON key.
12
10
  def self.attribute_map
13
11
  {
14
12
  :'name' => :'name',
15
- :'code' => :'code',
16
- :'project' => :'project'
13
+ :'code' => :'code'
17
14
  }
18
15
  end
19
16
 
@@ -21,8 +18,7 @@ module Phrase
21
18
  def self.openapi_types
22
19
  {
23
20
  :'name' => :'String',
24
- :'code' => :'String',
25
- :'project' => :'ProjectShort'
21
+ :'code' => :'String'
26
22
  }
27
23
  end
28
24
 
@@ -54,10 +50,6 @@ module Phrase
54
50
  if attributes.key?(:'code')
55
51
  self.code = attributes[:'code']
56
52
  end
57
-
58
- if attributes.key?(:'project')
59
- self.project = attributes[:'project']
60
- end
61
53
  end
62
54
 
63
55
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -79,8 +71,7 @@ module Phrase
79
71
  return true if self.equal?(o)
80
72
  self.class == o.class &&
81
73
  name == o.name &&
82
- code == o.code &&
83
- project == o.project
74
+ code == o.code
84
75
  end
85
76
 
86
77
  # @see the `==` method
@@ -92,7 +83,7 @@ module Phrase
92
83
  # Calculates hash code according to all attributes.
93
84
  # @return [Integer] Hash code
94
85
  def hash
95
- [name, code, project].hash
86
+ [name, code].hash
96
87
  end
97
88
 
98
89
  # Builds the object from hash
@@ -0,0 +1,197 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class RepoSyncExportParameters
5
+ # Source branch to open a pull request from
6
+ attr_accessor :pr_branch
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+ :'pr_branch' => :'pr_branch'
12
+ }
13
+ end
14
+
15
+ # Attribute type mapping.
16
+ def self.openapi_types
17
+ {
18
+ :'pr_branch' => :'String'
19
+ }
20
+ end
21
+
22
+ # List of attributes with nullable: true
23
+ def self.openapi_nullable
24
+ Set.new([
25
+ ])
26
+ end
27
+
28
+ # Initializes the object
29
+ # @param [Hash] attributes Model attributes in the form of hash
30
+ def initialize(attributes = {})
31
+ if (!attributes.is_a?(Hash))
32
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSyncExportParameters` initialize method"
33
+ end
34
+
35
+ # check to see if the attribute exists and convert string to symbol for hash key
36
+ attributes = attributes.each_with_object({}) { |(k, v), h|
37
+ if (!self.class.attribute_map.key?(k.to_sym))
38
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSyncExportParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
39
+ end
40
+ h[k.to_sym] = v
41
+ }
42
+
43
+ if attributes.key?(:'pr_branch')
44
+ self.pr_branch = attributes[:'pr_branch']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ pr_branch == o.pr_branch
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Integer] Hash code
77
+ def hash
78
+ [pr_branch].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def self.build_from_hash(attributes)
85
+ new.build_from_hash(attributes)
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :Time
119
+ Time.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :Boolean
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ Phrase.const_get(type).build_from_hash(value)
148
+ end
149
+ end
150
+
151
+ # Returns the string representation of the object
152
+ # @return [String] String presentation of the object
153
+ def to_s
154
+ to_hash.to_s
155
+ end
156
+
157
+ # to_body is an alias to to_hash (backward compatibility)
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_body
160
+ to_hash
161
+ end
162
+
163
+ # Returns the object in the form of hash
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_hash
166
+ hash = {}
167
+ self.class.attribute_map.each_pair do |attr, param|
168
+ value = self.send(attr)
169
+ if value.nil?
170
+ is_nullable = self.class.openapi_nullable.include?(attr)
171
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
172
+ end
173
+
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map { |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+ end
197
+ end
@@ -0,0 +1,197 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class RepoSyncImportParameters
5
+ # Branch to import from
6
+ attr_accessor :repository_branch
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+ :'repository_branch' => :'repository_branch'
12
+ }
13
+ end
14
+
15
+ # Attribute type mapping.
16
+ def self.openapi_types
17
+ {
18
+ :'repository_branch' => :'String'
19
+ }
20
+ end
21
+
22
+ # List of attributes with nullable: true
23
+ def self.openapi_nullable
24
+ Set.new([
25
+ ])
26
+ end
27
+
28
+ # Initializes the object
29
+ # @param [Hash] attributes Model attributes in the form of hash
30
+ def initialize(attributes = {})
31
+ if (!attributes.is_a?(Hash))
32
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSyncImportParameters` initialize method"
33
+ end
34
+
35
+ # check to see if the attribute exists and convert string to symbol for hash key
36
+ attributes = attributes.each_with_object({}) { |(k, v), h|
37
+ if (!self.class.attribute_map.key?(k.to_sym))
38
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSyncImportParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
39
+ end
40
+ h[k.to_sym] = v
41
+ }
42
+
43
+ if attributes.key?(:'repository_branch')
44
+ self.repository_branch = attributes[:'repository_branch']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ repository_branch == o.repository_branch
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Integer] Hash code
77
+ def hash
78
+ [repository_branch].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def self.build_from_hash(attributes)
85
+ new.build_from_hash(attributes)
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :Time
119
+ Time.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :Boolean
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ Phrase.const_get(type).build_from_hash(value)
148
+ end
149
+ end
150
+
151
+ # Returns the string representation of the object
152
+ # @return [String] String presentation of the object
153
+ def to_s
154
+ to_hash.to_s
155
+ end
156
+
157
+ # to_body is an alias to to_hash (backward compatibility)
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_body
160
+ to_hash
161
+ end
162
+
163
+ # Returns the object in the form of hash
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_hash
166
+ hash = {}
167
+ self.class.attribute_map.each_pair do |attr, param|
168
+ value = self.send(attr)
169
+ if value.nil?
170
+ is_nullable = self.class.openapi_nullable.include?(attr)
171
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
172
+ end
173
+
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map { |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+ end
197
+ end