phrase 1.0.1 → 1.0.2

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/README.md +50 -387
  3. data/docs/AccountsApi.md +2 -4
  4. data/docs/AuthorizationsApi.md +10 -14
  5. data/docs/BitbucketSyncApi.md +3 -6
  6. data/docs/BlacklistedKeysApi.md +10 -14
  7. data/docs/BranchesApi.md +12 -18
  8. data/docs/CommentsApi.md +13 -20
  9. data/docs/DistributionsApi.md +10 -14
  10. data/docs/FormatsApi.md +1 -2
  11. data/docs/GitLabSyncApi.md +7 -14
  12. data/docs/{GlossaryApi.md → GlossariesApi.md} +26 -30
  13. data/docs/GlossaryTermTranslationsApi.md +8 -10
  14. data/docs/GlossaryTermsApi.md +10 -14
  15. data/docs/InvitationsApi.md +11 -16
  16. data/docs/JobLocalesApi.md +12 -18
  17. data/docs/JobsApi.md +15 -24
  18. data/docs/KeysApi.md +18 -26
  19. data/docs/KeysSearchParameters.md +1 -1
  20. data/docs/KeysTagParameters.md +1 -1
  21. data/docs/KeysUntagParameters.md +1 -1
  22. data/docs/LocalesApi.md +13 -18
  23. data/docs/MembersApi.md +4 -8
  24. data/docs/OrdersApi.md +10 -14
  25. data/docs/ProjectCreateParameters.md +3 -1
  26. data/docs/ProjectsApi.md +10 -14
  27. data/docs/ReleasesApi.md +11 -16
  28. data/docs/ScreenshotMarkersApi.md +10 -14
  29. data/docs/ScreenshotsApi.md +10 -14
  30. data/docs/SpacesApi.md +13 -20
  31. data/docs/StyleGuidesApi.md +10 -14
  32. data/docs/TagsApi.md +9 -12
  33. data/docs/Team.md +29 -0
  34. data/docs/TeamCreateParameters.md +17 -0
  35. data/docs/TeamDetail.md +29 -0
  36. data/docs/TeamUpdateParameters.md +17 -0
  37. data/docs/TeamsApi.md +721 -0
  38. data/docs/TeamsProjectsCreateParameters.md +17 -0
  39. data/docs/TeamsSpacesCreateParameters.md +17 -0
  40. data/docs/TeamsUsersCreateParameters.md +17 -0
  41. data/docs/TranslationsApi.md +28 -44
  42. data/docs/TranslationsExcludeParameters.md +1 -1
  43. data/docs/TranslationsIncludeParameters.md +1 -1
  44. data/docs/TranslationsReviewParameters.md +1 -1
  45. data/docs/TranslationsSearchParameters.md +1 -1
  46. data/docs/TranslationsUnverifyParameters.md +1 -1
  47. data/docs/TranslationsVerifyParameters.md +1 -1
  48. data/docs/UploadCreateParameters.md +2 -2
  49. data/docs/UploadsApi.md +12 -10
  50. data/docs/UsersApi.md +1 -2
  51. data/docs/VersionsHistoryApi.md +2 -4
  52. data/docs/WebhooksApi.md +11 -16
  53. data/git_push.sh +2 -2
  54. data/lib/phrase.rb +9 -1
  55. data/lib/phrase/api/authorizations_api.rb +10 -8
  56. data/lib/phrase/api/bitbucket_sync_api.rb +3 -3
  57. data/lib/phrase/api/blacklisted_keys_api.rb +10 -8
  58. data/lib/phrase/api/branches_api.rb +16 -14
  59. data/lib/phrase/api/comments_api.rb +19 -17
  60. data/lib/phrase/api/distributions_api.rb +10 -8
  61. data/lib/phrase/api/git_lab_sync_api.rb +3 -3
  62. data/lib/phrase/api/{glossary_api.rb → glossaries_api.rb} +31 -29
  63. data/lib/phrase/api/glossary_term_translations_api.rb +10 -8
  64. data/lib/phrase/api/glossary_terms_api.rb +10 -8
  65. data/lib/phrase/api/invitations_api.rb +10 -8
  66. data/lib/phrase/api/job_locales_api.rb +10 -8
  67. data/lib/phrase/api/jobs_api.rb +13 -11
  68. data/lib/phrase/api/keys_api.rb +14 -12
  69. data/lib/phrase/api/locales_api.rb +15 -13
  70. data/lib/phrase/api/members_api.rb +3 -3
  71. data/lib/phrase/api/orders_api.rb +10 -8
  72. data/lib/phrase/api/projects_api.rb +10 -8
  73. data/lib/phrase/api/releases_api.rb +10 -8
  74. data/lib/phrase/api/screenshot_markers_api.rb +10 -8
  75. data/lib/phrase/api/screenshots_api.rb +10 -8
  76. data/lib/phrase/api/spaces_api.rb +16 -14
  77. data/lib/phrase/api/style_guides_api.rb +10 -8
  78. data/lib/phrase/api/tags_api.rb +10 -8
  79. data/lib/phrase/api/teams_api.rb +840 -0
  80. data/lib/phrase/api/translations_api.rb +13 -11
  81. data/lib/phrase/api/uploads_api.rb +13 -5
  82. data/lib/phrase/api/webhooks_api.rb +13 -11
  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/project_create_parameters.rb +14 -4
  87. data/lib/phrase/models/team.rb +254 -0
  88. data/lib/phrase/models/team_create_parameters.rb +195 -0
  89. data/lib/phrase/models/team_detail.rb +254 -0
  90. data/lib/phrase/models/team_update_parameters.rb +195 -0
  91. data/lib/phrase/models/teams_projects_create_parameters.rb +195 -0
  92. data/lib/phrase/models/teams_spaces_create_parameters.rb +195 -0
  93. data/lib/phrase/models/teams_users_create_parameters.rb +195 -0
  94. data/lib/phrase/models/translations_exclude_parameters.rb +1 -1
  95. data/lib/phrase/models/translations_include_parameters.rb +1 -1
  96. data/lib/phrase/models/translations_review_parameters.rb +1 -1
  97. data/lib/phrase/models/translations_search_parameters.rb +1 -1
  98. data/lib/phrase/models/translations_unverify_parameters.rb +1 -1
  99. data/lib/phrase/models/translations_verify_parameters.rb +1 -1
  100. data/lib/phrase/models/upload_create_parameters.rb +4 -8
  101. data/lib/phrase/version.rb +1 -1
  102. data/spec/api/authorizations_api_spec.rb +1 -1
  103. data/spec/api/blacklisted_keys_api_spec.rb +1 -1
  104. data/spec/api/branches_api_spec.rb +1 -1
  105. data/spec/api/comments_api_spec.rb +1 -1
  106. data/spec/api/distributions_api_spec.rb +1 -1
  107. data/spec/api/{glossary_api_spec.rb → glossaries_api_spec.rb} +7 -7
  108. data/spec/api/glossary_term_translations_api_spec.rb +1 -1
  109. data/spec/api/glossary_terms_api_spec.rb +1 -1
  110. data/spec/api/invitations_api_spec.rb +1 -1
  111. data/spec/api/job_locales_api_spec.rb +1 -1
  112. data/spec/api/jobs_api_spec.rb +1 -1
  113. data/spec/api/keys_api_spec.rb +3 -3
  114. data/spec/api/locales_api_spec.rb +2 -2
  115. data/spec/api/orders_api_spec.rb +1 -1
  116. data/spec/api/projects_api_spec.rb +1 -1
  117. data/spec/api/releases_api_spec.rb +1 -1
  118. data/spec/api/screenshot_markers_api_spec.rb +1 -1
  119. data/spec/api/screenshots_api_spec.rb +1 -1
  120. data/spec/api/spaces_api_spec.rb +1 -1
  121. data/spec/api/style_guides_api_spec.rb +1 -1
  122. data/spec/api/tags_api_spec.rb +1 -1
  123. data/spec/api/teams_api_spec.rb +185 -0
  124. data/spec/api/translations_api_spec.rb +4 -4
  125. data/spec/api/uploads_api_spec.rb +3 -1
  126. data/spec/api/webhooks_api_spec.rb +1 -1
  127. data/spec/models/project_create_parameters_spec.rb +6 -0
  128. data/spec/models/team_create_parameters_spec.rb +29 -0
  129. data/spec/models/team_detail_spec.rb +65 -0
  130. data/spec/models/team_spec.rb +65 -0
  131. data/spec/models/team_update_parameters_spec.rb +29 -0
  132. data/spec/models/teams_projects_create_parameters_spec.rb +29 -0
  133. data/spec/models/teams_spaces_create_parameters_spec.rb +29 -0
  134. data/spec/models/teams_users_create_parameters_spec.rb +29 -0
  135. metadata +183 -151
