phrase 1.0.10 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -9
  3. data/docs/CurrentUser.md +31 -0
  4. data/docs/Invitation.md +9 -1
  5. data/docs/InvitationCreateParameters.md +4 -0
  6. data/docs/InvitationUpdateParameters.md +4 -0
  7. data/docs/InvitationUpdateSettingsParameters.md +19 -0
  8. data/docs/InvitationsApi.md +66 -0
  9. data/docs/JobLocale.md +5 -1
  10. data/docs/KeysApi.md +5 -5
  11. data/docs/LocalesApi.md +5 -4
  12. data/docs/Member.md +7 -1
  13. data/docs/MemberProjectDetail.md +35 -0
  14. data/docs/MemberProjectDetailProjectRoles.md +19 -0
  15. data/docs/MemberSpaces.md +25 -0
  16. data/docs/MemberUpdateParameters.md +4 -0
  17. data/docs/MemberUpdateSettingsParameters.md +19 -0
  18. data/docs/MembersApi.md +66 -0
  19. data/docs/ProjectUpdateParameters.md +43 -9
  20. data/docs/ScreenshotCreateParameters.md +3 -1
  21. data/docs/ScreenshotMarkerCreateParameters.md +3 -1
  22. data/docs/ScreenshotMarkerUpdateParameters.md +3 -1
  23. data/docs/ScreenshotMarkersApi.md +9 -3
  24. data/docs/ScreenshotUpdateParameters.md +3 -1
  25. data/docs/ScreenshotsApi.md +8 -2
  26. data/docs/TranslationsApi.md +25 -25
  27. data/docs/UsersApi.md +2 -2
  28. data/docs/Variable.md +23 -0
  29. data/docs/VariableCreateParameters.md +19 -0
  30. data/docs/VariableUpdateParameters.md +19 -0
  31. data/docs/VariablesApi.md +331 -0
  32. data/lib/phrase.rb +10 -0
  33. data/lib/phrase/api/invitations_api.rb +80 -0
  34. data/lib/phrase/api/keys_api.rb +6 -6
  35. data/lib/phrase/api/locales_api.rb +5 -3
  36. data/lib/phrase/api/members_api.rb +80 -0
  37. data/lib/phrase/api/screenshot_markers_api.rb +9 -0
  38. data/lib/phrase/api/screenshots_api.rb +9 -0
  39. data/lib/phrase/api/translations_api.rb +35 -35
  40. data/lib/phrase/api/users_api.rb +3 -3
  41. data/lib/phrase/api/variables_api.rb +378 -0
  42. data/lib/phrase/models/current_user.rb +257 -0
  43. data/lib/phrase/models/invitation.rb +48 -4
  44. data/lib/phrase/models/invitation_create_parameters.rb +25 -1
  45. data/lib/phrase/models/invitation_update_parameters.rb +25 -1
  46. data/lib/phrase/models/invitation_update_settings_parameters.rb +207 -0
  47. data/lib/phrase/models/job_locale.rb +22 -4
  48. data/lib/phrase/models/member.rb +35 -4
  49. data/lib/phrase/models/member_project_detail.rb +285 -0
  50. data/lib/phrase/models/member_project_detail_project_roles.rb +203 -0
  51. data/lib/phrase/models/member_spaces.rb +230 -0
  52. data/lib/phrase/models/member_update_parameters.rb +25 -1
  53. data/lib/phrase/models/member_update_settings_parameters.rb +207 -0
  54. data/lib/phrase/models/project_update_parameters.rb +183 -13
  55. data/lib/phrase/models/screenshot_create_parameters.rb +11 -1
  56. data/lib/phrase/models/screenshot_marker_create_parameters.rb +11 -1
  57. data/lib/phrase/models/screenshot_marker_update_parameters.rb +11 -1
  58. data/lib/phrase/models/screenshot_update_parameters.rb +11 -1
  59. data/lib/phrase/models/variable.rb +221 -0
  60. data/lib/phrase/models/variable_create_parameters.rb +205 -0
  61. data/lib/phrase/models/variable_update_parameters.rb +205 -0
  62. data/lib/phrase/version.rb +1 -1
  63. data/spec/api/invitations_api_spec.rb +15 -0
  64. data/spec/api/keys_api_spec.rb +2 -2
  65. data/spec/api/locales_api_spec.rb +1 -1
  66. data/spec/api/members_api_spec.rb +15 -0
  67. data/spec/api/screenshot_markers_api_spec.rb +3 -0
  68. data/spec/api/screenshots_api_spec.rb +3 -0
  69. data/spec/api/translations_api_spec.rb +10 -10
  70. data/spec/api/users_api_spec.rb +1 -1
  71. data/spec/api/variables_api_spec.rb +95 -0
  72. data/spec/models/current_user_spec.rb +71 -0
  73. data/spec/models/invitation_create_parameters_spec.rb +12 -0
  74. data/spec/models/invitation_spec.rb +24 -0
  75. data/spec/models/invitation_update_parameters_spec.rb +12 -0
  76. data/spec/models/invitation_update_settings_parameters_spec.rb +35 -0
  77. data/spec/models/job_locale_spec.rb +12 -0
  78. data/spec/models/member_project_detail_project_roles_spec.rb +35 -0
  79. data/spec/models/member_project_detail_spec.rb +83 -0
  80. data/spec/models/member_spaces_spec.rb +53 -0
  81. data/spec/models/member_spec.rb +18 -0
  82. data/spec/models/member_update_parameters_spec.rb +12 -0
  83. data/spec/models/member_update_settings_parameters_spec.rb +35 -0
  84. data/spec/models/project_update_parameters_spec.rb +103 -1
  85. data/spec/models/screenshot_create_parameters_spec.rb +6 -0
  86. data/spec/models/screenshot_marker_create_parameters_spec.rb +6 -0
  87. data/spec/models/screenshot_marker_update_parameters_spec.rb +6 -0
  88. data/spec/models/screenshot_update_parameters_spec.rb +6 -0
  89. data/spec/models/variable_create_parameters_spec.rb +35 -0
  90. data/spec/models/variable_spec.rb +47 -0
  91. data/spec/models/variable_update_parameters_spec.rb +35 -0
  92. metadata +203 -163
