phrase 1.0.8 → 1.0.13

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