phrase 1.0.14 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ module Phrase
11
11
  # Show details for current User.
12
12
  # @param [Hash] opts the optional parameters
13
13
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
14
- # @return [User]
14
+ # @return [CurrentUser]
15
15
  def show_user(opts = {})
16
16
  data, _status_code, _headers = show_user_with_http_info(opts)
17
17
  data
@@ -21,7 +21,7 @@ module Phrase
21
21
  # Show details for current User.
22
22
  # @param [Hash] opts the optional parameters
23
23
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
24
- # @return [Array<(Response<(User)>, Integer, Hash)>] Response<(User)> data, response status code and response headers
24
+ # @return [Array<(Response<(CurrentUser)>, Integer, Hash)>] Response<(CurrentUser)> data, response status code and response headers
25
25
  def show_user_with_http_info(opts = {})
26
26
  if @api_client.config.debugging
27
27
  @api_client.config.logger.debug 'Calling API: UsersApi.show_user ...'
@@ -45,7 +45,7 @@ module Phrase
45
45
  post_body = opts[:body]
46
46
 
47
47
  # return_type
48
- return_type = opts[:return_type] || 'User'
48
+ return_type = opts[:return_type] || 'CurrentUser'
49
49
 
50
50
  # auth_names
51
51
  auth_names = opts[:auth_names] || ['Basic', 'Token']