@@ -0,0 +1,230 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class MemberSpaces
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ attr_accessor :projects_count
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :'id' => :'id',
19
+ :'name' => :'name',
20
+ :'created_at' => :'created_at',
21
+ :'updated_at' => :'updated_at',
22
+ :'projects_count' => :'projects_count'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'id' => :'String',
30
+ :'name' => :'String',
31
+ :'created_at' => :'AnyType',
32
+ :'updated_at' => :'AnyType',
33
+ :'projects_count' => :'Integer'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::MemberSpaces` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::MemberSpaces`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'id')
59
+ self.id = attributes[:'id']
60
+ end
61
+
62
+ if attributes.key?(:'name')
63
+ self.name = attributes[:'name']
64
+ end
65
+
66
+ if attributes.key?(:'created_at')
67
+ self.created_at = attributes[:'created_at']
68
+ end
69
+
70
+ if attributes.key?(:'updated_at')
71
+ self.updated_at = attributes[:'updated_at']
72
+ end
73
+
74
+ if attributes.key?(:'projects_count')
75
+ self.projects_count = attributes[:'projects_count']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ id == o.id &&
98
+ name == o.name &&
99
+ created_at == o.created_at &&
100
+ updated_at == o.updated_at &&
101
+ projects_count == o.projects_count
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [id, name, created_at, updated_at, projects_count].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.openapi_types.each_pair do |key, type|
129
+ if type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :DateTime
150
+ DateTime.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ Phrase.const_get(type).build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+ end
230
+ end
@@ -11,6 +11,12 @@ module Phrase
11
11
  # List of locale ids the user has access to.
12
12
  attr_accessor :locale_ids
13
13
 
14
+ # List of default locales for the user.
15
+ attr_accessor :default_locale_codes
16
+
17
+ # List of spaces the user is assigned to.
18
+ attr_accessor :space_ids
19
+
14
20
  # Additional permissions depending on member role. Available permissions are <code>create_upload</code> and <code>review_translations</code>
15
21
  attr_accessor :permissions
16
22
 
