phrase 1.0.10 → 2.0.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 (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
@@ -14,14 +14,22 @@ module Phrase
14
14
 
15
15
  attr_accessor :locales
16
16
 
17
+ attr_accessor :default_locale_codes
18
+
17
19
  attr_accessor :permissions
18
20
 
21
+ attr_accessor :locale_ids
22
+
19
23
  attr_accessor :created_at
20
24
 
21
25
  attr_accessor :updated_at
22
26
 
23
27
  attr_accessor :accepted_at
24
28
 
29
+ attr_accessor :spaces
30
+
31
+ attr_accessor :project_role
32
+
25
33
  # Attribute mapping from ruby-style variable name to JSON key.
26
34
  def self.attribute_map
27
35
  {
@@ -31,10 +39,14 @@ module Phrase
31
39
  :'state' => :'state',
32
40
  :'projects' => :'projects',
33
41
  :'locales' => :'locales',
42
+ :'default_locale_codes' => :'default_locale_codes',
34
43
  :'permissions' => :'permissions',
44
+ :'locale_ids' => :'locale_ids',
35
45
  :'created_at' => :'created_at',
36
46
  :'updated_at' => :'updated_at',
37
- :'accepted_at' => :'accepted_at'
47
+ :'accepted_at' => :'accepted_at',
48
+ :'spaces' => :'spaces',
49
+ :'project_role' => :'project_role'
38
50
  }
39
51
  end
40
52
 
@@ -47,10 +59,14 @@ module Phrase
47
59
  :'state' => :'String',
48
60
  :'projects' => :'Array<ProjectShort>',
49
61
  :'locales' => :'Array<LocalePreview>',
62
+ :'default_locale_codes' => :'Array<String>',
50
63
  :'permissions' => :'Object',
64
+ :'locale_ids' => :'Array<String>',
51
65
  :'created_at' => :'DateTime',
52
66
  :'updated_at' => :'DateTime',
53
- :'accepted_at' => :'DateTime'
67
+ :'accepted_at' => :'DateTime',
68
+ :'spaces' => :'Array<MemberSpaces>',
69
+ :'project_role' => :'Array<MemberProjectDetailProjectRoles>'
54
70
  }
55
71
  end
56
72
 
@@ -103,10 +119,22 @@ module Phrase
103
119
  end
104
120
  end
105
121
 
122
+ if attributes.key?(:'default_locale_codes')
123
+ if (value = attributes[:'default_locale_codes']).is_a?(Array)
124
+ self.default_locale_codes = value
125
+ end
126
+ end
127
+
106
128
  if attributes.key?(:'permissions')
107
129
  self.permissions = attributes[:'permissions']
108
130
  end
109
131
 
132
+ if attributes.key?(:'locale_ids')
133
+ if (value = attributes[:'locale_ids']).is_a?(Array)
134
+ self.locale_ids = value
135
+ end
136
+ end
137
+
110
138
  if attributes.key?(:'created_at')
111
139
  self.created_at = attributes[:'created_at']
112
140
  end
@@ -118,6 +146,18 @@ module Phrase
118
146
  if attributes.key?(:'accepted_at')
119
147
  self.accepted_at = attributes[:'accepted_at']
120
148
  end
149
+
150
+ if attributes.key?(:'spaces')
151
+ if (value = attributes[:'spaces']).is_a?(Array)
152
+ self.spaces = value
153
+ end
154
+ end
155
+
156
+ if attributes.key?(:'project_role')
157
+ if (value = attributes[:'project_role']).is_a?(Array)
158
+ self.project_role = value
159
+ end
160
+ end
121
161
  end
122
162
 
123
163
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -144,10 +184,14 @@ module Phrase
144
184
  state == o.state &&
145
185
  projects == o.projects &&
146
186
  locales == o.locales &&
187
+ default_locale_codes == o.default_locale_codes &&
147
188
  permissions == o.permissions &&
189
+ locale_ids == o.locale_ids &&
148
190
  created_at == o.created_at &&
149
191
  updated_at == o.updated_at &&
150
- accepted_at == o.accepted_at
192
+ accepted_at == o.accepted_at &&
193
+ spaces == o.spaces &&
194
+ project_role == o.project_role
151
195
  end
152
196
 
153
197
  # @see the `==` method
@@ -159,7 +203,7 @@ module Phrase
159
203
  # Calculates hash code according to all attributes.
160
204
  # @return [Integer] Hash code