@@ -0,0 +1,257 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class CurrentUser
5
+ attr_accessor :id
6
+
7
+ attr_accessor :username
8
+
9
+ attr_accessor :name
10
+
11
+ attr_accessor :email
12
+
13
+ attr_accessor :position
14
+
15
+ attr_accessor :language
16
+
17
+ attr_accessor :created_at
18
+
19
+ attr_accessor :updated_at
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'id' => :'id',
25
+ :'username' => :'username',
26
+ :'name' => :'name',
27
+ :'email' => :'email',
28
+ :'position' => :'position',
29
+ :'language' => :'language',
30
+ :'created_at' => :'created_at',
31
+ :'updated_at' => :'updated_at'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'id' => :'String',
39
+ :'username' => :'String',
40
+ :'name' => :'String',
41
+ :'email' => :'String',
42
+ :'position' => :'String',
43
+ :'language' => :'String',
44
+ :'created_at' => :'DateTime',
45
+ :'updated_at' => :'DateTime'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::CurrentUser` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::CurrentUser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'id')
71
+ self.id = attributes[:'id']
72
+ end
73
+
74
+ if attributes.key?(:'username')
75
+ self.username = attributes[:'username']
76
+ end
77
+
78
+ if attributes.key?(:'name')
79
+ self.name = attributes[:'name']
80
+ end
81
+
82
+ if attributes.key?(:'email')
83
+ self.email = attributes[:'email']
84
+ end
85
+
86
+ if attributes.key?(:'position')
87
+ self.position = attributes[:'position']
88
+ end
89
+
90
+ if attributes.key?(:'language')
91
+ self.language = attributes[:'language']
92
+ end
93
+
94
+ if attributes.key?(:'created_at')
95
+ self.created_at = attributes[:'created_at']
96
+ end
97
+
98
+ if attributes.key?(:'updated_at')
99
+ self.updated_at = attributes[:'updated_at']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ id == o.id &&
122
+ username == o.username &&
123
+ name == o.name &&
124
+ email == o.email &&
125
+ position == o.position &&
126
+ language == o.language &&
127
+ created_at == o.created_at &&
128
+ updated_at == o.updated_at
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [id, username, name, email, position, language, created_at, updated_at].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ new.build_from_hash(attributes)
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ self.class.openapi_types.each_pair do |key, type|
156
+ if type =~ /\AArray<(.*)>/i
157
+ # check to ensure the input is an array given that the attribute
158
+ # is documented as an array but the input is not
159
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
160
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
+ end
162
+ elsif !attributes[self.class.attribute_map[key]].nil?
163
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
165
+ end
166
+
167
+ self
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def _deserialize(type, value)
175
+ case type.to_sym
176
+ when :DateTime
177
+ DateTime.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ Phrase.const_get(type).build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+ end
257
+ end
@@ -12,6 +12,10 @@ module Phrase
12
12
 
13
13
  attr_accessor :completed
14
14
 
15
+ attr_accessor :translation_completed_at
16
+
17
+ attr_accessor :review_completed_at
18
+
15
19
  # Attribute mapping from ruby-style variable name to JSON key.
16
20
  def self.attribute_map
17
21
  {
@@ -19,7 +23,9 @@ module Phrase
19
23
  :'job' => :'job',
20
24
  :'locale' => :'locale',
21
25
  :'users' => :'users',
22
- :'completed' => :'completed'
26
+ :'completed' => :'completed',
27
+ :'translation_completed_at' => :'translation_completed_at',
28
+ :'review_completed_at' => :'review_completed_at'
23
29
  }
24
30
  end
25
31
 
@@ -30,7 +36,9 @@ module Phrase
30
36
  :'job' => :'JobPreview',
31
37
  :'locale' => :'LocalePreview',
32
38
  :'users' => :'Array<UserPreview>',
33
- :'completed' => :'Boolean'
39
+ :'completed' => :'Boolean',
40
+ :'translation_completed_at' => :'DateTime',
41
+ :'review_completed_at' => :'DateTime'
34
42
  }
35
43
  end
36
44
 
@@ -76,6 +84,14 @@ module Phrase
76
84
  if attributes.key?(:'completed')
77
85
  self.completed = attributes[:'completed']
78
86
  end
87
+
88
+ if attributes.key?(:'translation_completed_at')
89
+ self.translation_completed_at = attributes[:'translation_completed_at']
90
+ end
91
+
92
+ if attributes.key?(:'review_completed_at')
93
+ self.review_completed_at = attributes[:'review_completed_at']
94
+ end
79
95
  end
80
96
 
81
97
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -100,7 +116,9 @@ module Phrase
100
116
  job == o.job &&
101
117
  locale == o.locale &&
102
118
  users == o.users &&
103
- completed == o.completed
119
+ completed == o.completed &&
120
+ translation_completed_at == o.translation_completed_at &&
121
+ review_completed_at == o.review_completed_at
104
122
  end
105
123
 
106
124
  # @see the `==` method
@@ -112,7 +130,7 @@ module Phrase
112
130
  # Calculates hash code according to all attributes.
113
131
  # @return [Integer] Hash code
114
132
  def hash
115
- [id, job, locale, users, completed].hash
133
+ [id, job, locale, users, completed, translation_completed_at, review_completed_at].hash
116
134
  end
117
135
 
118
136
  # Builds the object from hash
@@ -1,3 +1,3 @@
1
1
  module Phrase
2
- VERSION = '1.0.14'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -79,7 +79,7 @@ describe 'KeysApi' do
79
79
  end
80
80
  end
81
81
 
82
- # unit tests for keys_delete
82
+ # unit tests for keys_delete_collection
83
83
  # Delete collection of keys
84
84
  # Delete all keys matching query. Same constraints as list. Please limit the number of affected keys to about 1,000 as you might experience timeouts otherwise.
85
85
  # @param project_id Project ID
@@ -89,7 +89,7 @@ describe 'KeysApi' do
89
89
  # @option opts [String] :q Specify a query to do broad search for keys by name (including wildcards).&lt;br&gt;&lt;br&gt; The following qualifiers are also supported in the search term:&lt;br&gt; &lt;ul&gt; &lt;li&gt;&lt;code&gt;ids:key_id,...&lt;/code&gt; for queries on a comma-separated list of ids&lt;/li&gt; &lt;li&gt;&lt;code&gt;name:key_name&lt;/code&gt; for text queries on exact key names - whitespaces need to be prefixed with a backspace (\\\&quot;\\\\\\\&quot;)&lt;/li&gt; &lt;li&gt;&lt;code&gt;tags:tag_name&lt;/code&gt; to filter for keys with certain tags&lt;/li&gt; &lt;li&gt;&lt;code&gt;translated:{true|false}&lt;/code&gt; for translation status (also requires &lt;code&gt;locale_id&lt;/code&gt; to be specified)&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;unmentioned_in_upload:upload_id&lt;/code&gt; to filter keys unmentioned within upload&lt;/li&gt; &lt;/ul&gt; Find more examples &lt;a href&#x3D;\&quot;#overview--usage-examples\&quot;&gt;here&lt;/a&gt;.
90
90
  # @option opts [String] :locale_id Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
91
91
  # @return [AffectedResources]
92
- describe 'keys_delete test' do
92
+ describe 'keys_delete_collection test' do
93
93
  it 'should work' do
94
94
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
95
95
  end
@@ -71,7 +71,7 @@ describe 'LocalesApi' do
71
71
  # @option opts [Boolean] :include_unverified_translations if set to false unverified translations are excluded
72
72
  # @option opts [Boolean] :use_last_reviewed_version If set to true the last reviewed version of a translation is used. This is only available if the review workflow (currently in beta) is enabled for the project.
73
73
  # @option opts [String] :fallback_locale_id If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the public ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to &lt;code&gt;true&lt;/code&gt;.
74
- # @return [nil]
74
+ # @return [File]
75
75
  describe 'locale_download test' do
76
76
  it 'should work' do
77
77
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -179,7 +179,7 @@ describe 'TranslationsApi' do
179
179
  end
180
180
  end
181
181
 
182
- # unit tests for translations_exclude
182
+ # unit tests for translations_exclude_collection
183
183
  # Set exclude from export flag on translations selected by query
184
184
  # Exclude translations matching query from locale export.
185
185
  # @param project_id Project ID
@@ -187,13 +187,13 @@ describe 'TranslationsApi' do
187
187
  # @param [Hash] opts the optional parameters
188
188
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
189
189
  # @return [AffectedCount]
190
- describe 'translations_exclude test' do
190
+ describe 'translations_exclude_collection test' do
191
191
  it 'should work' do
192
192
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
193
193
  end
194
194
  end
195
195
 
196
- # unit tests for translations_include
196
+ # unit tests for translations_include_collection
197
197
  # Remove exlude from import flag from translations selected by query
198
198
  # Include translations matching query in locale export.
199
199
  # @param project_id Project ID
@@ -201,7 +201,7 @@ describe 'TranslationsApi' do
201
201
  # @param [Hash] opts the optional parameters
202
202
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
203
203
  # @return [AffectedCount]
204
- describe 'translations_include test' do
204
+ describe 'translations_include_collection test' do
205
205
  it 'should work' do
206
206
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
207
207
  end
@@ -226,7 +226,7 @@ describe 'TranslationsApi' do
226
226
  end
227
227
  end
228
228
 
229
- # unit tests for translations_review
229
+ # unit tests for translations_review_collection
230
230
  # Review translations selected by query
231
231
  # Review translations matching query.
232
232
  # @param project_id Project ID
@@ -234,7 +234,7 @@ describe 'TranslationsApi' do
234
234
  # @param [Hash] opts the optional parameters
235
235
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
236
236
  # @return [AffectedCount]
237
- describe 'translations_review test' do
237
+ describe 'translations_review_collection test' do
238
238
  it 'should work' do
239
239
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
240
240
  end
@@ -256,7 +256,7 @@ describe 'TranslationsApi' do
256
256
  end
257
257
  end
258
258
 
259
- # unit tests for translations_unverify
259
+ # unit tests for translations_unverify_collection
260
260
  # Mark translations selected by query as unverified
261
261
  # Mark translations matching query as unverified.
262
262
  # @param project_id Project ID
@@ -264,13 +264,13 @@ describe 'TranslationsApi' do
264
264
  # @param [Hash] opts the optional parameters
265
265
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
266
266
  # @return [AffectedCount]
267
- describe 'translations_unverify test' do
267
+ describe 'translations_unverify_collection test' do
268
268
  it 'should work' do
269
269
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
270
270
  end
271
271
  end
272
272
 
273
- # unit tests for translations_verify
273
+ # unit tests for translations_verify_collection
274
274
  # Verify translations selected by query
275
275
  # Verify translations matching query.
276
276
  # @param project_id Project ID
@@ -278,7 +278,7 @@ describe 'TranslationsApi' do
278
278
  # @param [Hash] opts the optional parameters
279
279
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
280
280
  # @return [AffectedCount]
281
- describe 'translations_verify test' do
281
+ describe 'translations_verify_collection test' do
282
282
  it 'should work' do
283
283
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
284
284
  end