tensors-ruby 0.1.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 (60) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +154 -0
  4. data/lib/tensors-ruby/api/auth_api.rb +387 -0
  5. data/lib/tensors-ruby/api/civit_ai_api.rb +85 -0
  6. data/lib/tensors-ruby/api/comfy_uiapi_api.rb +582 -0
  7. data/lib/tensors-ruby/api/database_api.rb +655 -0
  8. data/lib/tensors-ruby/api/default_api.rb +77 -0
  9. data/lib/tensors-ruby/api/download_api.rb +210 -0
  10. data/lib/tensors-ruby/api/gallery_api.rb +416 -0
  11. data/lib/tensors-ruby/api/search_api.rb +129 -0
  12. data/lib/tensors-ruby/api_client.rb +441 -0
  13. data/lib/tensors-ruby/api_error.rb +58 -0
  14. data/lib/tensors-ruby/api_model_base.rb +88 -0
  15. data/lib/tensors-ruby/configuration.rb +399 -0
  16. data/lib/tensors-ruby/models/cache_request.rb +165 -0
  17. data/lib/tensors-ruby/models/download_request.rb +179 -0
  18. data/lib/tensors-ruby/models/generate_request.rb +444 -0
  19. data/lib/tensors-ruby/models/generate_response.rb +213 -0
  20. data/lib/tensors-ruby/models/http_validation_error.rb +149 -0
  21. data/lib/tensors-ruby/models/location_inner.rb +103 -0
  22. data/lib/tensors-ruby/models/metadata_update.rb +181 -0
  23. data/lib/tensors-ruby/models/models_response.rb +205 -0
  24. data/lib/tensors-ruby/models/provider.rb +41 -0
  25. data/lib/tensors-ruby/models/queue_status_response.rb +161 -0
  26. data/lib/tensors-ruby/models/scan_request.rb +165 -0
  27. data/lib/tensors-ruby/models/sort_order.rb +41 -0
  28. data/lib/tensors-ruby/models/system_stats_response.rb +161 -0
  29. data/lib/tensors-ruby/models/validation_error.rb +237 -0
  30. data/lib/tensors-ruby/models/workflow_request.rb +168 -0
  31. data/lib/tensors-ruby/models/workflow_response.rb +222 -0
  32. data/lib/tensors-ruby/version.rb +15 -0
  33. data/lib/tensors-ruby.rb +64 -0
  34. data/spec/api/auth_api_spec.rb +109 -0
  35. data/spec/api/civit_ai_api_spec.rb +47 -0
  36. data/spec/api/comfy_uiapi_api_spec.rb +141 -0
  37. data/spec/api/database_api_spec.rb +155 -0
  38. data/spec/api/default_api_spec.rb +45 -0
  39. data/spec/api/download_api_spec.rb +70 -0
  40. data/spec/api/gallery_api_spec.rb +109 -0
  41. data/spec/api/search_api_spec.rb +60 -0
  42. data/spec/models/cache_request_spec.rb +36 -0
  43. data/spec/models/download_request_spec.rb +54 -0
  44. data/spec/models/generate_request_spec.rb +108 -0
  45. data/spec/models/generate_response_spec.rb +54 -0
  46. data/spec/models/http_validation_error_spec.rb +36 -0
  47. data/spec/models/location_inner_spec.rb +21 -0
  48. data/spec/models/metadata_update_spec.rb +54 -0
  49. data/spec/models/models_response_spec.rb +66 -0
  50. data/spec/models/provider_spec.rb +30 -0
  51. data/spec/models/queue_status_response_spec.rb +42 -0
  52. data/spec/models/scan_request_spec.rb +36 -0
  53. data/spec/models/sort_order_spec.rb +30 -0
  54. data/spec/models/system_stats_response_spec.rb +42 -0
  55. data/spec/models/validation_error_spec.rb +60 -0
  56. data/spec/models/workflow_request_spec.rb +36 -0
  57. data/spec/models/workflow_response_spec.rb +60 -0
  58. data/spec/spec_helper.rb +111 -0
  59. data/tensors-ruby.gemspec +41 -0
  60. metadata +194 -0
