abliteration 0.1.8 → 0.1.10

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.
@@ -139,6 +139,80 @@ module Abliteration
139
139
  return data, status_code, headers
140
140
  end
141
141
 
142
+ # Per-model download timeline
143
+ # Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
144
+ # @param id [String]
145
+ # @param [Hash] opts the optional parameters
146
+ # @option opts [Integer] :days Window in days (max 365). Pass 0 for full history. (default to 90)
147
+ # @return [GetModelDownloadHistory200Response]
148
+ def get_model_download_history(id, opts = {})
149
+ data, _status_code, _headers = get_model_download_history_with_http_info(id, opts)
150
+ data
151
+ end
152
+
153
+ # Per-model download timeline
154
+ # Cost: 5 credits, flat. Raw signal that /market/anomalies scans over. Callers with a chart or their own anomaly detector pull it once per model.
155
+ # @param id [String]
156
+ # @param [Hash] opts the optional parameters
157
+ # @option opts [Integer] :days Window in days (max 365). Pass 0 for full history. (default to 90)
158
+ # @return [Array<(GetModelDownloadHistory200Response, Integer, Hash)>] GetModelDownloadHistory200Response data, response status code and response headers
159
+ def get_model_download_history_with_http_info(id, opts = {})
160
+ if @api_client.config.debugging
161
+ @api_client.config.logger.debug 'Calling API: ModelsApi.get_model_download_history ...'
162
+ end
163
+ # verify the required parameter 'id' is set
164
+ if @api_client.config.client_side_validation && id.nil?
165
+ fail ArgumentError, "Missing the required parameter 'id' when calling ModelsApi.get_model_download_history"
166
+ end
167
+ if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 365
168
+ fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ModelsApi.get_model_download_history, must be smaller than or equal to 365.'
169
+ end
170
+
171
+ if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 0
172
+ fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ModelsApi.get_model_download_history, must be greater than or equal to 0.'
173
+ end
174
+
175
+ # resource path
176
+ local_var_path = '/api/v1/models/{id}/download-history'.sub('{id}', CGI.escape(id.to_s))
177
+
178
+ # query parameters
179
+ query_params = opts[:query_params] || {}
180
+ query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
181
+
182
+ # header parameters
183
+ header_params = opts[:header_params] || {}
184
+ # HTTP header 'Accept' (if needed)
185
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
186
+
187
+ # form parameters
188
+ form_params = opts[:form_params] || {}
189
+
190
+ # http body (model)
191
+ post_body = opts[:debug_body]
192
+
193
+ # return_type
194
+ return_type = opts[:debug_return_type] || 'GetModelDownloadHistory200Response'
195
+
196
+ # auth_names
197
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
198
+
199
+ new_options = opts.merge(
200
+ :operation => :"ModelsApi.get_model_download_history",
201
+ :header_params => header_params,
202
+ :query_params => query_params,
203
+ :form_params => form_params,
204
+ :body => post_body,
205
+ :auth_names => auth_names,
206
+ :return_type => return_type
207
+ )
208
+
209
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
210
+ if @api_client.config.debugging
211
+ @api_client.config.logger.debug "API called: ModelsApi#get_model_download_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
212
+ end
213
+ return data, status_code, headers
214
+ end
215
+
142
216
  # README content at one commit (wayback)
143
217
  # Cost: 10 credits, flat. The wayback-machine leg of the change-stream. Returns the exact README content for one model at one commit sha — used after spotting a suspicious drift on GET /api/v1/models/{id}/drifts.
144
218
  # @param id [String]
@@ -208,6 +282,106 @@ module Abliteration
208
282
  return data, status_code, headers
209
283
  end
210
284
 
