abliteration 0.1.8 → 0.1.9
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 +4 -4
- data/README.md +6 -0
- data/docs/DownloadAnomaly.md +32 -0
- data/docs/DownloadPoint.md +20 -0
- data/docs/GetModelDownloadHistory200Response.md +32 -0
- data/docs/ListAnomalies200Response.md +32 -0
- data/docs/ModelsApi.md +154 -0
- data/lib/abliteration/api/models_api.rb +174 -0
- data/lib/abliteration/models/download_anomaly.rb +250 -0
- data/lib/abliteration/models/download_point.rb +158 -0
- data/lib/abliteration/models/get_model_download_history200_response.rb +386 -0
- data/lib/abliteration/models/list_anomalies200_response.rb +386 -0
- data/lib/abliteration/version.rb +1 -1
- data/lib/abliteration.rb +4 -0
- data/spec/models/download_anomaly_spec.rb +82 -0
- data/spec/models/download_point_spec.rb +42 -0
- data/spec/models/get_model_download_history200_response_spec.rb +82 -0
- data/spec/models/list_anomalies200_response_spec.rb +82 -0
- metadata +17 -1
|
@@ -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
|