@@ -20,6 +26,8 @@ module Phrase
20
26
  :'role' => :'role',
21
27
  :'project_ids' => :'project_ids',
22
28
  :'locale_ids' => :'locale_ids',
29
+ :'default_locale_codes' => :'default_locale_codes',
30
+ :'space_ids' => :'space_ids',
23
31
  :'permissions' => :'permissions'
24
32
  }
25
33
  end
@@ -30,6 +38,8 @@ module Phrase
30
38
  :'role' => :'String',
31
39
  :'project_ids' => :'String',
32
40
  :'locale_ids' => :'String',
41
+ :'default_locale_codes' => :'Array<String>',
42
+ :'space_ids' => :'Array<String>',
33
43
  :'permissions' => :'Hash<String, String>'
34
44
  }
35
45
  end
@@ -67,6 +77,18 @@ module Phrase
67
77
  self.locale_ids = attributes[:'locale_ids']
68
78
  end
69
79
 
80
+ if attributes.key?(:'default_locale_codes')
81
+ if (value = attributes[:'default_locale_codes']).is_a?(Array)
82
+ self.default_locale_codes = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'space_ids')
87
+ if (value = attributes[:'space_ids']).is_a?(Array)
88
+ self.space_ids = value
89
+ end
90
+ end
91
+
70
92
  if attributes.key?(:'permissions')
71
93
  if (value = attributes[:'permissions']).is_a?(Hash)
72
94
  self.permissions = value
@@ -95,6 +117,8 @@ module Phrase
95
117
  role == o.role &&
96
118
  project_ids == o.project_ids &&
97
119
  locale_ids == o.locale_ids &&
120
+ default_locale_codes == o.default_locale_codes &&
121
+ space_ids == o.space_ids &&
98
122
  permissions == o.permissions
99
123
  end
100
124
 
@@ -107,7 +131,7 @@ module Phrase
107
131
  # Calculates hash code according to all attributes.
108
132
  # @return [Integer] Hash code
109
133
  def hash
110
- [role, project_ids, locale_ids, permissions].hash
134
+ [role, project_ids, locale_ids, default_locale_codes, space_ids, permissions].hash
111
135
  end
112
136
 
113
137
  # Builds the object from hash
@@ -0,0 +1,207 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class MemberUpdateSettingsParameters
5
+ # Member role, can be any of of Manager, Developer, Translator
6
+ attr_accessor :project_role
7
+
8
+ # List of locale ids the user has access to.
9
+ attr_accessor :locale_ids
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+ :'project_role' => :'project_role',
15
+ :'locale_ids' => :'locale_ids'
16
+ }
17
+ end
18
+
19
+ # Attribute type mapping.
20
+ def self.openapi_types
21
+ {
22
+ :'project_role' => :'String',
23
+ :'locale_ids' => :'Array<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::MemberUpdateSettingsParameters` 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::MemberUpdateSettingsParameters`. 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?(:'project_role')
49
+ self.project_role = attributes[:'project_role']
50
+ end
51
+
52
+ if attributes.key?(:'locale_ids')
53
+ if (value = attributes[:'locale_ids']).is_a?(Array)
54
+ self.locale_ids = value
55
+ end
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ project_role == o.project_role &&
78
+ locale_ids == o.locale_ids
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Integer] Hash code
89
+ def hash
90
+ [project_role, locale_ids].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def self.build_from_hash(attributes)
97
+ new.build_from_hash(attributes)
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.openapi_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ DateTime.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :Boolean
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else # model
157
+ Phrase.const_get(type).build_from_hash(value)
158
+ end
159
+ end
160
+
161
+ # Returns the string representation of the object
162
+ # @return [String] String presentation of the object
163
+ def to_s
164
+ to_hash.to_s
165
+ end
166
+
167
+ # to_body is an alias to to_hash (backward compatibility)
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_body
170
+ to_hash
171
+ end
172
+
173
+ # Returns the object in the form of hash
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_hash
176
+ hash = {}
177
+ self.class.attribute_map.each_pair do |attr, param|
178
+ value = self.send(attr)
179
+ if value.nil?
180
+ is_nullable = self.class.openapi_nullable.include?(attr)
181
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
+ end
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+ end
207
+ end