phrase 3.7.1 → 4.4.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 (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +63 -0
  3. data/README.md +13 -37
  4. data/docs/AccountDetails.md +3 -1
  5. data/docs/JobDetails.md +2 -0
  6. data/docs/JobKeysDeleteParameters.md +19 -0
  7. data/docs/JobsApi.md +16 -14
  8. data/docs/KeyCreateParameters.md +1 -1
  9. data/docs/KeyUpdateParameters.md +1 -1
  10. data/docs/KeysApi.md +4 -4
  11. data/docs/KeysExcludeParameters.md +1 -1
  12. data/docs/KeysIncludeParameters.md +1 -1
  13. data/docs/KeysSearchParameters.md +1 -1
  14. data/docs/KeysTagParameters.md +1 -1
  15. data/docs/KeysUntagParameters.md +1 -1
  16. data/docs/LocalesApi.md +3 -1
  17. data/docs/ProjectCreateParameters.md +1 -1
  18. data/docs/ProjectUpdateParameters.md +4 -2
  19. data/docs/QualityPerformanceScoreApi.md +8 -8
  20. data/docs/QualityPerformanceScoreList200Response.md +21 -0
  21. data/docs/QualityPerformanceScoreList200ResponseAnyOf.md +19 -0
  22. data/docs/QualityPerformanceScoreList200ResponseAnyOfData.md +17 -0
  23. data/docs/{ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md → QualityPerformanceScoreList200ResponseAnyOfDataTranslationsInner.md} +2 -2
  24. data/docs/{ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md → QualityPerformanceScoreList200ResponseAnyOfErrorsInner.md} +2 -2
  25. data/docs/{ProjectsQualityPerformanceScoreRequest.md → QualityPerformanceScoreListRequest.md} +2 -2
  26. data/docs/RepoSyncEvent.md +3 -3
  27. data/docs/RepoSyncEventsApi.md +138 -0
  28. data/docs/RepoSyncsApi.md +2 -132
  29. data/docs/ScreenshotUpdateParameters.md +1 -1
  30. data/docs/Upload.md +3 -1
  31. data/lib/phrase/api/jobs_api.rb +24 -16
  32. data/lib/phrase/api/keys_api.rb +4 -4
  33. data/lib/phrase/api/locales_api.rb +3 -0
  34. data/lib/phrase/api/quality_performance_score_api.rb +15 -15
  35. data/lib/phrase/api/repo_sync_events_api.rb +160 -0
  36. data/lib/phrase/api/repo_syncs_api.rb +4 -154
  37. data/lib/phrase/models/account_details.rb +15 -4
  38. data/lib/phrase/models/job_details.rb +10 -1
  39. data/lib/phrase/models/job_keys_delete_parameters.rb +214 -0
  40. data/lib/phrase/models/keys_exclude_parameters.rb +1 -1
  41. data/lib/phrase/models/keys_include_parameters.rb +1 -1
  42. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  43. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  44. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  45. data/lib/phrase/models/project_update_parameters.rb +48 -4
  46. data/lib/phrase/models/{projects_quality_performance_score200_response.rb → quality_performance_score_list200_response.rb} +6 -6
  47. data/lib/phrase/models/{projects_quality_performance_score200_response_any_of.rb → quality_performance_score_list200_response_any_of.rb} +5 -5
  48. data/lib/phrase/models/{projects_quality_performance_score200_response_any_of_data.rb → quality_performance_score_list200_response_any_of_data.rb} +4 -4
  49. data/lib/phrase/models/{projects_quality_performance_score200_response_any_of_data_translations_inner.rb → quality_performance_score_list200_response_any_of_data_translations_inner.rb} +3 -3
  50. data/lib/phrase/models/{projects_quality_performance_score200_response_any_of_errors_inner.rb → quality_performance_score_list200_response_any_of_errors_inner.rb} +3 -3
  51. data/lib/phrase/models/{projects_quality_performance_score_request.rb → quality_performance_score_list_request.rb} +3 -3
  52. data/lib/phrase/models/repo_sync_event.rb +15 -15
  53. data/lib/phrase/models/upload.rb +14 -1
  54. data/lib/phrase/version.rb +1 -1
  55. data/lib/phrase.rb +8 -22
  56. data/spec/api/jobs_api_spec.rb +6 -5
  57. data/spec/api/keys_api_spec.rb +2 -2
  58. data/spec/api/quality_performance_score_api_spec.rb +4 -4
  59. data/spec/api/repo_sync_events_api_spec.rb +52 -0
  60. data/spec/api/repo_syncs_api_spec.rb +2 -31
  61. data/spec/models/account_details_spec.rb +6 -0
  62. data/spec/models/job_details_spec.rb +6 -0
  63. data/spec/models/{gitlab_sync_export_spec.rb → job_keys_delete_parameters_spec.rb} +8 -8
  64. data/spec/models/project_update_parameters_spec.rb +10 -0
  65. data/spec/models/quality_performance_score_list200_response_any_of_data_spec.rb +29 -0
  66. data/spec/models/{projects_quality_performance_score200_response_any_of_data_translations_inner_spec.rb → quality_performance_score_list200_response_any_of_data_translations_inner_spec.rb} +6 -6
  67. data/spec/models/{projects_quality_performance_score200_response_any_of_errors_inner_spec.rb → quality_performance_score_list200_response_any_of_errors_inner_spec.rb} +6 -6
  68. data/spec/models/{projects_quality_performance_score200_response_any_of_spec.rb → quality_performance_score_list200_response_any_of_spec.rb} +6 -6
  69. data/spec/models/{projects_quality_performance_score200_response_spec.rb → quality_performance_score_list200_response_spec.rb} +6 -6
  70. data/spec/models/{projects_quality_performance_score_request_spec.rb → quality_performance_score_list_request_spec.rb} +6 -6
  71. data/spec/models/repo_sync_event_spec.rb +2 -2
  72. data/spec/models/upload_spec.rb +6 -0
  73. metadata +259 -315
  74. data/docs/BitbucketSync.md +0 -27
  75. data/docs/BitbucketSyncApi.md +0 -197
  76. data/docs/BitbucketSyncExportParameters.md +0 -17
  77. data/docs/BitbucketSyncExportResponse.md +0 -17
  78. data/docs/BitbucketSyncImportParameters.md +0 -17
  79. data/docs/GitHubSyncApi.md +0 -130
  80. data/docs/GitLabSyncApi.md +0 -463
  81. data/docs/GithubSyncExportParameters.md +0 -17
  82. data/docs/GithubSyncImportParameters.md +0 -17
  83. data/docs/GitlabSync.md +0 -37
  84. data/docs/GitlabSyncExport.md +0 -19
  85. data/docs/GitlabSyncExportParameters.md +0 -17
  86. data/docs/GitlabSyncHistory.md +0 -25
  87. data/docs/GitlabSyncHistoryErrorsInner.md +0 -19
  88. data/docs/GitlabSyncImportParameters.md +0 -17
  89. data/docs/ProjectsQualityPerformanceScore200Response.md +0 -21
  90. data/docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md +0 -19
  91. data/docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md +0 -17
  92. data/docs/RepoSyncEventErrorsInner.md +0 -16
  93. data/lib/phrase/api/bitbucket_sync_api.rb +0 -219
  94. data/lib/phrase/api/git_hub_sync_api.rb +0 -146
  95. data/lib/phrase/api/git_lab_sync_api.rb +0 -510
  96. data/lib/phrase/models/bitbucket_sync.rb +0 -243
  97. data/lib/phrase/models/bitbucket_sync_export_parameters.rb +0 -197
  98. data/lib/phrase/models/bitbucket_sync_export_response.rb +0 -196
  99. data/lib/phrase/models/bitbucket_sync_import_parameters.rb +0 -197
  100. data/lib/phrase/models/github_sync_export_parameters.rb +0 -197
  101. data/lib/phrase/models/github_sync_import_parameters.rb +0 -197
  102. data/lib/phrase/models/gitlab_sync.rb +0 -286
  103. data/lib/phrase/models/gitlab_sync_export.rb +0 -205
  104. data/lib/phrase/models/gitlab_sync_export_parameters.rb +0 -197
  105. data/lib/phrase/models/gitlab_sync_history.rb +0 -234
  106. data/lib/phrase/models/gitlab_sync_history_errors_inner.rb +0 -205
  107. data/lib/phrase/models/gitlab_sync_import_parameters.rb +0 -197
  108. data/lib/phrase/models/repo_sync_event_errors_inner.rb +0 -207
  109. data/spec/api/bitbucket_sync_api_spec.rb +0 -64
  110. data/spec/api/git_hub_sync_api_spec.rb +0 -49
  111. data/spec/api/git_lab_sync_api_spec.rb +0 -125
  112. data/spec/models/bitbucket_sync_export_parameters_spec.rb +0 -29
  113. data/spec/models/bitbucket_sync_export_response_spec.rb +0 -29
  114. data/spec/models/bitbucket_sync_import_parameters_spec.rb +0 -29
  115. data/spec/models/bitbucket_sync_spec.rb +0 -59
  116. data/spec/models/github_sync_export_parameters_spec.rb +0 -29
  117. data/spec/models/github_sync_import_parameters_spec.rb +0 -29
  118. data/spec/models/gitlab_sync_export_parameters_spec.rb +0 -29
  119. data/spec/models/gitlab_sync_history_errors_inner_spec.rb +0 -35
  120. data/spec/models/gitlab_sync_history_spec.rb +0 -53
  121. data/spec/models/gitlab_sync_import_parameters_spec.rb +0 -29
  122. data/spec/models/gitlab_sync_spec.rb +0 -89
  123. data/spec/models/projects_quality_performance_score200_response_any_of_data_spec.rb +0 -29
  124. data/spec/models/repo_sync_event_errors_inner_spec.rb +0 -23
@@ -1,234 +0,0 @@
1
- require 'date'
2
-
3
- module Phrase
4
- class GitlabSyncHistory
5
- attr_accessor :status
6
-
7
- attr_accessor :action
8
-
9
- attr_accessor :errors
10
-
11
- attr_accessor :date
12
-
13
- attr_accessor :details
14
-
15
- # Attribute mapping from ruby-style variable name to JSON key.
16
- def self.attribute_map
17
- {
18
- :'status' => :'status',
19
- :'action' => :'action',
20
- :'errors' => :'errors',
21
- :'date' => :'date',
22
- :'details' => :'details'
23
- }
24
- end
25
-
26
- # Attribute type mapping.
27
- def self.openapi_types
28
- {
29
- :'status' => :'String',
30
- :'action' => :'String',
31
- :'errors' => :'Array<GitlabSyncHistoryErrorsInner>',
32
- :'date' => :'DateTime',
33
- :'details' => :'Object'
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::GitlabSyncHistory` 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::GitlabSyncHistory`. 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?(:'status')
59
- self.status = attributes[:'status']
60
- end
61
-
62
- if attributes.key?(:'action')
63
- self.action = attributes[:'action']
64
- end
65
-
66
- if attributes.key?(:'errors')
67
- if (value = attributes[:'errors']).is_a?(Array)
68
- self.errors = value
69
- end
70
- end
71
-
72
- if attributes.key?(:'date')
73
- self.date = attributes[:'date']
74
- end
75
-
76
- if attributes.key?(:'details')
77
- self.details = attributes[:'details']
78
- end
79
- end
80
-
81
- # Show invalid properties with the reasons. Usually used together with valid?
82
- # @return Array for valid properties with the reasons
83
- def list_invalid_properties
84
- invalid_properties = Array.new
85
- invalid_properties
86
- end
87
-
88
- # Check to see if the all the properties in the model are valid
89
- # @return true if the model is valid
90
- def valid?
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
- status == o.status &&
100
- action == o.action &&
101
- errors == o.errors &&
102
- date == o.date &&
103
- details == o.details
104
- end
105
-
106
- # @see the `==` method
107
- # @param [Object] Object to be compared
108
- def eql?(o)
109
- self == o
110
- end
111
-
112
- # Calculates hash code according to all attributes.
113
- # @return [Integer] Hash code
114
- def hash
115
- [status, action, errors, date, details].hash
116
- end
117
-
118
- # Builds the object from hash
119
- # @param [Hash] attributes Model attributes in the form of hash
120
- # @return [Object] Returns the model itself
121
- def self.build_from_hash(attributes)
122
- new.build_from_hash(attributes)
123
- end
124
-
125
- # Builds the object from hash
126
- # @param [Hash] attributes Model attributes in the form of hash
127
- # @return [Object] Returns the model itself
128
- def build_from_hash(attributes)
129
- return nil unless attributes.is_a?(Hash)
130
- self.class.openapi_types.each_pair do |key, type|
131
- if type =~ /\AArray<(.*)>/i
132
- # check to ensure the input is an array given that the attribute
133
- # is documented as an array but the input is not
134
- if attributes[self.class.attribute_map[key]].is_a?(Array)
135
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
- end
137
- elsif !attributes[self.class.attribute_map[key]].nil?
138
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
- end # or else data not found in attributes(hash), not an issue as the data can be optional
140
- end
141
-
142
- self
143
- end
144
-
145
- # Deserializes the data based on type
146
- # @param string type Data type
147
- # @param string value Value to be deserialized
148
- # @return [Object] Deserialized data
149
- def _deserialize(type, value)
150
- case type.to_sym
151
- when :DateTime
152
- DateTime.parse(value)
153
- when :Date
154
- Date.parse(value)
155
- when :Time
156
- Time.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
@@ -1,205 +0,0 @@
1
- require 'date'
2
-
3
- module Phrase
4
- class GitlabSyncHistoryErrorsInner
5
- attr_accessor :error
6
-
7
- attr_accessor :message
8
-
9
- # Attribute mapping from ruby-style variable name to JSON key.
10
- def self.attribute_map
11
- {
12
- :'error' => :'error',
13
- :'message' => :'message'
14
- }
15
- end
16
-
17
- # Attribute type mapping.
18
- def self.openapi_types
19
- {
20
- :'error' => :'String',
21
- :'message' => :'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::GitlabSyncHistoryErrorsInner` 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::GitlabSyncHistoryErrorsInner`. 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?(:'error')
47
- self.error = attributes[:'error']
48
- end
49
-
50
- if attributes.key?(:'message')
51
- self.message = attributes[:'message']
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
- error == o.error &&
74
- message == o.message
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
- [error, message].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 :Time
127
- Time.parse(value)
128
- when :String
129
- value.to_s
130
- when :Integer
131
- value.to_i
132
- when :Float
133
- value.to_f
134
- when :Boolean
135
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
136
- true
137
- else
138
- false
139
- end
140
- when :Object
141
- # generic object (usually a Hash), return directly
142
- value
143
- when /\AArray<(?<inner_type>.+)>\z/
144
- inner_type = Regexp.last_match[:inner_type]
145
- value.map { |v| _deserialize(inner_type, v) }
146
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
147
- k_type = Regexp.last_match[:k_type]
148
- v_type = Regexp.last_match[:v_type]
149
- {}.tap do |hash|
150
- value.each do |k, v|
151
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
152
- end
153
- end
154
- else # model
155
- Phrase.const_get(type).build_from_hash(value)
156
- end
157
- end
158
-
159
- # Returns the string representation of the object
160
- # @return [String] String presentation of the object
161
- def to_s
162
- to_hash.to_s
163
- end
164
-
165
- # to_body is an alias to to_hash (backward compatibility)
166
- # @return [Hash] Returns the object in the form of hash
167
- def to_body
168
- to_hash
169
- end
170
-
171
- # Returns the object in the form of hash
172
- # @return [Hash] Returns the object in the form of hash
173
- def to_hash
174
- hash = {}
175
- self.class.attribute_map.each_pair do |attr, param|
176
- value = self.send(attr)
177
- if value.nil?
178
- is_nullable = self.class.openapi_nullable.include?(attr)
179
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
180
- end
181
-
182
- hash[param] = _to_hash(value)
183
- end
184
- hash
185
- end
186
-
187
- # Outputs non-array value in the form of hash
188
- # For object, use to_hash. Otherwise, just return the value
189
- # @param [Object] value Any valid value
190
- # @return [Hash] Returns the value in the form of hash
191
- def _to_hash(value)
192
- if value.is_a?(Array)
193
- value.compact.map { |v| _to_hash(v) }
194
- elsif value.is_a?(Hash)
195
- {}.tap do |hash|
196
- value.each { |k, v| hash[k] = _to_hash(v) }
197
- end
198
- elsif value.respond_to? :to_hash
199
- value.to_hash
200
- else
201
- value
202
- end
203
- end
204
- end
205
- end
@@ -1,197 +0,0 @@
1
- require 'date'
2
-
3
- module Phrase
4
- class GitlabSyncImportParameters
5
- # Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts.
6
- attr_accessor :account_id
7
-
8
- # Attribute mapping from ruby-style variable name to JSON key.
9
- def self.attribute_map
10
- {
11
- :'account_id' => :'account_id'
12
- }
13
- end
14
-
15
- # Attribute type mapping.
16
- def self.openapi_types
17
- {
18
- :'account_id' => :'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::GitlabSyncImportParameters` 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::GitlabSyncImportParameters`. 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?(:'account_id')
44
- self.account_id = attributes[:'account_id']
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
- account_id == o.account_id
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
- [account_id].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 :Time
119
- Time.parse(value)
120
- when :String
121
- value.to_s
122
- when :Integer
123
- value.to_i
124
- when :Float
125
- value.to_f
126
- when :Boolean
127
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
- true
129
- else
130
- false
131
- end
132
- when :Object
133
- # generic object (usually a Hash), return directly
134
- value
135
- when /\AArray<(?<inner_type>.+)>\z/
136
- inner_type = Regexp.last_match[:inner_type]
137
- value.map { |v| _deserialize(inner_type, v) }
138
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
- k_type = Regexp.last_match[:k_type]
140
- v_type = Regexp.last_match[:v_type]
141
- {}.tap do |hash|
142
- value.each do |k, v|
143
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
- end
145
- end
146
- else # model
147
- Phrase.const_get(type).build_from_hash(value)
148
- end
149
- end
150
-
151
- # Returns the string representation of the object
152
- # @return [String] String presentation of the object
153
- def to_s
154
- to_hash.to_s
155
- end
156
-
157
- # to_body is an alias to to_hash (backward compatibility)
158
- # @return [Hash] Returns the object in the form of hash
159
- def to_body
160
- to_hash
161
- end
162
-
163
- # Returns the object in the form of hash
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_hash
166
- hash = {}
167
- self.class.attribute_map.each_pair do |attr, param|
168
- value = self.send(attr)
169
- if value.nil?
170
- is_nullable = self.class.openapi_nullable.include?(attr)
171
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
172
- end
173
-
174
- hash[param] = _to_hash(value)
175
- end
176
- hash
177
- end
178
-
179
- # Outputs non-array value in the form of hash
180
- # For object, use to_hash. Otherwise, just return the value
181
- # @param [Object] value Any valid value
182
- # @return [Hash] Returns the value in the form of hash
183
- def _to_hash(value)
184
- if value.is_a?(Array)
185
- value.compact.map { |v| _to_hash(v) }
186
- elsif value.is_a?(Hash)
187
- {}.tap do |hash|
188
- value.each { |k, v| hash[k] = _to_hash(v) }
189
- end
190
- elsif value.respond_to? :to_hash
191
- value.to_hash
192
- else
193
- value
194
- end
195
- end
196
- end
197
- end