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,197 +0,0 @@
1
- require 'date'
2
-
3
- module Phrase
4
- class BitbucketSyncImportParameters
5
- # Account ID to specify the actual account the project 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::BitbucketSyncImportParameters` 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::BitbucketSyncImportParameters`. 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
@@ -1,197 +0,0 @@
1
- require 'date'
2
-
3
- module Phrase
4
- class GithubSyncExportParameters
5
- # Project ID to specify the actual project the GitHub export should be triggered in.
6
- attr_accessor :project_id
7
-
8
- # Attribute mapping from ruby-style variable name to JSON key.
9
- def self.attribute_map
10
- {
11
- :'project_id' => :'project_id'
12
- }
13
- end
14
-
15
- # Attribute type mapping.
16
- def self.openapi_types
17
- {
18
- :'project_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::GithubSyncExportParameters` 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::GithubSyncExportParameters`. 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?(:'project_id')
44
- self.project_id = attributes[:'project_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
- project_id == o.project_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
- [project_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
@@ -1,197 +0,0 @@
1
- require 'date'
2
-
3
- module Phrase
4
- class GithubSyncImportParameters
5
- # Project ID to specify the actual project the GitHub import should be triggered in.
6
- attr_accessor :project_id
7
-
8
- # Attribute mapping from ruby-style variable name to JSON key.
9
- def self.attribute_map
10
- {
11
- :'project_id' => :'project_id'
12
- }
13
- end
14
-
15
- # Attribute type mapping.
16
- def self.openapi_types
17
- {
18
- :'project_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::GithubSyncImportParameters` 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::GithubSyncImportParameters`. 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?(:'project_id')
44
- self.project_id = attributes[:'project_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
- project_id == o.project_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
- [project_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