285
+ # Anomalies in the download counter (change stream)
286
+ # Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = `spike`, 0.5× fall = `drop`. Sorted by absolute delta so biggest movers surface first. Consumers get \"what is happening in the field right now\" without re-implementing the ETL over `download_history`.
287
+ # @param [Hash] opts the optional parameters
288
+ # @option opts [Integer] :window_days Baseline distance in days. Default 7, min 1, max 365. (default to 7)
289
+ # @option opts [Integer] :min_baseline Only rows where baseline downloads &gt;&#x3D; this. Filters &#x60;0→10&#x60; noise. Default 1000. (default to 1000)
290
+ # @option opts [String] :kind Filter to one class. Omit for both.
291
+ # @option opts [Integer] :limit Rows to return, 1 to 1000. Values outside the range are clamped, not rejected. (default to 50)
292
+ # @option opts [Integer] :offset Rows to skip. Negative and non-numeric values are treated as 0. (default to 0)
293
+ # @return [ListAnomalies200Response]
294
+ def list_anomalies(opts = {})
295
+ data, _status_code, _headers = list_anomalies_with_http_info(opts)
296
+ data
297
+ end
298
+
299
+ # Anomalies in the download counter (change stream)
300
+ # Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump &#x3D; &#x60;spike&#x60;, 0.5× fall &#x3D; &#x60;drop&#x60;. Sorted by absolute delta so biggest movers surface first. Consumers get \&quot;what is happening in the field right now\&quot; without re-implementing the ETL over &#x60;download_history&#x60;.
301
+ # @param [Hash] opts the optional parameters
302
+ # @option opts [Integer] :window_days Baseline distance in days. Default 7, min 1, max 365. (default to 7)
303
+ # @option opts [Integer] :min_baseline Only rows where baseline downloads &gt;&#x3D; this. Filters &#x60;0→10&#x60; noise. Default 1000. (default to 1000)
304
+ # @option opts [String] :kind Filter to one class. Omit for both.
305
+ # @option opts [Integer] :limit Rows to return, 1 to 1000. Values outside the range are clamped, not rejected. (default to 50)
306
+ # @option opts [Integer] :offset Rows to skip. Negative and non-numeric values are treated as 0. (default to 0)
307
+ # @return [Array<(ListAnomalies200Response, Integer, Hash)>] ListAnomalies200Response data, response status code and response headers
308
+ def list_anomalies_with_http_info(opts = {})
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug 'Calling API: ModelsApi.list_anomalies ...'
311
+ end
312
+ if @api_client.config.client_side_validation && !opts[:'window_days'].nil? && opts[:'window_days'] > 365
313
+ fail ArgumentError, 'invalid value for "opts[:"window_days"]" when calling ModelsApi.list_anomalies, must be smaller than or equal to 365.'
314
+ end
315
+
316
+ if @api_client.config.client_side_validation && !opts[:'window_days'].nil? && opts[:'window_days'] < 1
317
+ fail ArgumentError, 'invalid value for "opts[:"window_days"]" when calling ModelsApi.list_anomalies, must be greater than or equal to 1.'
318
+ end
319
+
320
+ if @api_client.config.client_side_validation && !opts[:'min_baseline'].nil? && opts[:'min_baseline'] < 1
321
+ fail ArgumentError, 'invalid value for "opts[:"min_baseline"]" when calling ModelsApi.list_anomalies, must be greater than or equal to 1.'
322
+ end
323
+
324
+ allowable_values = ["spike", "drop"]
325
+ if @api_client.config.client_side_validation && opts[:'kind'] && !allowable_values.include?(opts[:'kind'])
326
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{allowable_values}"
327
+ end
328
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
329
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ModelsApi.list_anomalies, must be smaller than or equal to 1000.'
330
+ end
331
+
332
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
333
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ModelsApi.list_anomalies, must be greater than or equal to 1.'
334
+ end
335
+
336
+ if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
337
+ fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling ModelsApi.list_anomalies, must be greater than or equal to 0.'
338
+ end
339
+
340
+ # resource path
341
+ local_var_path = '/api/v1/market/anomalies'
342
+
343
+ # query parameters
344
+ query_params = opts[:query_params] || {}
345
+ query_params[:'window_days'] = opts[:'window_days'] if !opts[:'window_days'].nil?
346
+ query_params[:'min_baseline'] = opts[:'min_baseline'] if !opts[:'min_baseline'].nil?
347
+ query_params[:'kind'] = opts[:'kind'] if !opts[:'kind'].nil?
348
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
349
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
350
+
351
+ # header parameters
352
+ header_params = opts[:header_params] || {}
353
+ # HTTP header 'Accept' (if needed)
354
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
355
+
356
+ # form parameters
357
+ form_params = opts[:form_params] || {}
358
+
359
+ # http body (model)
360
+ post_body = opts[:debug_body]
361
+
362
+ # return_type
363
+ return_type = opts[:debug_return_type] || 'ListAnomalies200Response'
364
+
365
+ # auth_names
366
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
367
+
368
+ new_options = opts.merge(
369
+ :operation => :"ModelsApi.list_anomalies",
370
+ :header_params => header_params,
371
+ :query_params => query_params,
372
+ :form_params => form_params,
373
+ :body => post_body,
374
+ :auth_names => auth_names,
375
+ :return_type => return_type
376
+ )
377
+
378
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
379
+ if @api_client.config.debugging
380
+ @api_client.config.logger.debug "API called: ModelsApi#list_anomalies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
381
+ end
382
+ return data, status_code, headers
383
+ end
384
+
211
385
  # List delisted models (change stream)
