rankvectors 1.0.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.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +191 -0
- data/Rakefile +10 -0
- data/docs/AddCredits200Response.md +22 -0
- data/docs/AddCreditsRequest.md +20 -0
- data/docs/AutoRechargeSettings.md +22 -0
- data/docs/ChangeResult.md +24 -0
- data/docs/ContentVerification.md +22 -0
- data/docs/ContentVerificationApi.md +81 -0
- data/docs/Crawl.md +30 -0
- data/docs/CrawlingApi.md +155 -0
- data/docs/CreateProjectRequest.md +60 -0
- data/docs/CreditBalance.md +30 -0
- data/docs/CreditBalanceInfo.md +26 -0
- data/docs/CreditsApi.md +161 -0
- data/docs/CustomCredentials.md +20 -0
- data/docs/DeleteProject200Response.md +20 -0
- data/docs/Error.md +24 -0
- data/docs/GenerateSuggestions200Response.md +22 -0
- data/docs/GenerateSuggestionsRequest.md +18 -0
- data/docs/GetImplementation200Response.md +20 -0
- data/docs/Implementation.md +36 -0
- data/docs/ImplementationInstructions.md +28 -0
- data/docs/ImplementationRequest.md +26 -0
- data/docs/ImplementationResponse.md +22 -0
- data/docs/ImplementationResult.md +24 -0
- data/docs/ImplementationSummary.md +24 -0
- data/docs/ImplementationsApi.md +313 -0
- data/docs/LinkOpportunity.md +28 -0
- data/docs/ListImplementations200Response.md +24 -0
- data/docs/PageInfo.md +24 -0
- data/docs/PageLimitStatus.md +22 -0
- data/docs/PeriodCharges.md +22 -0
- data/docs/Project.md +70 -0
- data/docs/ProjectCount.md +20 -0
- data/docs/ProjectsApi.md +292 -0
- data/docs/ReportImplementationStatus200Response.md +20 -0
- data/docs/ReportImplementationStatusRequest.md +22 -0
- data/docs/Rollback.md +24 -0
- data/docs/RollbackImplementation200Response.md +22 -0
- data/docs/RollbackImplementationRequest.md +20 -0
- data/docs/SpendingLimitStatus.md +24 -0
- data/docs/StartCrawlRequest.md +18 -0
- data/docs/StepByStepInstructions.md +20 -0
- data/docs/Suggestion.md +38 -0
- data/docs/SuggestionsApi.md +235 -0
- data/docs/UpdateSuggestionRequest.md +18 -0
- data/docs/UsageHistoryItem.md +26 -0
- data/docs/VerifyContent200Response.md +20 -0
- data/docs/VerifyContentRequest.md +20 -0
- data/docs/WebhooksApi.md +151 -0
- data/git_push.sh +57 -0
- data/lib/openapi_client/api/content_verification_api.rb +96 -0
- data/lib/openapi_client/api/crawling_api.rb +155 -0
- data/lib/openapi_client/api/credits_api.rb +168 -0
- data/lib/openapi_client/api/implementations_api.rb +332 -0
- data/lib/openapi_client/api/projects_api.rb +273 -0
- data/lib/openapi_client/api/suggestions_api.rb +242 -0
- data/lib/openapi_client/api/webhooks_api.rb +154 -0
- data/lib/openapi_client/api_client.rb +393 -0
- data/lib/openapi_client/api_error.rb +58 -0
- data/lib/openapi_client/configuration.rb +316 -0
- data/lib/openapi_client/models/add_credits200_response.rb +238 -0
- data/lib/openapi_client/models/add_credits_request.rb +259 -0
- data/lib/openapi_client/models/auto_recharge_settings.rb +292 -0
- data/lib/openapi_client/models/change_result.rb +328 -0
- data/lib/openapi_client/models/content_verification.rb +274 -0
- data/lib/openapi_client/models/crawl.rb +373 -0
- data/lib/openapi_client/models/create_project_request.rb +541 -0
- data/lib/openapi_client/models/credit_balance.rb +379 -0
- data/lib/openapi_client/models/credit_balance_info.rb +329 -0
- data/lib/openapi_client/models/custom_credentials.rb +265 -0
- data/lib/openapi_client/models/delete_project200_response.rb +229 -0
- data/lib/openapi_client/models/error.rb +268 -0
- data/lib/openapi_client/models/generate_suggestions200_response.rb +261 -0
- data/lib/openapi_client/models/generate_suggestions_request.rb +249 -0
- data/lib/openapi_client/models/get_implementation200_response.rb +229 -0
- data/lib/openapi_client/models/implementation.rb +454 -0
- data/lib/openapi_client/models/implementation_instructions.rb +372 -0
- data/lib/openapi_client/models/implementation_request.rb +362 -0
- data/lib/openapi_client/models/implementation_response.rb +293 -0
- data/lib/openapi_client/models/implementation_result.rb +268 -0
- data/lib/openapi_client/models/implementation_summary.rb +319 -0
- data/lib/openapi_client/models/link_opportunity.rb +355 -0
- data/lib/openapi_client/models/list_implementations200_response.rb +251 -0
- data/lib/openapi_client/models/page_info.rb +285 -0
- data/lib/openapi_client/models/page_limit_status.rb +292 -0
- data/lib/openapi_client/models/period_charges.rb +292 -0
- data/lib/openapi_client/models/project.rb +634 -0
- data/lib/openapi_client/models/project_count.rb +230 -0
- data/lib/openapi_client/models/report_implementation_status200_response.rb +229 -0
- data/lib/openapi_client/models/report_implementation_status_request.rb +316 -0
- data/lib/openapi_client/models/rollback.rb +302 -0
- data/lib/openapi_client/models/rollback_implementation200_response.rb +239 -0
- data/lib/openapi_client/models/rollback_implementation_request.rb +247 -0
- data/lib/openapi_client/models/spending_limit_status.rb +319 -0
- data/lib/openapi_client/models/start_crawl_request.rb +249 -0
- data/lib/openapi_client/models/step_by_step_instructions.rb +267 -0
- data/lib/openapi_client/models/suggestion.rb +497 -0
- data/lib/openapi_client/models/update_suggestion_request.rb +262 -0
- data/lib/openapi_client/models/usage_history_item.rb +331 -0
- data/lib/openapi_client/models/verify_content200_response.rb +229 -0
- data/lib/openapi_client/models/verify_content_request.rb +265 -0
- data/lib/openapi_client/version.rb +15 -0
- data/lib/openapi_client.rb +87 -0
- data/openapi_client.gemspec +39 -0
- data/spec/api/content_verification_api_spec.rb +48 -0
- data/spec/api/crawling_api_spec.rb +60 -0
- data/spec/api/credits_api_spec.rb +63 -0
- data/spec/api/implementations_api_spec.rb +91 -0
- data/spec/api/projects_api_spec.rb +82 -0
- data/spec/api/suggestions_api_spec.rb +75 -0
- data/spec/api/webhooks_api_spec.rb +59 -0
- data/spec/models/add_credits200_response_spec.rb +48 -0
- data/spec/models/add_credits_request_spec.rb +42 -0
- data/spec/models/auto_recharge_settings_spec.rb +48 -0
- data/spec/models/change_result_spec.rb +62 -0
- data/spec/models/content_verification_spec.rb +48 -0
- data/spec/models/crawl_spec.rb +76 -0
- data/spec/models/create_project_request_spec.rb +170 -0
- data/spec/models/credit_balance_info_spec.rb +60 -0
- data/spec/models/credit_balance_spec.rb +72 -0
- data/spec/models/custom_credentials_spec.rb +42 -0
- data/spec/models/delete_project200_response_spec.rb +42 -0
- data/spec/models/error_spec.rb +54 -0
- data/spec/models/generate_suggestions200_response_spec.rb +48 -0
- data/spec/models/generate_suggestions_request_spec.rb +36 -0
- data/spec/models/get_implementation200_response_spec.rb +42 -0
- data/spec/models/implementation_instructions_spec.rb +66 -0
- data/spec/models/implementation_request_spec.rb +68 -0
- data/spec/models/implementation_response_spec.rb +48 -0
- data/spec/models/implementation_result_spec.rb +54 -0
- data/spec/models/implementation_spec.rb +102 -0
- data/spec/models/implementation_summary_spec.rb +54 -0
- data/spec/models/link_opportunity_spec.rb +66 -0
- data/spec/models/list_implementations200_response_spec.rb +54 -0
- data/spec/models/page_info_spec.rb +54 -0
- data/spec/models/page_limit_status_spec.rb +48 -0
- data/spec/models/period_charges_spec.rb +48 -0
- data/spec/models/project_count_spec.rb +42 -0
- data/spec/models/project_spec.rb +200 -0
- data/spec/models/report_implementation_status200_response_spec.rb +42 -0
- data/spec/models/report_implementation_status_request_spec.rb +52 -0
- data/spec/models/rollback_implementation200_response_spec.rb +48 -0
- data/spec/models/rollback_implementation_request_spec.rb +42 -0
- data/spec/models/rollback_spec.rb +54 -0
- data/spec/models/spending_limit_status_spec.rb +54 -0
- data/spec/models/start_crawl_request_spec.rb +36 -0
- data/spec/models/step_by_step_instructions_spec.rb +42 -0
- data/spec/models/suggestion_spec.rb +100 -0
- data/spec/models/update_suggestion_request_spec.rb +40 -0
- data/spec/models/usage_history_item_spec.rb +60 -0
- data/spec/models/verify_content200_response_spec.rb +42 -0
- data/spec/models/verify_content_request_spec.rb +42 -0
- data/spec/spec_helper.rb +111 -0
- metadata +288 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#RankVectors API
|
|
3
|
+
|
|
4
|
+
#Intelligent internal linking optimization API using AI. RankVectors helps you automatically discover and implement optimal internal links across your website to improve SEO performance and user experience. ## Key Features - **AI-Powered Analysis**: Uses OpenAI embeddings to find optimal linking opportunities - **Smart Crawling**: Automatically crawls and analyzes your website content - **Automated Implementation**: Implement links via webhooks or manual instructions - **Credit-Based System**: Pay-per-use model with transparent pricing - **Multi-Platform Support**: Works with any CMS or platform via REST API ## Getting Started 1. Create a project with your website URL 2. Start a crawl to analyze your content 3. Generate AI-powered link suggestions 4. Implement suggestions via API or webhook 5. Track performance and manage credits ## Authentication All API endpoints require authentication using your RankVectors API key. Include your API key in the `Authorization` header: ``` Authorization: Bearer YOUR_API_KEY ``` Get your API key from your RankVectors dashboard: Settings → API Keys
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.2.0
|
|
7
|
+
Contact: support@rankvectors.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.16.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OpenapiClient
|
|
17
|
+
class Implementation
|
|
18
|
+
# Unique implementation identifier
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
# Implementation status
|
|
22
|
+
attr_accessor :status
|
|
23
|
+
|
|
24
|
+
# Platform used
|
|
25
|
+
attr_accessor :platform
|
|
26
|
+
|
|
27
|
+
# Implementation method
|
|
28
|
+
attr_accessor :implementation_method
|
|
29
|
+
|
|
30
|
+
# Credits consumed
|
|
31
|
+
attr_accessor :credits_used
|
|
32
|
+
|
|
33
|
+
# Implementation start timestamp
|
|
34
|
+
attr_accessor :created_at
|
|
35
|
+
|
|
36
|
+
# Implementation completion timestamp
|
|
37
|
+
attr_accessor :completed_at
|
|
38
|
+
|
|
39
|
+
# Platform-specific metadata
|
|
40
|
+
attr_accessor :metadata
|
|
41
|
+
|
|
42
|
+
attr_accessor :suggestion
|
|
43
|
+
|
|
44
|
+
# Rollback history
|
|
45
|
+
attr_accessor :rollbacks
|
|
46
|
+
|
|
47
|
+
class EnumAttributeValidator
|
|
48
|
+
attr_reader :datatype
|
|
49
|
+
attr_reader :allowable_values
|
|
50
|
+
|
|
51
|
+
def initialize(datatype, allowable_values)
|
|
52
|
+
@allowable_values = allowable_values.map do |value|
|
|
53
|
+
case datatype.to_s
|
|
54
|
+
when /Integer/i
|
|
55
|
+
value.to_i
|
|
56
|
+
when /Float/i
|
|
57
|
+
value.to_f
|
|
58
|
+
else
|
|
59
|
+
value
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def valid?(value)
|
|
65
|
+
!value || allowable_values.include?(value)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
70
|
+
def self.attribute_map
|
|
71
|
+
{
|
|
72
|
+
:'id' => :'id',
|
|
73
|
+
:'status' => :'status',
|
|
74
|
+
:'platform' => :'platform',
|
|
75
|
+
:'implementation_method' => :'implementationMethod',
|
|
76
|
+
:'credits_used' => :'creditsUsed',
|
|
77
|
+
:'created_at' => :'createdAt',
|
|
78
|
+
:'completed_at' => :'completedAt',
|
|
79
|
+
:'metadata' => :'metadata',
|
|
80
|
+
:'suggestion' => :'suggestion',
|
|
81
|
+
:'rollbacks' => :'rollbacks'
|
|
82
|
+
}
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Returns attribute mapping this model knows about
|
|
86
|
+
def self.acceptable_attribute_map
|
|
87
|
+
attribute_map
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Returns all the JSON keys this model knows about
|
|
91
|
+
def self.acceptable_attributes
|
|
92
|
+
acceptable_attribute_map.values
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Attribute type mapping.
|
|
96
|
+
def self.openapi_types
|
|
97
|
+
{
|
|
98
|
+
:'id' => :'String',
|
|
99
|
+
:'status' => :'String',
|
|
100
|
+
:'platform' => :'String',
|
|
101
|
+
:'implementation_method' => :'String',
|
|
102
|
+
:'credits_used' => :'Float',
|
|
103
|
+
:'created_at' => :'Time',
|
|
104
|
+
:'completed_at' => :'Time',
|
|
105
|
+
:'metadata' => :'Hash<String, Object>',
|
|
106
|
+
:'suggestion' => :'Suggestion',
|
|
107
|
+
:'rollbacks' => :'Array<Rollback>'
|
|
108
|
+
}
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# List of attributes with nullable: true
|
|
112
|
+
def self.openapi_nullable
|
|
113
|
+
Set.new([
|
|
114
|
+
])
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Initializes the object
|
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
119
|
+
def initialize(attributes = {})
|
|
120
|
+
if (!attributes.is_a?(Hash))
|
|
121
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Implementation` initialize method"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
125
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
126
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
127
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
128
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Implementation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
129
|
+
end
|
|
130
|
+
h[k.to_sym] = v
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'id')
|
|
134
|
+
self.id = attributes[:'id']
|
|
135
|
+
else
|
|
136
|
+
self.id = nil
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'status')
|
|
140
|
+
self.status = attributes[:'status']
|
|
141
|
+
else
|
|
142
|
+
self.status = nil
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'platform')
|
|
146
|
+
self.platform = attributes[:'platform']
|
|
147
|
+
else
|
|
148
|
+
self.platform = nil
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'implementation_method')
|
|
152
|
+
self.implementation_method = attributes[:'implementation_method']
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if attributes.key?(:'credits_used')
|
|
156
|
+
self.credits_used = attributes[:'credits_used']
|
|
157
|
+
else
|
|
158
|
+
self.credits_used = nil
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'created_at')
|
|
162
|
+
self.created_at = attributes[:'created_at']
|
|
163
|
+
else
|
|
164
|
+
self.created_at = nil
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if attributes.key?(:'completed_at')
|
|
168
|
+
self.completed_at = attributes[:'completed_at']
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if attributes.key?(:'metadata')
|
|
172
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
|
173
|
+
self.metadata = value
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
if attributes.key?(:'suggestion')
|
|
178
|
+
self.suggestion = attributes[:'suggestion']
|
|
179
|
+
else
|
|
180
|
+
self.suggestion = nil
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if attributes.key?(:'rollbacks')
|
|
184
|
+
if (value = attributes[:'rollbacks']).is_a?(Array)
|
|
185
|
+
self.rollbacks = value
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
191
|
+
# @return Array for valid properties with the reasons
|
|
192
|
+
def list_invalid_properties
|
|
193
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
194
|
+
invalid_properties = Array.new
|
|
195
|
+
if @id.nil?
|
|
196
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
if @status.nil?
|
|
200
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
if @platform.nil?
|
|
204
|
+
invalid_properties.push('invalid value for "platform", platform cannot be nil.')
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if @credits_used.nil?
|
|
208
|
+
invalid_properties.push('invalid value for "credits_used", credits_used cannot be nil.')
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
if @created_at.nil?
|
|
212
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
if @suggestion.nil?
|
|
216
|
+
invalid_properties.push('invalid value for "suggestion", suggestion cannot be nil.')
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
invalid_properties
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Check to see if the all the properties in the model are valid
|
|
223
|
+
# @return true if the model is valid
|
|
224
|
+
def valid?
|
|
225
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
226
|
+
return false if @id.nil?
|
|
227
|
+
return false if @status.nil?
|
|
228
|
+
status_validator = EnumAttributeValidator.new('String', ["pending", "in_progress", "success", "failed", "rolled_back"])
|
|
229
|
+
return false unless status_validator.valid?(@status)
|
|
230
|
+
return false if @platform.nil?
|
|
231
|
+
platform_validator = EnumAttributeValidator.new('String', ["custom"])
|
|
232
|
+
return false unless platform_validator.valid?(@platform)
|
|
233
|
+
implementation_method_validator = EnumAttributeValidator.new('String', ["api", "manual"])
|
|
234
|
+
return false unless implementation_method_validator.valid?(@implementation_method)
|
|
235
|
+
return false if @credits_used.nil?
|
|
236
|
+
return false if @created_at.nil?
|
|
237
|
+
return false if @suggestion.nil?
|
|
238
|
+
true
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Custom attribute writer method with validation
|
|
242
|
+
# @param [Object] id Value to be assigned
|
|
243
|
+
def id=(id)
|
|
244
|
+
if id.nil?
|
|
245
|
+
fail ArgumentError, 'id cannot be nil'
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
@id = id
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
252
|
+
# @param [Object] status Object to be assigned
|
|
253
|
+
def status=(status)
|
|
254
|
+
validator = EnumAttributeValidator.new('String', ["pending", "in_progress", "success", "failed", "rolled_back"])
|
|
255
|
+
unless validator.valid?(status)
|
|
256
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
257
|
+
end
|
|
258
|
+
@status = status
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
262
|
+
# @param [Object] platform Object to be assigned
|
|
263
|
+
def platform=(platform)
|
|
264
|
+
validator = EnumAttributeValidator.new('String', ["custom"])
|
|
265
|
+
unless validator.valid?(platform)
|
|
266
|
+
fail ArgumentError, "invalid value for \"platform\", must be one of #{validator.allowable_values}."
|
|
267
|
+
end
|
|
268
|
+
@platform = platform
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
272
|
+
# @param [Object] implementation_method Object to be assigned
|
|
273
|
+
def implementation_method=(implementation_method)
|
|
274
|
+
validator = EnumAttributeValidator.new('String', ["api", "manual"])
|
|
275
|
+
unless validator.valid?(implementation_method)
|
|
276
|
+
fail ArgumentError, "invalid value for \"implementation_method\", must be one of #{validator.allowable_values}."
|
|
277
|
+
end
|
|
278
|
+
@implementation_method = implementation_method
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Custom attribute writer method with validation
|
|
282
|
+
# @param [Object] credits_used Value to be assigned
|
|
283
|
+
def credits_used=(credits_used)
|
|
284
|
+
if credits_used.nil?
|
|
285
|
+
fail ArgumentError, 'credits_used cannot be nil'
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
@credits_used = credits_used
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Custom attribute writer method with validation
|
|
292
|
+
# @param [Object] created_at Value to be assigned
|
|
293
|
+
def created_at=(created_at)
|
|
294
|
+
if created_at.nil?
|
|
295
|
+
fail ArgumentError, 'created_at cannot be nil'
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
@created_at = created_at
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# Custom attribute writer method with validation
|
|
302
|
+
# @param [Object] suggestion Value to be assigned
|
|
303
|
+
def suggestion=(suggestion)
|
|
304
|
+
if suggestion.nil?
|
|
305
|
+
fail ArgumentError, 'suggestion cannot be nil'
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
@suggestion = suggestion
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# Checks equality by comparing each attribute.
|
|
312
|
+
# @param [Object] Object to be compared
|
|
313
|
+
def ==(o)
|
|
314
|
+
return true if self.equal?(o)
|
|
315
|
+
self.class == o.class &&
|
|
316
|
+
id == o.id &&
|
|
317
|
+
status == o.status &&
|
|
318
|
+
platform == o.platform &&
|
|
319
|
+
implementation_method == o.implementation_method &&
|
|
320
|
+
credits_used == o.credits_used &&
|
|
321
|
+
created_at == o.created_at &&
|
|
322
|
+
completed_at == o.completed_at &&
|
|
323
|
+
metadata == o.metadata &&
|
|
324
|
+
suggestion == o.suggestion &&
|
|
325
|
+
rollbacks == o.rollbacks
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# @see the `==` method
|
|
329
|
+
# @param [Object] Object to be compared
|
|
330
|
+
def eql?(o)
|
|
331
|
+
self == o
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Calculates hash code according to all attributes.
|
|
335
|
+
# @return [Integer] Hash code
|
|
336
|
+
def hash
|
|
337
|
+
[id, status, platform, implementation_method, credits_used, created_at, completed_at, metadata, suggestion, rollbacks].hash
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Builds the object from hash
|
|
341
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
342
|
+
# @return [Object] Returns the model itself
|
|
343
|
+
def self.build_from_hash(attributes)
|
|
344
|
+
return nil unless attributes.is_a?(Hash)
|
|
345
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
346
|
+
transformed_hash = {}
|
|
347
|
+
openapi_types.each_pair do |key, type|
|
|
348
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
349
|
+
transformed_hash["#{key}"] = nil
|
|
350
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
351
|
+
# check to ensure the input is an array given that the attribute
|
|
352
|
+
# is documented as an array but the input is not
|
|
353
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
354
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
355
|
+
end
|
|
356
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
357
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
new(transformed_hash)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Deserializes the data based on type
|
|
364
|
+
# @param string type Data type
|
|
365
|
+
# @param string value Value to be deserialized
|
|
366
|
+
# @return [Object] Deserialized data
|
|
367
|
+
def self._deserialize(type, value)
|
|
368
|
+
case type.to_sym
|
|
369
|
+
when :Time
|
|
370
|
+
Time.parse(value)
|
|
371
|
+
when :Date
|
|
372
|
+
Date.parse(value)
|
|
373
|
+
when :String
|
|
374
|
+
value.to_s
|
|
375
|
+
when :Integer
|
|
376
|
+
value.to_i
|
|
377
|
+
when :Float
|
|
378
|
+
value.to_f
|
|
379
|
+
when :Boolean
|
|
380
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
381
|
+
true
|
|
382
|
+
else
|
|
383
|
+
false
|
|
384
|
+
end
|
|
385
|
+
when :Object
|
|
386
|
+
# generic object (usually a Hash), return directly
|
|
387
|
+
value
|
|
388
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
389
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
390
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
391
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
392
|
+
k_type = Regexp.last_match[:k_type]
|
|
393
|
+
v_type = Regexp.last_match[:v_type]
|
|
394
|
+
{}.tap do |hash|
|
|
395
|
+
value.each do |k, v|
|
|
396
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
397
|
+
end
|
|
398
|
+
end
|
|
399
|
+
else # model
|
|
400
|
+
# models (e.g. Pet) or oneOf
|
|
401
|
+
klass = OpenapiClient.const_get(type)
|
|
402
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
# Returns the string representation of the object
|
|
407
|
+
# @return [String] String presentation of the object
|
|
408
|
+
def to_s
|
|
409
|
+
to_hash.to_s
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
413
|
+
# @return [Hash] Returns the object in the form of hash
|
|
414
|
+
def to_body
|
|
415
|
+
to_hash
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# Returns the object in the form of hash
|
|
419
|
+
# @return [Hash] Returns the object in the form of hash
|
|
420
|
+
def to_hash
|
|
421
|
+
hash = {}
|
|
422
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
423
|
+
value = self.send(attr)
|
|
424
|
+
if value.nil?
|
|
425
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
426
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
hash[param] = _to_hash(value)
|
|
430
|
+
end
|
|
431
|
+
hash
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
# Outputs non-array value in the form of hash
|
|
435
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
436
|
+
# @param [Object] value Any valid value
|
|
437
|
+
# @return [Hash] Returns the value in the form of hash
|
|
438
|
+
def _to_hash(value)
|
|
439
|
+
if value.is_a?(Array)
|
|
440
|
+
value.compact.map { |v| _to_hash(v) }
|
|
441
|
+
elsif value.is_a?(Hash)
|
|
442
|
+
{}.tap do |hash|
|
|
443
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
444
|
+
end
|
|
445
|
+
elsif value.respond_to? :to_hash
|
|
446
|
+
value.to_hash
|
|
447
|
+
else
|
|
448
|
+
value
|
|
449
|
+
end
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
end
|