phrase 4.5.0 → 4.8.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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +12 -3
  4. data/docs/BranchesApi.md +3 -3
  5. data/docs/DistributionCreateParameters.md +1 -1
  6. data/docs/DistributionUpdateParameters.md +1 -1
  7. data/docs/InvitationCreateParameters.md +2 -2
  8. data/docs/InvitationsApi.md +7 -7
  9. data/docs/JobAnnotation.md +23 -0
  10. data/docs/JobAnnotationShort.md +19 -0
  11. data/docs/JobAnnotationUpdateParameters.md +19 -0
  12. data/docs/JobAnnotationsApi.md +416 -0
  13. data/docs/JobDetails.md +3 -1
  14. data/docs/JobLocale.md +3 -1
  15. data/docs/JobLocalesApi.md +6 -2
  16. data/docs/JobsApi.md +8 -6
  17. data/docs/KeyCreateParameters.md +3 -1
  18. data/docs/KeyPreview.md +3 -1
  19. data/docs/KeyUpdateParameters.md +3 -1
  20. data/docs/KeysApi.md +4 -4
  21. data/docs/KeysExcludeParameters.md +1 -1
  22. data/docs/KeysIncludeParameters.md +1 -1
  23. data/docs/KeysSearchParameters.md +1 -1
  24. data/docs/KeysTagParameters.md +1 -1
  25. data/docs/KeysUntagParameters.md +1 -1
  26. data/docs/Locale.md +2 -0
  27. data/docs/LocaleCreateParameters.md +3 -3
  28. data/docs/LocaleDetails.md +2 -0
  29. data/docs/LocaleDownloadCreateParameters.md +7 -5
  30. data/docs/LocaleDownloadsApi.md +8 -8
  31. data/docs/LocaleUpdateParameters.md +3 -3
  32. data/docs/LocalesApi.md +17 -15
  33. data/docs/MemberUpdateParameters.md +1 -1
  34. data/docs/MembersApi.md +5 -5
  35. data/docs/OrdersApi.md +1 -1
  36. data/docs/ProjectCreateParameters.md +5 -5
  37. data/docs/ProjectUpdateParameters.md +6 -6
  38. data/docs/ReleaseTriggersApi.md +1 -1
  39. data/docs/ScreenshotMarkerCreateParameters.md +1 -1
  40. data/docs/ScreenshotMarkerUpdateParameters.md +1 -1
  41. data/docs/ScreenshotUpdateParameters.md +1 -1
  42. data/docs/SearchApi.md +1 -1
  43. data/docs/TagsApi.md +2 -0
  44. data/docs/TranslationCreateParameters.md +1 -1
  45. data/docs/TranslationKey.md +2 -0
  46. data/docs/TranslationKeyDetails.md +2 -0
  47. data/docs/TranslationUpdateParameters.md +1 -1
  48. data/docs/TranslationsApi.md +13 -13
  49. data/docs/TranslationsExcludeParameters.md +1 -1
  50. data/docs/TranslationsIncludeParameters.md +1 -1
  51. data/docs/TranslationsReviewParameters.md +1 -1
  52. data/docs/TranslationsSearchParameters.md +1 -1
  53. data/docs/TranslationsUnreviewParameters.md +1 -1
  54. data/docs/TranslationsUnverifyParameters.md +1 -1
  55. data/docs/TranslationsVerifyParameters.md +1 -1
  56. data/lib/phrase/api/branches_api.rb +6 -6
  57. data/lib/phrase/api/invitations_api.rb +14 -14
  58. data/lib/phrase/api/job_annotations_api.rb +508 -0
  59. data/lib/phrase/api/job_locales_api.rb +6 -0
  60. data/lib/phrase/api/jobs_api.rb +9 -6
  61. data/lib/phrase/api/keys_api.rb +4 -4
  62. data/lib/phrase/api/locale_downloads_api.rb +8 -8
  63. data/lib/phrase/api/locales_api.rb +17 -14
  64. data/lib/phrase/api/members_api.rb +10 -10
  65. data/lib/phrase/api/orders_api.rb +2 -2
  66. data/lib/phrase/api/release_triggers_api.rb +2 -2
  67. data/lib/phrase/api/search_api.rb +2 -2
  68. data/lib/phrase/api/tags_api.rb +3 -0
  69. data/lib/phrase/api/translations_api.rb +16 -16
  70. data/lib/phrase/models/distribution_create_parameters.rb +1 -1
  71. data/lib/phrase/models/distribution_update_parameters.rb +1 -1
  72. data/lib/phrase/models/invitation_create_parameters.rb +2 -2
  73. data/lib/phrase/models/job_annotation.rb +233 -0
  74. data/lib/phrase/models/job_annotation_short.rb +215 -0
  75. data/lib/phrase/models/job_annotation_update_parameters.rb +207 -0
  76. data/lib/phrase/models/job_details.rb +15 -4
  77. data/lib/phrase/models/job_locale.rb +15 -4
  78. data/lib/phrase/models/key_create_parameters.rb +11 -1
  79. data/lib/phrase/models/key_preview.rb +13 -4
  80. data/lib/phrase/models/key_update_parameters.rb +11 -1
  81. data/lib/phrase/models/keys_exclude_parameters.rb +1 -1
  82. data/lib/phrase/models/keys_include_parameters.rb +1 -1
  83. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  84. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  85. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  86. data/lib/phrase/models/locale.rb +12 -1
  87. data/lib/phrase/models/locale_create_parameters.rb +3 -3
  88. data/lib/phrase/models/locale_details.rb +12 -1
  89. data/lib/phrase/models/locale_download_create_parameters.rb +18 -8
  90. data/lib/phrase/models/locale_update_parameters.rb +3 -3
  91. data/lib/phrase/models/member_update_parameters.rb +1 -1
  92. data/lib/phrase/models/project_create_parameters.rb +4 -4
  93. data/lib/phrase/models/project_update_parameters.rb +5 -5
  94. data/lib/phrase/models/screenshot_marker_create_parameters.rb +1 -1
  95. data/lib/phrase/models/screenshot_marker_update_parameters.rb +1 -1
  96. data/lib/phrase/models/translation_create_parameters.rb +1 -1
  97. data/lib/phrase/models/translation_key.rb +10 -1
  98. data/lib/phrase/models/translation_key_details.rb +10 -1
  99. data/lib/phrase/models/translation_update_parameters.rb +1 -1
  100. data/lib/phrase/models/translations_exclude_parameters.rb +1 -1
  101. data/lib/phrase/models/translations_include_parameters.rb +1 -1
  102. data/lib/phrase/models/translations_review_parameters.rb +1 -1
  103. data/lib/phrase/models/translations_search_parameters.rb +1 -1
  104. data/lib/phrase/models/translations_unreview_parameters.rb +1 -1
  105. data/lib/phrase/models/translations_unverify_parameters.rb +1 -1
  106. data/lib/phrase/models/translations_verify_parameters.rb +1 -1
  107. data/lib/phrase/version.rb +1 -1
  108. data/lib/phrase.rb +4 -0
  109. data/spec/api/branches_api_spec.rb +3 -3
  110. data/spec/api/invitations_api_spec.rb +7 -7
  111. data/spec/api/job_annotations_api_spec.rb +120 -0
  112. data/spec/api/job_locales_api_spec.rb +2 -0
  113. data/spec/api/jobs_api_spec.rb +4 -3
  114. data/spec/api/keys_api_spec.rb +2 -2
  115. data/spec/api/locale_downloads_api_spec.rb +4 -4
  116. data/spec/api/members_api_spec.rb +5 -5
  117. data/spec/api/orders_api_spec.rb +1 -1
  118. data/spec/api/release_triggers_api_spec.rb +1 -1
  119. data/spec/api/search_api_spec.rb +1 -1
  120. data/spec/api/tags_api_spec.rb +1 -0
  121. data/spec/api/translations_api_spec.rb +8 -8
  122. data/spec/models/job_annotation_short_spec.rb +35 -0
  123. data/spec/models/job_annotation_spec.rb +47 -0
  124. data/spec/models/job_annotation_update_parameters_spec.rb +35 -0
  125. data/spec/models/job_details_spec.rb +6 -0
  126. data/spec/models/job_locale_spec.rb +6 -0
  127. data/spec/models/key_create_parameters_spec.rb +6 -0
  128. data/spec/models/key_preview_spec.rb +6 -0
  129. data/spec/models/key_update_parameters_spec.rb +6 -0
  130. data/spec/models/locale_details_spec.rb +6 -0
  131. data/spec/models/locale_download_create_parameters_spec.rb +6 -0
  132. data/spec/models/locale_spec.rb +6 -0
  133. data/spec/models/translation_key_details_spec.rb +6 -0
  134. data/spec/models/translation_key_spec.rb +6 -0
  135. metadata +247 -231