@@ -0,0 +1,195 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class TeamCreateParameters
5
+ # Name of the team
6
+ attr_accessor :name
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+ :'name' => :'name'
12
+ }
13
+ end
14
+
15
+ # Attribute type mapping.
16
+ def self.openapi_types
17
+ {
18
+ :'name' => :'String'
19
+ }
20
+ end
21
+
22
+ # List of attributes with nullable: true
23
+ def self.openapi_nullable
24
+ Set.new([
25
+ ])
26
+ end
27
+
28
+ # Initializes the object
29
+ # @param [Hash] attributes Model attributes in the form of hash
30
+ def initialize(attributes = {})
31
+ if (!attributes.is_a?(Hash))
32
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::TeamCreateParameters` initialize method"
33
+ end
34
+
35
+ # check to see if the attribute exists and convert string to symbol for hash key
36
+ attributes = attributes.each_with_object({}) { |(k, v), h|
37
+ if (!self.class.attribute_map.key?(k.to_sym))
38
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::TeamCreateParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
39
+ end
40
+ h[k.to_sym] = v
41
+ }
42
+
43
+ if attributes.key?(:'name')
44
+ self.name = attributes[:'name']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ name == o.name
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Integer] Hash code
77
+ def hash
78
+ [name].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def self.build_from_hash(attributes)
85
+ new.build_from_hash(attributes)
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :Boolean
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ Phrase.const_get(type).build_from_hash(value)
146
+ end
147
+ end
148
+
149
+ # Returns the string representation of the object
150
+ # @return [String] String presentation of the object
151
+ def to_s
152
+ to_hash.to_s
153
+ end
154
+
155
+ # to_body is an alias to to_hash (backward compatibility)
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_body
158
+ to_hash
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ if value.nil?
168
+ is_nullable = self.class.openapi_nullable.include?(attr)
169
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
170
+ end
171
+
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,254 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class TeamDetail
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ attr_accessor :projects
14
+
15
+ attr_accessor :spaces
16
+
17
+ attr_accessor :users
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'id' => :'id',
23
+ :'name' => :'name',
24
+ :'created_at' => :'created_at',
25
+ :'updated_at' => :'updated_at',
26
+ :'projects' => :'projects',
27
+ :'spaces' => :'spaces',
28
+ :'users' => :'users'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'id' => :'String',
36
+ :'name' => :'String',
37
+ :'created_at' => :'DateTime',
38
+ :'updated_at' => :'DateTime',
39
+ :'projects' => :'Array<Project>',
40
+ :'spaces' => :'Array<Space>',
41
+ :'users' => :'Array<User>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::TeamDetail` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::TeamDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'id')
67
+ self.id = attributes[:'id']
68
+ end
69
+
70
+ if attributes.key?(:'name')
71
+ self.name = attributes[:'name']
72
+ end
73
+
74
+ if attributes.key?(:'created_at')
75
+ self.created_at = attributes[:'created_at']
76
+ end
77
+
78
+ if attributes.key?(:'updated_at')
79
+ self.updated_at = attributes[:'updated_at']
80
+ end
81
+
82
+ if attributes.key?(:'projects')
83
+ if (value = attributes[:'projects']).is_a?(Array)
84
+ self.projects = value
85
+ end
86
+ end
87
+
88
+ if attributes.key?(:'spaces')
89
+ if (value = attributes[:'spaces']).is_a?(Array)
90
+ self.spaces = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'users')
95
+ if (value = attributes[:'users']).is_a?(Array)
96
+ self.users = value
97
+ end
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ true
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ id == o.id &&
120
+ name == o.name &&
121
+ created_at == o.created_at &&
122
+ updated_at == o.updated_at &&
123
+ projects == o.projects &&
124
+ spaces == o.spaces &&
125
+ users == o.users
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [id, name, created_at, updated_at, projects, spaces, users].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ new.build_from_hash(attributes)
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.openapi_types.each_pair do |key, type|
153
+ if type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
157
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ end
159
+ elsif !attributes[self.class.attribute_map[key]].nil?
160
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :Boolean
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ Phrase.const_get(type).build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+ end
254
+ end
@@ -0,0 +1,195 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class TeamUpdateParameters
5
+ # New name of the team
6
+ attr_accessor :name
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+ :'name' => :'name'
12
+ }
13
+ end
14
+
15
+ # Attribute type mapping.
16
+ def self.openapi_types
17
+ {
18
+ :'name' => :'String'
19
+ }
20
+ end
21
+
22
+ # List of attributes with nullable: true
23
+ def self.openapi_nullable
24
+ Set.new([
25
+ ])
26
+ end
27
+
28
+ # Initializes the object
29
+ # @param [Hash] attributes Model attributes in the form of hash
30
+ def initialize(attributes = {})
31
+ if (!attributes.is_a?(Hash))
32
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::TeamUpdateParameters` initialize method"
33
+ end
34
+
35
+ # check to see if the attribute exists and convert string to symbol for hash key
36
+ attributes = attributes.each_with_object({}) { |(k, v), h|
37
+ if (!self.class.attribute_map.key?(k.to_sym))
38
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::TeamUpdateParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
39
+ end
40
+ h[k.to_sym] = v
41
+ }
42
+
43
+ if attributes.key?(:'name')
44
+ self.name = attributes[:'name']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ name == o.name
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Integer] Hash code
77
+ def hash
78
+ [name].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def self.build_from_hash(attributes)
85
+ new.build_from_hash(attributes)
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :Boolean
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ Phrase.const_get(type).build_from_hash(value)
146
+ end
147
+ end
148
+
149
+ # Returns the string representation of the object
150
+ # @return [String] String presentation of the object
151
+ def to_s
152
+ to_hash.to_s
153
+ end
154
+
155
+ # to_body is an alias to to_hash (backward compatibility)
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_body
158
+ to_hash
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ if value.nil?
168
+ is_nullable = self.class.openapi_nullable.include?(attr)
169
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
170
+ end
171
+
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+ end
195
+ end