phrase 1.0.14 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -9
  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/CurrentUser.md +31 -0
  10. data/docs/JobCreateParameters.md +2 -0
  11. data/docs/JobDetails.md +2 -0
  12. data/docs/JobDetails1.md +2 -0
  13. data/docs/JobLocale.md +5 -1
  14. data/docs/JobTemplate.md +29 -0
  15. data/docs/JobTemplateCreateParameters.md +21 -0
  16. data/docs/JobTemplateLocale.md +23 -0
  17. data/docs/JobTemplateLocaleUpdateParameters.md +23 -0
  18. data/docs/JobTemplateLocalesApi.md +347 -0
  19. data/docs/JobTemplateLocalesCreateParameters.md +23 -0
  20. data/docs/JobTemplatePreview.md +19 -0
  21. data/docs/JobTemplateUpdateParameters.md +21 -0
  22. data/docs/JobTemplateUserPreview.md +23 -0
  23. data/docs/JobTemplatesApi.md +337 -0
  24. data/docs/KeysApi.md +137 -9
  25. data/docs/KeysExcludeParameters.md +23 -0
  26. data/docs/KeysIncludeParameters.md +23 -0
  27. data/docs/KeysSearchParameters.md +1 -1
  28. data/docs/KeysTagParameters.md +1 -1
  29. data/docs/KeysUntagParameters.md +1 -1
  30. data/docs/LocalePreview1.md +23 -0
  31. data/docs/LocalesApi.md +78 -7
  32. data/docs/MemberSpaces.md +2 -2
  33. data/docs/MemberUpdateParameters.md +4 -2
  34. data/docs/Notification.md +41 -0
  35. data/docs/NotificationGroup.md +23 -0
  36. data/docs/NotificationGroupDetail.md +27 -0
  37. data/docs/NotificationGroupsApi.md +194 -0
  38. data/docs/NotificationsApi.md +194 -0
  39. data/docs/OrderCreateParameters.md +2 -0
  40. data/docs/Project.md +2 -0
  41. data/docs/ProjectCreateParameters.md +35 -1
  42. data/docs/ProjectDetails.md +2 -0
  43. data/docs/ProjectsApi.md +7 -1
  44. data/docs/SearchApi.md +72 -0
  45. data/docs/SearchInAccountParameters.md +23 -0
  46. data/docs/Space1.md +25 -0
  47. data/docs/Subscription.md +19 -0
  48. data/docs/TranslationOrder.md +2 -0
  49. data/docs/TranslationsApi.md +25 -25
  50. data/docs/User.md +0 -2
  51. data/docs/UsersApi.md +2 -2
  52. data/lib/phrase.rb +24 -0
  53. data/lib/phrase/api/job_template_locales_api.rb +417 -0
  54. data/lib/phrase/api/job_templates_api.rb +387 -0
  55. data/lib/phrase/api/keys_api.rb +158 -10
  56. data/lib/phrase/api/locales_api.rb +85 -5
  57. data/lib/phrase/api/notification_groups_api.rb +202 -0
  58. data/lib/phrase/api/notifications_api.rb +202 -0
  59. data/lib/phrase/api/projects_api.rb +9 -0
  60. data/lib/phrase/api/search_api.rb +84 -0
  61. data/lib/phrase/api/translations_api.rb +35 -35
  62. data/lib/phrase/api/users_api.rb +3 -3
  63. data/lib/phrase/models/account.rb +13 -4
  64. data/lib/phrase/models/account_details.rb +22 -4
  65. data/lib/phrase/models/account_details1.rb +10 -1
  66. data/lib/phrase/models/account_search_result.rb +250 -0
  67. data/lib/phrase/models/branch.rb +19 -1
  68. data/lib/phrase/models/comment.rb +15 -4
  69. data/lib/phrase/models/current_user.rb +257 -0
  70. data/lib/phrase/models/job_create_parameters.rb +11 -1
  71. data/lib/phrase/models/job_details.rb +10 -1
  72. data/lib/phrase/models/job_details1.rb +10 -1
  73. data/lib/phrase/models/job_locale.rb +22 -4
  74. data/lib/phrase/models/job_template.rb +248 -0
  75. data/lib/phrase/models/job_template_create_parameters.rb +220 -0
  76. data/lib/phrase/models/job_template_locale.rb +223 -0
  77. data/lib/phrase/models/job_template_locale_update_parameters.rb +234 -0
  78. data/lib/phrase/models/job_template_locales_create_parameters.rb +234 -0
  79. data/lib/phrase/models/job_template_preview.rb +203 -0
  80. data/lib/phrase/models/job_template_update_parameters.rb +220 -0
  81. data/lib/phrase/models/job_template_user_preview.rb +221 -0
  82. data/lib/phrase/models/keys_exclude_parameters.rb +225 -0
  83. data/lib/phrase/models/keys_include_parameters.rb +225 -0
  84. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  85. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  86. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  87. data/lib/phrase/models/locale_preview1.rb +221 -0
  88. data/lib/phrase/models/member_spaces.rb +2 -2
  89. data/lib/phrase/models/member_update_parameters.rb +12 -2
  90. data/lib/phrase/models/notification.rb +302 -0
  91. data/lib/phrase/models/notification_group.rb +221 -0
  92. data/lib/phrase/models/notification_group_detail.rb +239 -0
  93. data/lib/phrase/models/order_create_parameters.rb +11 -1
  94. data/lib/phrase/models/project.rb +10 -1
  95. data/lib/phrase/models/project_create_parameters.rb +174 -4
  96. data/lib/phrase/models/project_details.rb +10 -1
  97. data/lib/phrase/models/search_in_account_parameters.rb +225 -0
  98. data/lib/phrase/models/space1.rb +230 -0
  99. data/lib/phrase/models/subscription.rb +203 -0
  100. data/lib/phrase/models/translation_order.rb +10 -1
  101. data/lib/phrase/models/user.rb +1 -10
  102. data/lib/phrase/version.rb +1 -1
  103. data/spec/api/job_template_locales_api_spec.rb +103 -0
  104. data/spec/api/job_templates_api_spec.rb +98 -0
  105. data/spec/api/keys_api_spec.rb +32 -4
  106. data/spec/api/locales_api_spec.rb +19 -2
  107. data/spec/api/notification_groups_api_spec.rb +62 -0
  108. data/spec/api/notifications_api_spec.rb +62 -0
  109. data/spec/api/projects_api_spec.rb +3 -0
  110. data/spec/api/search_api_spec.rb +37 -0
  111. data/spec/api/translations_api_spec.rb +10 -10
  112. data/spec/api/users_api_spec.rb +1 -1
  113. data/spec/models/account_details1_spec.rb +6 -0
  114. data/spec/models/account_details_spec.rb +12 -0
  115. data/spec/models/account_search_result_spec.rb +65 -0
  116. data/spec/models/account_spec.rb +6 -0
  117. data/spec/models/branch_spec.rb +12 -0
  118. data/spec/models/comment_spec.rb +6 -0
  119. data/spec/models/current_user_spec.rb +71 -0
  120. data/spec/models/job_create_parameters_spec.rb +6 -0
  121. data/spec/models/job_details1_spec.rb +6 -0
  122. data/spec/models/job_details_spec.rb +6 -0
  123. data/spec/models/job_locale_spec.rb +12 -0
  124. data/spec/models/job_template_create_parameters_spec.rb +41 -0
  125. data/spec/models/job_template_locale_spec.rb +47 -0
  126. data/spec/models/job_template_locale_update_parameters_spec.rb +47 -0
  127. data/spec/models/job_template_locales_create_parameters_spec.rb +47 -0
  128. data/spec/models/job_template_preview_spec.rb +35 -0
  129. data/spec/models/job_template_spec.rb +65 -0
  130. data/spec/models/job_template_update_parameters_spec.rb +41 -0
  131. data/spec/models/job_template_user_preview_spec.rb +47 -0
  132. data/spec/models/keys_exclude_parameters_spec.rb +47 -0
  133. data/spec/models/keys_include_parameters_spec.rb +47 -0
  134. data/spec/models/locale_preview1_spec.rb +47 -0
  135. data/spec/models/member_update_parameters_spec.rb +6 -0
  136. data/spec/models/notification_group_detail_spec.rb +59 -0
  137. data/spec/models/notification_group_spec.rb +47 -0
  138. data/spec/models/notification_spec.rb +101 -0
  139. data/spec/models/order_create_parameters_spec.rb +6 -0
  140. data/spec/models/project_create_parameters_spec.rb +102 -0
  141. data/spec/models/project_details_spec.rb +6 -0
  142. data/spec/models/project_spec.rb +6 -0
  143. data/spec/models/search_in_account_parameters_spec.rb +47 -0
  144. data/spec/models/space1_spec.rb +53 -0
  145. data/spec/models/subscription_spec.rb +35 -0
  146. data/spec/models/translation_order_spec.rb +6 -0
  147. data/spec/models/user_spec.rb +0 -6
  148. metadata +263 -167
@@ -0,0 +1,234 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobTemplateLocalesCreateParameters
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::JobTemplateLocalesCreateParameters` 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::JobTemplateLocalesCreateParameters`. 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
@@ -0,0 +1,203 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobTemplatePreview
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ # Attribute mapping from ruby-style variable name to JSON key.
10
+ def self.attribute_map
11
+ {
12
+ :'id' => :'id',
13
+ :'name' => :'name'
14
+ }
15
+ end
16
+
17
+ # Attribute type mapping.
18
+ def self.openapi_types
19
+ {
20
+ :'id' => :'String',
21
+ :'name' => :'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::JobTemplatePreview` 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::JobTemplatePreview`. 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?(:'id')
47
+ self.id = attributes[:'id']
48
+ end
49
+
50
+ if attributes.key?(:'name')
51
+ self.name = attributes[:'name']
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
+ id == o.id &&
74
+ name == o.name
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
+ [id, name].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,220 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobTemplateUpdateParameters
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::JobTemplateUpdateParameters` 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::JobTemplateUpdateParameters`. 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