@@ -0,0 +1,233 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobAnnotation
5
+ attr_accessor :name
6
+
7
+ attr_accessor :value
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :'name' => :'name',
17
+ :'value' => :'value',
18
+ :'created_at' => :'created_at',
19
+ :'updated_at' => :'updated_at'
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.openapi_types
25
+ {
26
+ :'name' => :'String',
27
+ :'value' => :'String',
28
+ :'created_at' => :'DateTime',
29
+ :'updated_at' => :'DateTime'
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::JobAnnotation` 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::JobAnnotation`. 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?(:'name')
55
+ self.name = attributes[:'name']
56
+ end
57
+
58
+ if attributes.key?(:'value')
59
+ self.value = attributes[:'value']
60
+ end
61
+
62
+ if attributes.key?(:'created_at')
63
+ self.created_at = attributes[:'created_at']
64
+ end
65
+
66
+ if attributes.key?(:'updated_at')
67
+ self.updated_at = attributes[:'updated_at']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ if @name.nil?
76
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
77
+ end
78
+
79
+ if @value.nil?
80
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
81
+ end
82
+
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
+ return false if @name.nil?
90
+ return false if @value.nil?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ name == o.name &&
100
+ value == o.value &&
101
+ created_at == o.created_at &&
102
+ updated_at == o.updated_at
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [name, value, created_at, updated_at].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :Time
155
+ Time.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ Phrase.const_get(type).build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+ end
233
+ end
@@ -0,0 +1,215 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobAnnotationShort
5
+ attr_accessor :name
6
+
7
+ attr_accessor :value
8
+
9
+ # Attribute mapping from ruby-style variable name to JSON key.
10
+ def self.attribute_map
11
+ {
12
+ :'name' => :'name',
13
+ :'value' => :'value'
14
+ }
15
+ end
16
+
17
+ # Attribute type mapping.
18
+ def self.openapi_types
19
+ {
20
+ :'name' => :'String',
21
+ :'value' => :'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::JobAnnotationShort` 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::JobAnnotationShort`. 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?(:'name')
47
+ self.name = attributes[:'name']
48
+ end
49
+
50
+ if attributes.key?(:'value')
51
+ self.value = attributes[:'value']
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
+ if @name.nil?
60
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
61
+ end
62
+
63
+ if @value.nil?
64
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
65
+ end
66
+
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if @name.nil?
74
+ return false if @value.nil?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ name == o.name &&
84
+ value == o.value
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [name, value].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :Time
137
+ Time.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ Phrase.const_get(type).build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+ end
215
+ end
@@ -0,0 +1,207 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobAnnotationUpdateParameters
5
+ # Annotation value
6
+ attr_accessor :value
7
+
8
+ # Branch name of the job
9
+ attr_accessor :branch
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+ :'value' => :'value',
15
+ :'branch' => :'branch'
16
+ }
17
+ end
18
+
19
+ # Attribute type mapping.
20
+ def self.openapi_types
21
+ {
22
+ :'value' => :'String',
23
+ :'branch' => :'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::JobAnnotationUpdateParameters` 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::JobAnnotationUpdateParameters`. 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?(:'value')
49
+ self.value = attributes[:'value']
50
+ end
51
+
52
+ if attributes.key?(:'branch')
53
+ self.branch = attributes[:'branch']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ value == o.value &&
76
+ branch == o.branch
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Integer] Hash code
87
+ def hash
88
+ [value, branch].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def self.build_from_hash(attributes)
95
+ new.build_from_hash(attributes)
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def build_from_hash(attributes)
102
+ return nil unless attributes.is_a?(Hash)
103
+ self.class.openapi_types.each_pair do |key, type|
104
+ if type =~ /\AArray<(.*)>/i
105
+ # check to ensure the input is an array given that the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
108
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
109
+ end
110
+ elsif !attributes[self.class.attribute_map[key]].nil?
111
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
112
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+
115
+ self
116
+ end
117
+
118
+ # Deserializes the data based on type
119
+ # @param string type Data type
120
+ # @param string value Value to be deserialized
121
+ # @return [Object] Deserialized data
122
+ def _deserialize(type, value)
123
+ case type.to_sym
124
+ when :DateTime
125
+ DateTime.parse(value)
126
+ when :Date
127
+ Date.parse(value)
128
+ when :Time
129
+ Time.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
@@ -34,6 +34,8 @@ module Phrase
34
34
 
35
35
  attr_accessor :keys
36
36
 
37
+ attr_accessor :annotations
38
+
37
39
  # Attribute mapping from ruby-style variable name to JSON key.
38
40
  def self.attribute_map
39
41
  {
@@ -52,7 +54,8 @@ module Phrase
52
54
  :'source_translations_updated_at' => :'source_translations_updated_at',
53
55
  :'source_locale' => :'source_locale',
54
56
  :'locales' => :'locales',
55
- :'keys' => :'keys'
57
+ :'keys' => :'keys',
58
+ :'annotations' => :'annotations'
56
59
  }
57
60
  end
58
61
 
@@ -74,7 +77,8 @@ module Phrase
74
77
  :'source_translations_updated_at' => :'DateTime',
75
78
  :'source_locale' => :'LocalePreview',
76
79
  :'locales' => :'Array<LocalePreview>',
77
- :'keys' => :'Array<KeyPreview>'
80
+ :'keys' => :'Array<KeyPreview>',
81
+ :'annotations' => :'Array<JobAnnotationShort>'
78
82
  }
