phrase 2.0.0 → 2.3.1

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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -3
  3. data/docs/Account.md +3 -1
  4. data/docs/AccountDetails.md +5 -1
  5. data/docs/AccountDetails1.md +3 -1
  6. data/docs/AccountSearchResult.md +29 -0
  7. data/docs/Branch.md +5 -1
  8. data/docs/Comment.md +3 -1
  9. data/docs/JobCreateParameters.md +2 -0
  10. data/docs/JobDetails.md +2 -0
  11. data/docs/JobDetails1.md +2 -0
  12. data/docs/JobTemplate.md +29 -0
  13. data/docs/JobTemplateCreateParameters.md +21 -0
  14. data/docs/JobTemplateLocale.md +23 -0
  15. data/docs/JobTemplateLocaleUpdateParameters.md +23 -0
  16. data/docs/JobTemplateLocalesApi.md +347 -0
  17. data/docs/JobTemplateLocalesCreateParameters.md +23 -0
  18. data/docs/JobTemplatePreview.md +19 -0
  19. data/docs/JobTemplateUpdateParameters.md +21 -0
  20. data/docs/JobTemplateUserPreview.md +23 -0
  21. data/docs/JobTemplatesApi.md +337 -0
  22. data/docs/KeysApi.md +132 -4
  23. data/docs/KeysExcludeParameters.md +23 -0
  24. data/docs/KeysIncludeParameters.md +23 -0
  25. data/docs/KeysSearchParameters.md +1 -1
  26. data/docs/KeysTagParameters.md +1 -1
  27. data/docs/KeysUntagParameters.md +1 -1
  28. data/docs/LocalePreview1.md +23 -0
  29. data/docs/LocalesApi.md +73 -3
  30. data/docs/MemberSpaces.md +2 -2
  31. data/docs/MemberUpdateParameters.md +4 -2
  32. data/docs/Notification.md +41 -0
  33. data/docs/NotificationGroup.md +23 -0
  34. data/docs/NotificationGroupDetail.md +27 -0
  35. data/docs/NotificationGroupsApi.md +194 -0
  36. data/docs/NotificationsApi.md +194 -0
  37. data/docs/OrderCreateParameters.md +2 -0
  38. data/docs/Project.md +2 -0
  39. data/docs/ProjectCreateParameters.md +35 -1
  40. data/docs/ProjectDetails.md +2 -0
  41. data/docs/ProjectsApi.md +7 -1
  42. data/docs/SearchApi.md +72 -0
  43. data/docs/SearchInAccountParameters.md +23 -0
  44. data/docs/Space1.md +25 -0
  45. data/docs/Subscription.md +19 -0
  46. data/docs/TranslationOrder.md +2 -0
  47. data/docs/TranslationsVerifyParameters.md +3 -5
  48. data/docs/User.md +0 -2
  49. data/lib/phrase/api/job_template_locales_api.rb +417 -0
  50. data/lib/phrase/api/job_templates_api.rb +387 -0
  51. data/lib/phrase/api/keys_api.rb +152 -4
  52. data/lib/phrase/api/locales_api.rb +80 -2
  53. data/lib/phrase/api/notification_groups_api.rb +202 -0
  54. data/lib/phrase/api/notifications_api.rb +202 -0
  55. data/lib/phrase/api/projects_api.rb +9 -0
  56. data/lib/phrase/api/search_api.rb +84 -0
  57. data/lib/phrase/models/account.rb +13 -4
  58. data/lib/phrase/models/account_details.rb +22 -4
  59. data/lib/phrase/models/account_details1.rb +10 -1
  60. data/lib/phrase/models/account_search_result.rb +250 -0
  61. data/lib/phrase/models/branch.rb +19 -1
  62. data/lib/phrase/models/comment.rb +15 -4
  63. data/lib/phrase/models/job_create_parameters.rb +11 -1
  64. data/lib/phrase/models/job_details.rb +10 -1
  65. data/lib/phrase/models/job_details1.rb +10 -1
  66. data/lib/phrase/models/job_template.rb +248 -0
  67. data/lib/phrase/models/job_template_create_parameters.rb +220 -0
  68. data/lib/phrase/models/job_template_locale.rb +223 -0
  69. data/lib/phrase/models/job_template_locale_update_parameters.rb +234 -0
  70. data/lib/phrase/models/job_template_locales_create_parameters.rb +234 -0
  71. data/lib/phrase/models/job_template_preview.rb +203 -0
  72. data/lib/phrase/models/job_template_update_parameters.rb +220 -0
  73. data/lib/phrase/models/job_template_user_preview.rb +221 -0
  74. data/lib/phrase/models/keys_exclude_parameters.rb +225 -0
  75. data/lib/phrase/models/keys_include_parameters.rb +225 -0
  76. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  77. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  78. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  79. data/lib/phrase/models/locale_preview1.rb +221 -0
  80. data/lib/phrase/models/member_spaces.rb +2 -2
  81. data/lib/phrase/models/member_update_parameters.rb +12 -2
  82. data/lib/phrase/models/notification.rb +302 -0
  83. data/lib/phrase/models/notification_group.rb +221 -0
  84. data/lib/phrase/models/notification_group_detail.rb +239 -0
  85. data/lib/phrase/models/order_create_parameters.rb +11 -1
  86. data/lib/phrase/models/project.rb +10 -1
  87. data/lib/phrase/models/project_create_parameters.rb +174 -4
  88. data/lib/phrase/models/project_details.rb +10 -1
  89. data/lib/phrase/models/search_in_account_parameters.rb +225 -0
  90. data/lib/phrase/models/space1.rb +230 -0
  91. data/lib/phrase/models/subscription.rb +203 -0
  92. data/lib/phrase/models/translation_order.rb +10 -1
  93. data/lib/phrase/models/translations_verify_parameters.rb +14 -24
  94. data/lib/phrase/models/user.rb +1 -10
  95. data/lib/phrase/version.rb +1 -1
  96. data/lib/phrase.rb +23 -0
  97. data/spec/api/job_template_locales_api_spec.rb +103 -0
  98. data/spec/api/job_templates_api_spec.rb +98 -0
  99. data/spec/api/keys_api_spec.rb +30 -2
  100. data/spec/api/locales_api_spec.rb +18 -1
  101. data/spec/api/notification_groups_api_spec.rb +62 -0
  102. data/spec/api/notifications_api_spec.rb +62 -0
  103. data/spec/api/projects_api_spec.rb +3 -0
  104. data/spec/api/search_api_spec.rb +37 -0
  105. data/spec/models/account_details1_spec.rb +6 -0
  106. data/spec/models/account_details_spec.rb +12 -0
  107. data/spec/models/account_search_result_spec.rb +65 -0
  108. data/spec/models/account_spec.rb +6 -0
  109. data/spec/models/branch_spec.rb +12 -0
  110. data/spec/models/comment_spec.rb +6 -0
  111. data/spec/models/job_create_parameters_spec.rb +6 -0
  112. data/spec/models/job_details1_spec.rb +6 -0
  113. data/spec/models/job_details_spec.rb +6 -0
  114. data/spec/models/job_template_create_parameters_spec.rb +41 -0
  115. data/spec/models/job_template_locale_spec.rb +47 -0
  116. data/spec/models/job_template_locale_update_parameters_spec.rb +47 -0
  117. data/spec/models/job_template_locales_create_parameters_spec.rb +47 -0
  118. data/spec/models/job_template_preview_spec.rb +35 -0
  119. data/spec/models/job_template_spec.rb +65 -0
  120. data/spec/models/job_template_update_parameters_spec.rb +41 -0
  121. data/spec/models/job_template_user_preview_spec.rb +47 -0
  122. data/spec/models/keys_exclude_parameters_spec.rb +47 -0
  123. data/spec/models/keys_include_parameters_spec.rb +47 -0
  124. data/spec/models/locale_preview1_spec.rb +47 -0
  125. data/spec/models/member_update_parameters_spec.rb +6 -0
  126. data/spec/models/notification_group_detail_spec.rb +59 -0
  127. data/spec/models/notification_group_spec.rb +47 -0
  128. data/spec/models/notification_spec.rb +101 -0
  129. data/spec/models/order_create_parameters_spec.rb +6 -0
  130. data/spec/models/project_create_parameters_spec.rb +102 -0
  131. data/spec/models/project_details_spec.rb +6 -0
  132. data/spec/models/project_spec.rb +6 -0
  133. data/spec/models/search_in_account_parameters_spec.rb +47 -0
  134. data/spec/models/space1_spec.rb +53 -0
  135. data/spec/models/subscription_spec.rb +35 -0
  136. data/spec/models/translation_order_spec.rb +6 -0
  137. data/spec/models/translations_verify_parameters_spec.rb +2 -8
  138. data/spec/models/user_spec.rb +0 -6
  139. metadata +262 -170
