phrase 2.8.3 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +31 -12
  4. data/docs/BitbucketSyncApi.md +2 -2
  5. data/docs/BranchesApi.md +3 -3
  6. data/docs/GitHubSyncApi.md +2 -2
  7. data/docs/GitLabSyncApi.md +2 -2
  8. data/docs/JobCommentsApi.md +6 -6
  9. data/docs/JobLocale.md +3 -1
  10. data/docs/JobLocaleUpdateParameters.md +5 -1
  11. data/docs/JobLocalesCreateParameters.md +6 -2
  12. data/docs/JobTemplateDetails.md +35 -0
  13. data/docs/JobTemplateDetails1.md +21 -0
  14. data/docs/JobTemplateLocaleUpdateParameters.md +6 -2
  15. data/docs/{JobTemplateLocale.md → JobTemplateLocales.md} +6 -4
  16. data/docs/JobTemplateLocalesApi.md +8 -8
  17. data/docs/JobTemplateLocalesCreateParameters.md +5 -1
  18. data/docs/JobTemplatesApi.md +41 -41
  19. data/docs/KeysSearchParameters.md +1 -1
  20. data/docs/LocaleTeamPreview.md +21 -0
  21. data/docs/{JobTemplateUserPreview.md → LocaleUserPreview.md} +2 -2
  22. data/docs/LocalesApi.md +8 -4
  23. data/docs/NotificationGroupDetail.md +1 -1
  24. data/docs/NotificationGroupsApi.md +4 -4
  25. data/docs/NotificationsApi.md +4 -4
  26. data/docs/OrganizationJobTemplate.md +25 -0
  27. data/docs/OrganizationJobTemplateCreateParameters.md +19 -0
  28. data/docs/OrganizationJobTemplateDetails.md +31 -0
  29. data/docs/OrganizationJobTemplateLocaleUpdateParameters.md +27 -0
  30. data/docs/OrganizationJobTemplateLocalesApi.md +341 -0
  31. data/docs/OrganizationJobTemplateLocalesCreateParameters.md +27 -0
  32. data/docs/OrganizationJobTemplateUpdateParameters.md +19 -0
  33. data/docs/OrganizationJobTemplatesApi.md +331 -0
  34. data/docs/Project.md +2 -0
  35. data/docs/ProjectCreateParameters.md +5 -1
  36. data/docs/ProjectDetails.md +2 -0
  37. data/docs/ProjectUpdateParameters.md +5 -1
  38. data/docs/SearchApi.md +1 -1
  39. data/docs/TranslationsApi.md +23 -19
  40. data/docs/TranslationsExcludeParameters.md +1 -1
  41. data/docs/TranslationsIncludeParameters.md +1 -1
  42. data/docs/TranslationsReviewParameters.md +1 -1
  43. data/docs/TranslationsSearchParameters.md +1 -1
  44. data/docs/TranslationsUnverifyParameters.md +1 -1
  45. data/docs/TranslationsVerifyParameters.md +1 -1
  46. data/docs/UploadsApi.md +3 -3
  47. data/lib/phrase/api/bitbucket_sync_api.rb +4 -4
  48. data/lib/phrase/api/branches_api.rb +6 -6
  49. data/lib/phrase/api/git_hub_sync_api.rb +4 -4
  50. data/lib/phrase/api/git_lab_sync_api.rb +4 -4
  51. data/lib/phrase/api/job_comments_api.rb +9 -9
  52. data/lib/phrase/api/job_template_locales_api.rb +12 -12
  53. data/lib/phrase/api/job_templates_api.rb +72 -72
  54. data/lib/phrase/api/locales_api.rb +10 -4
  55. data/lib/phrase/api/notification_groups_api.rb +6 -6
  56. data/lib/phrase/api/notifications_api.rb +6 -6
  57. data/lib/phrase/api/organization_job_template_locales_api.rb +408 -0
  58. data/lib/phrase/api/organization_job_templates_api.rb +378 -0
  59. data/lib/phrase/api/search_api.rb +2 -2
  60. data/lib/phrase/api/translations_api.rb +20 -14
  61. data/lib/phrase/api/uploads_api.rb +2 -2
  62. data/lib/phrase/models/job_locale.rb +13 -2
  63. data/lib/phrase/models/job_locale_update_parameters.rb +28 -4
  64. data/lib/phrase/models/job_locales_create_parameters.rb +33 -4
  65. data/lib/phrase/models/job_template_details.rb +285 -0
  66. data/lib/phrase/models/job_template_details1.rb +214 -0
  67. data/lib/phrase/models/job_template_locale_update_parameters.rb +28 -9
  68. data/lib/phrase/models/{job_template_locale.rb → job_template_locales.rb} +18 -7
  69. data/lib/phrase/models/job_template_locales_create_parameters.rb +28 -4
  70. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  71. data/lib/phrase/models/locale_team_preview.rb +212 -0
  72. data/lib/phrase/models/{job_template_user_preview.rb → locale_user_preview.rb} +3 -3
  73. data/lib/phrase/models/notification_group_detail.rb +1 -1
  74. data/lib/phrase/models/organization_job_template.rb +230 -0
  75. data/lib/phrase/models/organization_job_template_create_parameters.rb +210 -0
  76. data/lib/phrase/models/organization_job_template_details.rb +267 -0
  77. data/lib/phrase/models/organization_job_template_locale_update_parameters.rb +253 -0
  78. data/lib/phrase/models/organization_job_template_locales_create_parameters.rb +263 -0
  79. data/lib/phrase/models/organization_job_template_update_parameters.rb +210 -0
  80. data/lib/phrase/models/project.rb +10 -1
  81. data/lib/phrase/models/project_create_parameters.rb +22 -2
  82. data/lib/phrase/models/project_details.rb +10 -1
  83. data/lib/phrase/models/project_update_parameters.rb +22 -2
  84. data/lib/phrase/models/translations_exclude_parameters.rb +1 -1
  85. data/lib/phrase/models/translations_include_parameters.rb +1 -1
  86. data/lib/phrase/models/translations_review_parameters.rb +1 -1
  87. data/lib/phrase/models/translations_search_parameters.rb +1 -1
  88. data/lib/phrase/models/translations_unverify_parameters.rb +1 -1
  89. data/lib/phrase/models/translations_verify_parameters.rb +1 -1
  90. data/lib/phrase/version.rb +1 -1
  91. data/lib/phrase.rb +13 -2
  92. data/spec/api/bitbucket_sync_api_spec.rb +2 -2
  93. data/spec/api/branches_api_spec.rb +3 -3
  94. data/spec/api/git_hub_sync_api_spec.rb +2 -2
  95. data/spec/api/git_lab_sync_api_spec.rb +2 -2
  96. data/spec/api/job_comments_api_spec.rb +3 -3
  97. data/spec/api/job_template_locales_api_spec.rb +4 -4
  98. data/spec/api/job_templates_api_spec.rb +17 -17
  99. data/spec/api/locales_api_spec.rb +4 -2
  100. data/spec/api/notification_groups_api_spec.rb +2 -2
  101. data/spec/api/notifications_api_spec.rb +2 -2
  102. data/spec/api/organization_job_template_locales_api_spec.rb +100 -0
  103. data/spec/api/organization_job_templates_api_spec.rb +95 -0
  104. data/spec/api/search_api_spec.rb +1 -1
  105. data/spec/api/translations_api_spec.rb +9 -7
  106. data/spec/api/uploads_api_spec.rb +1 -1
  107. data/spec/models/job_locale_spec.rb +6 -0
  108. data/spec/models/job_locale_update_parameters_spec.rb +12 -0
  109. data/spec/models/job_locales_create_parameters_spec.rb +12 -0
  110. data/spec/models/job_template_details1_spec.rb +41 -0
  111. data/spec/models/job_template_details_spec.rb +83 -0
  112. data/spec/models/job_template_locale_update_parameters_spec.rb +12 -0
  113. data/spec/models/job_template_locales_create_parameters_spec.rb +12 -0
  114. data/spec/models/{job_template_locale_spec.rb → job_template_locales_spec.rb} +12 -6
  115. data/spec/models/locale_team_preview_spec.rb +41 -0
  116. data/spec/models/{job_template_user_preview_spec.rb → locale_user_preview_spec.rb} +6 -6
  117. data/spec/models/organization_job_template_create_parameters_spec.rb +35 -0
  118. data/spec/models/organization_job_template_details_spec.rb +71 -0
  119. data/spec/models/organization_job_template_locale_update_parameters_spec.rb +59 -0
  120. data/spec/models/organization_job_template_locales_create_parameters_spec.rb +59 -0
  121. data/spec/models/organization_job_template_spec.rb +53 -0
  122. data/spec/models/organization_job_template_update_parameters_spec.rb +35 -0
  123. data/spec/models/project_create_parameters_spec.rb +12 -0
  124. data/spec/models/project_details_spec.rb +6 -0
  125. data/spec/models/project_spec.rb +6 -0
  126. data/spec/models/project_update_parameters_spec.rb +12 -0
  127. metadata +269 -225