@@ -0,0 +1,205 @@
1
+ =begin
2
+ #tensors
3
+
4
+ #API for CivitAI model management and image gallery
5
+
6
+ The version of the OpenAPI document: 0.1.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TensorsApi
17
+ # Available models response.
18
+ class ModelsResponse < ApiModelBase
19
+ attr_accessor :checkpoints
20
+
21
+ attr_accessor :loras
22
+
23
+ attr_accessor :vae
24
+
25
+ attr_accessor :clip
26
+
27
+ attr_accessor :controlnet
28
+
29
+ attr_accessor :upscale_models
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'checkpoints' => :'checkpoints',
35
+ :'loras' => :'loras',
36
+ :'vae' => :'vae',
37
+ :'clip' => :'clip',
38
+ :'controlnet' => :'controlnet',
39
+ :'upscale_models' => :'upscale_models'
40
+ }
41
+ end
42
+
43
+ # Returns attribute mapping this model knows about
44
+ def self.acceptable_attribute_map
45
+ attribute_map
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ acceptable_attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'checkpoints' => :'Array<String>',
57
+ :'loras' => :'Array<String>',
58
+ :'vae' => :'Array<String>',
59
+ :'clip' => :'Array<String>',
60
+ :'controlnet' => :'Array<String>',
61
+ :'upscale_models' => :'Array<String>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TensorsApi::ModelsResponse` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TensorsApi::ModelsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'checkpoints')
88
+ if (value = attributes[:'checkpoints']).is_a?(Array)
89
+ self.checkpoints = value
90
+ end
91
+ end
92
+
93
+ if attributes.key?(:'loras')
94
+ if (value = attributes[:'loras']).is_a?(Array)
95
+ self.loras = value
96
+ end
97
+ end
98
+
99
+ if attributes.key?(:'vae')
100
+ if (value = attributes[:'vae']).is_a?(Array)
101
+ self.vae = value
102
+ end
103
+ end
104
+
105
+ if attributes.key?(:'clip')
106
+ if (value = attributes[:'clip']).is_a?(Array)
107
+ self.clip = value
108
+ end
109
+ end
110
+
111
+ if attributes.key?(:'controlnet')
112
+ if (value = attributes[:'controlnet']).is_a?(Array)
113
+ self.controlnet = value
114
+ end
115
+ end
116
+
117
+ if attributes.key?(:'upscale_models')
118
+ if (value = attributes[:'upscale_models']).is_a?(Array)
119
+ self.upscale_models = value
120
+ end
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
128
+ invalid_properties = Array.new
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ true
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ checkpoints == o.checkpoints &&
145
+ loras == o.loras &&
146
+ vae == o.vae &&
147
+ clip == o.clip &&
148
+ controlnet == o.controlnet &&
149
+ upscale_models == o.upscale_models
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Integer] Hash code
160
+ def hash
161
+ [checkpoints, loras, vae, clip, controlnet, upscale_models].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def self.build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ attributes = attributes.transform_keys(&:to_sym)
170
+ transformed_hash = {}
171
+ openapi_types.each_pair do |key, type|
172
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
173
+ transformed_hash["#{key}"] = nil
174
+ elsif type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[attribute_map[key]].is_a?(Array)
178
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
179
+ end
180
+ elsif !attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
182
+ end
183
+ end
184
+ new(transformed_hash)
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ end
204
+
205
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #tensors
3
+
4
+ #API for CivitAI model management and image gallery
5
+
6
+ The version of the OpenAPI document: 0.1.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TensorsApi
17
+ class Provider
18
+ CIVITAI = "civitai".freeze
19
+ HF = "hf".freeze
20
+ ALL = "all".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [CIVITAI, HF, ALL].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if Provider.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #Provider"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,161 @@
1
+ =begin
2
+ #tensors
3
+
4
+ #API for CivitAI model management and image gallery
5
+
6
+ The version of the OpenAPI document: 0.1.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TensorsApi
17
+ # Queue status response.
18
+ class QueueStatusResponse < ApiModelBase
19
+ attr_accessor :queue_running
20
+
21
+ attr_accessor :queue_pending
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'queue_running' => :'queue_running',
27
+ :'queue_pending' => :'queue_pending'
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'queue_running' => :'Array<Object>',
45
+ :'queue_pending' => :'Array<Object>'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TensorsApi::QueueStatusResponse` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TensorsApi::QueueStatusResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'queue_running')
72
+ if (value = attributes[:'queue_running']).is_a?(Array)
73
+ self.queue_running = value
74
+ end
75
+ end
76
+
77
+ if attributes.key?(:'queue_pending')
78
+ if (value = attributes[:'queue_pending']).is_a?(Array)
79
+ self.queue_pending = value
80
+ end
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ warn '[DEPRECATED] the `valid?` method is obsolete'
96
+ true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ queue_running == o.queue_running &&
105
+ queue_pending == o.queue_pending
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [queue_running, queue_pending].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ transformed_hash = {}
127
+ openapi_types.each_pair do |key, type|
128
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
129
+ transformed_hash["#{key}"] = nil
130
+ elsif type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[attribute_map[key]].is_a?(Array)
134
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
135
+ end
136
+ elsif !attributes[attribute_map[key]].nil?
137
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
138
+ end
139
+ end
140
+ new(transformed_hash)
141
+ end
142
+
143
+ # Returns the object in the form of hash
144
+ # @return [Hash] Returns the object in the form of hash
145
+ def to_hash
146
+ hash = {}
147
+ self.class.attribute_map.each_pair do |attr, param|
148
+ value = self.send(attr)
149
+ if value.nil?
150
+ is_nullable = self.class.openapi_nullable.include?(attr)
151
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
152
+ end
153
+
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ end
160
+
161
+ end
@@ -0,0 +1,165 @@
1
+ =begin
2
+ #tensors
3
+
4
+ #API for CivitAI model management and image gallery
5
+
6
+ The version of the OpenAPI document: 0.1.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TensorsApi
17
+ # Request body for directory scan.
18
+ class ScanRequest < ApiModelBase
19
+ attr_accessor :directory
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'directory' => :'directory'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'directory' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TensorsApi::ScanRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TensorsApi::ScanRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'directory')
68
+ self.directory = attributes[:'directory']
69
+ else
70
+ self.directory = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @directory.nil?
80
+ invalid_properties.push('invalid value for "directory", directory cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @directory.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] directory Value to be assigned
96
+ def directory=(directory)
97
+ if directory.nil?
98
+ fail ArgumentError, 'directory cannot be nil'
99
+ end
100
+
101
+ @directory = directory
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ directory == o.directory
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [directory].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ if value.nil?
154
+ is_nullable = self.class.openapi_nullable.include?(attr)
155
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
156
+ end
157
+
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ end
164
+
165
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #tensors
3
+
4
+ #API for CivitAI model management and image gallery
5
+
6
+ The version of the OpenAPI document: 0.1.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TensorsApi
17
+ class SortOrder
18
+ DOWNLOADS = "downloads".freeze
19
+ RATING = "rating".freeze
20
+ NEWEST = "newest".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [DOWNLOADS, RATING, NEWEST].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if SortOrder.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #SortOrder"
39
+ end
40
+ end
41
+ end