161
205
  def hash
162
- [id, email, role, state, projects, locales, permissions, created_at, updated_at, accepted_at].hash
206
+ [id, email, role, state, projects, locales, default_locale_codes, permissions, locale_ids, created_at, updated_at, accepted_at, spaces, project_role].hash
163
207
  end
164
208
 
165
209
  # Builds the object from hash
@@ -14,6 +14,12 @@ module Phrase
14
14
  # List of locale ids the invited user has access to.
15
15
  attr_accessor :locale_ids
16
16
 
17
+ # List of spaces the user is assigned to.
18
+ attr_accessor :space_ids
19
+
20
+ # List of default locales for the user.
21
+ attr_accessor :default_locale_codes
22
+
17
23
  # Additional permissions depending on invitation role. Available permissions are <code>create_upload</code> and <code>review_translations</code>
18
24
  attr_accessor :permissions
19
25
 
@@ -24,6 +30,8 @@ module Phrase
24
30
  :'role' => :'role',
25
31
  :'project_ids' => :'project_ids',
26
32
  :'locale_ids' => :'locale_ids',
33
+ :'space_ids' => :'space_ids',
34
+ :'default_locale_codes' => :'default_locale_codes',
27
35
  :'permissions' => :'permissions'
28
36
  }
29
37
  end
@@ -35,6 +43,8 @@ module Phrase
35
43
  :'role' => :'String',
36
44
  :'project_ids' => :'String',
37
45
  :'locale_ids' => :'String',
46
+ :'space_ids' => :'Array<String>',
47
+ :'default_locale_codes' => :'Array<String>',
38
48
  :'permissions' => :'Hash<String, String>'
39
49
  }
40
50
  end
@@ -76,6 +86,18 @@ module Phrase
76
86
  self.locale_ids = attributes[:'locale_ids']
77
87
  end
78
88
 
89
+ if attributes.key?(:'space_ids')
90
+ if (value = attributes[:'space_ids']).is_a?(Array)
91
+ self.space_ids = value
92
+ end
93
+ end
94
+
95
+ if attributes.key?(:'default_locale_codes')
96
+ if (value = attributes[:'default_locale_codes']).is_a?(Array)
97
+ self.default_locale_codes = value
98
+ end
99
+ end
100
+
79
101
  if attributes.key?(:'permissions')
80
102
  if (value = attributes[:'permissions']).is_a?(Hash)
81
103
  self.permissions = value
@@ -105,6 +127,8 @@ module Phrase
105
127
  role == o.role &&
106
128
  project_ids == o.project_ids &&
107
129
  locale_ids == o.locale_ids &&
130
+ space_ids == o.space_ids &&
131
+ default_locale_codes == o.default_locale_codes &&
108
132
  permissions == o.permissions
109
133
  end
110
134
 
@@ -117,7 +141,7 @@ module Phrase
117
141
  # Calculates hash code according to all attributes.
118
142
  # @return [Integer] Hash code
119
143
  def hash
120
- [email, role, project_ids, locale_ids, permissions].hash
144
+ [email, role, project_ids, locale_ids, space_ids, default_locale_codes, permissions].hash
121
145
  end
122
146
 
123
147
  # Builds the object from hash
@@ -11,6 +11,12 @@ module Phrase
11
11
  # List of locale ids the invited user has access to
12
12
  attr_accessor :locale_ids
13
13
 
14
+ # List of spaces the user is assigned to.
15
+ attr_accessor :space_ids
16
+
17
+ # List of default locales for the user.
18
+ attr_accessor :default_locale_codes
19
+
14
20
  # Additional permissions depending on invitation role.
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
+ :'space_ids' => :'space_ids',
30
+ :'default_locale_codes' => :'default_locale_codes',
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
+ :'space_ids' => :'Array<String>',
42
+ :'default_locale_codes' => :'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?(:'space_ids')
81
+ if (value = attributes[:'space_ids']).is_a?(Array)
82
+ self.space_ids = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'default_locale_codes')
87
+ if (value = attributes[:'default_locale_codes']).is_a?(Array)
88
+ self.default_locale_codes = 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
+ space_ids == o.space_ids &&
121
+ default_locale_codes == o.default_locale_codes &&
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, space_ids, default_locale_codes, 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 InvitationUpdateSettingsParameters
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::InvitationUpdateSettingsParameters` 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::InvitationUpdateSettingsParameters`. 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