79
83
  end
80
84
 
@@ -174,6 +178,12 @@ module Phrase
174
178
  self.keys = value
175
179
  end
176
180
  end
181
+
182
+ if attributes.key?(:'annotations')
183
+ if (value = attributes[:'annotations']).is_a?(Array)
184
+ self.annotations = value
185
+ end
186
+ end
177
187
  end
178
188
 
179
189
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -209,7 +219,8 @@ module Phrase
209
219
  source_translations_updated_at == o.source_translations_updated_at &&
210
220
  source_locale == o.source_locale &&
211
221
  locales == o.locales &&
212
- keys == o.keys
222
+ keys == o.keys &&
223
+ annotations == o.annotations
213
224
  end
214
225
 
215
226
  # @see the `==` method
@@ -221,7 +232,7 @@ module Phrase
221
232
  # Calculates hash code according to all attributes.
222
233
  # @return [Integer] Hash code
223
234
  def hash
224
- [id, name, briefing, due_date, state, ticket_url, project, branch, created_at, updated_at, owner, job_tag_name, source_translations_updated_at, source_locale, locales, keys].hash
235
+ [id, name, briefing, due_date, state, ticket_url, project, branch, created_at, updated_at, owner, job_tag_name, source_translations_updated_at, source_locale, locales, keys, annotations].hash
225
236
  end
226
237
 
227
238
  # Builds the object from hash