@@ -0,0 +1,220 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobTemplateCreateParameters
5
+ # specify the branch to use
6
+ attr_accessor :branch
7
+
8
+ # Job template name
9
+ attr_accessor :name
10
+
11
+ # Briefing for the translators
12
+ attr_accessor :briefing
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ :'branch' => :'branch',
18
+ :'name' => :'name',
19
+ :'briefing' => :'briefing'
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.openapi_types
25
+ {
26
+ :'branch' => :'String',
27
+ :'name' => :'String',
28
+ :'briefing' => :'String'
29
+ }
30
+ end
31
+
32
+ # List of attributes with nullable: true
33
+ def self.openapi_nullable
34
+ Set.new([
35
+ ])
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ if (!attributes.is_a?(Hash))
42
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobTemplateCreateParameters` initialize method"
43
+ end
44
+
45
+ # check to see if the attribute exists and convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h|
47
+ if (!self.class.attribute_map.key?(k.to_sym))
48
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobTemplateCreateParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
+ end
50
+ h[k.to_sym] = v
51
+ }
52
+
53
+ if attributes.key?(:'branch')
54
+ self.branch = attributes[:'branch']
55
+ end
56
+
57
+ if attributes.key?(:'name')
58
+ self.name = attributes[:'name']
59
+ end
60
+
61
+ if attributes.key?(:'briefing')
62
+ self.briefing = attributes[:'briefing']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ if @name.nil?
71
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
72
+ end
73
+
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return false if @name.nil?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ branch == o.branch &&
90
+ name == o.name &&
91
+ briefing == o.briefing
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [branch, name, briefing].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ Phrase.const_get(type).build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,223 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobTemplateLocale
5
+ attr_accessor :id
6
+
7
+ attr_accessor :job_template
8
+
9
+ attr_accessor :locale
10
+
11
+ attr_accessor :users
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :'id' => :'id',
17
+ :'job_template' => :'job_template',
18
+ :'locale' => :'locale',
19
+ :'users' => :'users'
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.openapi_types
25
+ {
26
+ :'id' => :'String',
27
+ :'job_template' => :'JobTemplatePreview',
28
+ :'locale' => :'LocalePreview',
29
+ :'users' => :'Array<JobTemplateUserPreview>'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobTemplateLocale` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobTemplateLocale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'id')
55
+ self.id = attributes[:'id']
56
+ end
57
+
58
+ if attributes.key?(:'job_template')
59
+ self.job_template = attributes[:'job_template']
60
+ end
61
+
62
+ if attributes.key?(:'locale')
63
+ self.locale = attributes[:'locale']
64
+ end
65
+
66
+ if attributes.key?(:'users')
67
+ if (value = attributes[:'users']).is_a?(Array)
68
+ self.users = value
69
+ end
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ id == o.id &&
92
+ job_template == o.job_template &&
93
+ locale == o.locale &&
94
+ users == o.users
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [id, job_template, locale, users].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.openapi_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ Phrase.const_get(type).build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+ end
223
+ end
@@ -0,0 +1,234 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobTemplateLocaleUpdateParameters
5
+ # specify the branch to use
6
+ attr_accessor :branch
7
+
8
+ # locale id
9
+ attr_accessor :locale_id
10
+
11
+ # Array of user ids to be assigned to the job template locale
12
+ attr_accessor :user_ids
13
+
14
+ # Array of reviewer ids to be assigned to the job template locale
15
+ attr_accessor :reviewer_ids
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'branch' => :'branch',
21
+ :'locale_id' => :'locale_id',
22
+ :'user_ids' => :'user_ids',
23
+ :'reviewer_ids' => :'reviewer_ids'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'branch' => :'String',
31
+ :'locale_id' => :'String',
32
+ :'user_ids' => :'Array<String>',
33
+ :'reviewer_ids' => :'Array<String>'
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::JobTemplateLocaleUpdateParameters` 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::JobTemplateLocaleUpdateParameters`. 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?(:'branch')
59
+ self.branch = attributes[:'branch']
60
+ end
61
+
62
+ if attributes.key?(:'locale_id')
63
+ self.locale_id = attributes[:'locale_id']
64
+ end
65
+
66
+ if attributes.key?(:'user_ids')
67
+ if (value = attributes[:'user_ids']).is_a?(Array)
68
+ self.user_ids = value
69
+ end
70
+ end
71
+
72
+ if attributes.key?(:'reviewer_ids')
73
+ if (value = attributes[:'reviewer_ids']).is_a?(Array)
74
+ self.reviewer_ids = value
75
+ end
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
+ if @locale_id.nil?
84
+ invalid_properties.push('invalid value for "locale_id", locale_id cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ return false if @locale_id.nil?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ branch == o.branch &&
103
+ locale_id == o.locale_id &&
104
+ user_ids == o.user_ids &&
105
+ reviewer_ids == o.reviewer_ids
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [branch, locale_id, user_ids, reviewer_ids].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :DateTime
154
+ DateTime.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ Phrase.const_get(type).build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+ end
234
+ end