@@ -0,0 +1,230 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class OrganizationJobTemplate
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :briefing
10
+
11
+ attr_accessor :created_at
12
+
13
+ attr_accessor :updated_at
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
+ :'briefing' => :'briefing',
21
+ :'created_at' => :'created_at',
22
+ :'updated_at' => :'updated_at'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'id' => :'String',
30
+ :'name' => :'String',
31
+ :'briefing' => :'String',
32
+ :'created_at' => :'DateTime',
33
+ :'updated_at' => :'DateTime'
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::OrganizationJobTemplate` 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::OrganizationJobTemplate`. 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?(:'briefing')
67
+ self.briefing = attributes[:'briefing']
68
+ end
69
+
70
+ if attributes.key?(:'created_at')
71
+ self.created_at = attributes[:'created_at']
72
+ end
73
+
74
+ if attributes.key?(:'updated_at')
75
+ self.updated_at = attributes[:'updated_at']
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
+ briefing == o.briefing &&
100
+ created_at == o.created_at &&
101
+ updated_at == o.updated_at
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, briefing, created_at, updated_at].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
@@ -0,0 +1,210 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class OrganizationJobTemplateCreateParameters
5
+ # Job template name
6
+ attr_accessor :name
7
+
8
+ # Briefing for the translators
9
+ attr_accessor :briefing
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+ :'name' => :'name',
15
+ :'briefing' => :'briefing'
16
+ }
17
+ end
18
+
19
+ # Attribute type mapping.
20
+ def self.openapi_types
21
+ {
22
+ :'name' => :'String',
23
+ :'briefing' => :'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::OrganizationJobTemplateCreateParameters` 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::OrganizationJobTemplateCreateParameters`. 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?(:'name')
49
+ self.name = attributes[:'name']
50
+ end
51
+
52
+ if attributes.key?(:'briefing')
53
+ self.briefing = attributes[:'briefing']
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
+ if @name.nil?
62
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
63
+ end
64
+
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return false if @name.nil?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ name == o.name &&
81
+ briefing == o.briefing
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Integer] Hash code
92
+ def hash
93
+ [name, briefing].hash
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 self.build_from_hash(attributes)
100
+ new.build_from_hash(attributes)
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.openapi_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :Boolean
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ Phrase.const_get(type).build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ if value.nil?
183
+ is_nullable = self.class.openapi_nullable.include?(attr)
184
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
185
+ end
186
+
187
+ hash[param] = _to_hash(value)
188
+ end
189
+ hash
190
+ end
191
+
192
+ # Outputs non-array value in the form of hash
193
+ # For object, use to_hash. Otherwise, just return the value
194
+ # @param [Object] value Any valid value
195
+ # @return [Hash] Returns the value in the form of hash
196
+ def _to_hash(value)
197
+ if value.is_a?(Array)
198
+ value.compact.map { |v| _to_hash(v) }
199
+ elsif value.is_a?(Hash)
200
+ {}.tap do |hash|
201
+ value.each { |k, v| hash[k] = _to_hash(v) }
202
+ end
203
+ elsif value.respond_to? :to_hash
204
+ value.to_hash
205
+ else
206
+ value
207
+ end
208
+ end
209
+ end
210
+ end
@@ -0,0 +1,267 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class OrganizationJobTemplateDetails
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :briefing
10
+
11
+ attr_accessor :created_at
12
+
13
+ attr_accessor :updated_at
14
+
15
+ attr_accessor :owner
16
+
17
+ attr_accessor :creator
18
+
19
+ attr_accessor :locales
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'id' => :'id',
25
+ :'name' => :'name',
26
+ :'briefing' => :'briefing',
27
+ :'created_at' => :'created_at',
28
+ :'updated_at' => :'updated_at',
29
+ :'owner' => :'owner',
30
+ :'creator' => :'creator',
31
+ :'locales' => :'locales'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'id' => :'String',
39
+ :'name' => :'String',
40
+ :'briefing' => :'String',
41
+ :'created_at' => :'DateTime',
42
+ :'updated_at' => :'DateTime',
43
+ :'owner' => :'UserPreview',
44
+ :'creator' => :'UserPreview',
45
+ :'locales' => :'Array<LocalePreview>'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # List of class defined in allOf (OpenAPI v3)
56
+ def self.openapi_all_of
57
+ [
58
+ :'JobTemplateDetails1',
59
+ :'OrganizationJobTemplate'
60
+ ]
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::OrganizationJobTemplateDetails` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::OrganizationJobTemplateDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'id')
79
+ self.id = attributes[:'id']
80
+ end
81
+
82
+ if attributes.key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.key?(:'briefing')
87
+ self.briefing = attributes[:'briefing']
88
+ end
89
+
90
+ if attributes.key?(:'created_at')
91
+ self.created_at = attributes[:'created_at']
92
+ end
93
+
94
+ if attributes.key?(:'updated_at')
95
+ self.updated_at = attributes[:'updated_at']
96
+ end
97
+
98
+ if attributes.key?(:'owner')
99
+ self.owner = attributes[:'owner']
100
+ end
101
+
102
+ if attributes.key?(:'creator')
103
+ self.creator = attributes[:'creator']
104
+ end
105
+
106
+ if attributes.key?(:'locales')
107
+ if (value = attributes[:'locales']).is_a?(Array)
108
+ self.locales = value
109
+ end
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ invalid_properties = Array.new
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ true
124
+ end
125
+
126
+ # Checks equality by comparing each attribute.
127
+ # @param [Object] Object to be compared
128
+ def ==(o)
129
+ return true if self.equal?(o)
130
+ self.class == o.class &&
131
+ id == o.id &&
132
+ name == o.name &&
133
+ briefing == o.briefing &&
134
+ created_at == o.created_at &&
135
+ updated_at == o.updated_at &&
136
+ owner == o.owner &&
137
+ creator == o.creator &&
138
+ locales == o.locales
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [id, name, briefing, created_at, updated_at, owner, creator, locales].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ new.build_from_hash(attributes)
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ self.class.openapi_types.each_pair do |key, type|
166
+ if type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
171
+ end
172
+ elsif !attributes[self.class.attribute_map[key]].nil?
173
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
174
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :DateTime
187
+ DateTime.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ Phrase.const_get(type).build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ # Returns the string representation of the object
222
+ # @return [String] String presentation of the object
223
+ def to_s
224
+ to_hash.to_s
225
+ end
226
+
227
+ # to_body is an alias to to_hash (backward compatibility)
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_body
230
+ to_hash
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ if value.nil?
240
+ is_nullable = self.class.openapi_nullable.include?(attr)
241
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
242
+ end
243
+
244
+ hash[param] = _to_hash(value)
245
+ end
246
+ hash
247
+ end
248
+
249
+ # Outputs non-array value in the form of hash
250
+ # For object, use to_hash. Otherwise, just return the value
251
+ # @param [Object] value Any valid value
252
+ # @return [Hash] Returns the value in the form of hash
253
+ def _to_hash(value)
254
+ if value.is_a?(Array)
255
+ value.compact.map { |v| _to_hash(v) }
256
+ elsif value.is_a?(Hash)
257
+ {}.tap do |hash|
258
+ value.each { |k, v| hash[k] = _to_hash(v) }
259
+ end
260
+ elsif value.respond_to? :to_hash
261
+ value.to_hash
262
+ else
263
+ value
264
+ end
265
+ end
266
+ end
267
+ end