212
386
  # Cost: 5 credits, flat. Change-stream companion to /models: every row is a tombstone — a model that HF no longer serves, preserved here at its final state. Poll with `since=<last_seen_at of your previous run>` to fetch only new casualties; callers building compliance dashboards, safety-research corpora, or \"wayback\" tools live on this endpoint. See /api#change-stream.
213
387
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,250 @@
1
+ =begin
2
+ #abliteration.org Public API
3
+
4
+ #Read access to the abliteration.org catalog: models and their method classification, alignment datasets and their passports, the M-code taxonomy, the four flagship indices and the curated field timeline. Every call is authenticated with a bearer key and metered in credits against the same wallet the Research Agent spends from. There is no free tier for machine traffic and no separate billing. Responses report `cost` and `credits_remaining` on every success. While `metering` reads `preview`, the cost shown is what the call will bill once metering is enabled and nothing is actually deducted; when it reads `billed`, it was.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Abliteration
17
+ # One model whose downloads-per-window crossed a threshold.
18
+ class DownloadAnomaly < ApiModelBase
19
+ attr_accessor :model_id
20
+
21
+ # ISO-8601 timestamp of the current snapshot.
22
+ attr_accessor :current_at
23
+
24
+ attr_accessor :current_downloads
25
+
26
+ # ISO-8601 timestamp of the baseline snapshot the delta is computed against.
27
+ attr_accessor :baseline_at
28
+
29
+ attr_accessor :baseline_downloads
30
+
31
+ # current_downloads / baseline_downloads.
32
+ attr_accessor :ratio
33
+
34
+ # current_downloads - baseline_downloads (signed).
35
+ attr_accessor :delta
36
+
37
+ # `spike` when ratio >= 2, `drop` when ratio <= 0.5.
38
+ attr_accessor :kind
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'model_id' => :'model_id',
66
+ :'current_at' => :'current_at',
67
+ :'current_downloads' => :'current_downloads',
68
+ :'baseline_at' => :'baseline_at',
69
+ :'baseline_downloads' => :'baseline_downloads',
70
+ :'ratio' => :'ratio',
71
+ :'delta' => :'delta',
72
+ :'kind' => :'kind'
73
+ }
74
+ end
75
+
76
+ # Returns attribute mapping this model knows about
77
+ def self.acceptable_attribute_map
78
+ attribute_map
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ acceptable_attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'model_id' => :'String',
90
+ :'current_at' => :'String',
91
+ :'current_downloads' => :'Integer',
92
+ :'baseline_at' => :'String',
93
+ :'baseline_downloads' => :'Integer',
94
+ :'ratio' => :'Float',
95
+ :'delta' => :'Integer',
96
+ :'kind' => :'String'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ ])
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ if (!attributes.is_a?(Hash))
110
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Abliteration::DownloadAnomaly` initialize method"
111
+ end
112
+
113
+ # check to see if the attribute exists and convert string to symbol for hash key
114
+ acceptable_attribute_map = self.class.acceptable_attribute_map
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!acceptable_attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Abliteration::DownloadAnomaly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'model_id')
123
+ self.model_id = attributes[:'model_id']
124
+ end
125
+
126
+ if attributes.key?(:'current_at')
127
+ self.current_at = attributes[:'current_at']
128
+ end
129
+
130
+ if attributes.key?(:'current_downloads')
131
+ self.current_downloads = attributes[:'current_downloads']
132
+ end
133
+
134
+ if attributes.key?(:'baseline_at')
135
+ self.baseline_at = attributes[:'baseline_at']
136
+ end
137
+
138
+ if attributes.key?(:'baseline_downloads')
139
+ self.baseline_downloads = attributes[:'baseline_downloads']
140
+ end
141
+
142
+ if attributes.key?(:'ratio')
143
+ self.ratio = attributes[:'ratio']
144
+ end
145
+
146
+ if attributes.key?(:'delta')
147
+ self.delta = attributes[:'delta']
148
+ end
149
+
150
+ if attributes.key?(:'kind')
151
+ self.kind = attributes[:'kind']
152
+ end
153
+ end
154
+
155
+ # Show invalid properties with the reasons. Usually used together with valid?
156
+ # @return Array for valid properties with the reasons
157
+ def list_invalid_properties
158
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
159
+ invalid_properties = Array.new
160
+ invalid_properties
161
+ end
162
+
163
+ # Check to see if the all the properties in the model are valid
164
+ # @return true if the model is valid
165
+ def valid?
166
+ warn '[DEPRECATED] the `valid?` method is obsolete'
167
+ kind_validator = EnumAttributeValidator.new('String', ["spike", "drop"])
168
+ return false unless kind_validator.valid?(@kind)
169
+ true
170
+ end
171
+
172
+ # Custom attribute writer method checking allowed values (enum).
173
+ # @param [Object] kind Object to be assigned
174
+ def kind=(kind)
175
+ validator = EnumAttributeValidator.new('String', ["spike", "drop"])
176
+ unless validator.valid?(kind)
177
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}."
178
+ end
179
+ @kind = kind
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ model_id == o.model_id &&
188
+ current_at == o.current_at &&
189
+ current_downloads == o.current_downloads &&
190
+ baseline_at == o.baseline_at &&
191
+ baseline_downloads == o.baseline_downloads &&
192
+ ratio == o.ratio &&
193
+ delta == o.delta &&
194
+ kind == o.kind
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [model_id, current_at, current_downloads, baseline_at, baseline_downloads, ratio, delta, kind].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ return nil unless attributes.is_a?(Hash)
214
+ attributes = attributes.transform_keys(&:to_sym)
215
+ transformed_hash = {}
216
+ openapi_types.each_pair do |key, type|
217
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
218
+ transformed_hash["#{key}"] = nil
219
+ elsif type =~ /\AArray<(.*)>/i
220
+ # check to ensure the input is an array given that the attribute
221
+ # is documented as an array but the input is not
222
+ if attributes[attribute_map[key]].is_a?(Array)
223
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
224
+ end
225
+ elsif !attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
227
+ end
228
+ end
229
+ new(transformed_hash)
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -0,0 +1,158 @@
1
+ =begin
2
+ #abliteration.org Public API
3
+
4
+ #Read access to the abliteration.org catalog: models and their method classification, alignment datasets and their passports, the M-code taxonomy, the four flagship indices and the curated field timeline. Every call is authenticated with a bearer key and metered in credits against the same wallet the Research Agent spends from. There is no free tier for machine traffic and no separate billing. Responses report `cost` and `credits_remaining` on every success. While `metering` reads `preview`, the cost shown is what the call will bill once metering is enabled and nothing is actually deducted; when it reads `billed`, it was.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Abliteration
17
+ # One snapshot in a per-model download timeline.
18
+ class DownloadPoint < ApiModelBase
19
+ # ISO-8601 timestamp of the observation.
20
+ attr_accessor :date
21
+
22
+ attr_accessor :downloads
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'date' => :'date',
28
+ :'downloads' => :'downloads'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'date' => :'String',
46
+ :'downloads' => :'Integer'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Abliteration::DownloadPoint` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Abliteration::DownloadPoint`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'date')
73
+ self.date = attributes[:'date']
74
+ end
75
+
76
+ if attributes.key?(:'downloads')
77
+ self.downloads = attributes[:'downloads']
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
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ date == o.date &&
102
+ downloads == o.downloads
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [date, downloads].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ transformed_hash = {}
124
+ openapi_types.each_pair do |key, type|
125
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = nil
127
+ elsif type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[attribute_map[key]].is_a?(Array)
131
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
+ end
133
+ elsif !attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
+ end
136
+ end
137
+ new(transformed_hash)
138
+ end
139
+
140
+ # Returns the object in the form of hash
141
+ # @return [Hash] Returns the object in the form of hash
142
+ def to_hash
143
+ hash = {}
144
+ self.class.attribute_map.each_pair do |attr, param|
145
+ value = self.send(attr)
146
+ if value.nil?
147
+ is_nullable = self.class.openapi_nullable.include?(attr)
148
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
149
+ end
150
+
151
+ hash[param] = _to_hash(value)
152
+ end
153
+ hash
154
+ end
155
+
156
+ end
157
+
158
+ end