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,213 @@
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
+ # Response from text-to-image generation.
18
+ class GenerateResponse < ApiModelBase
19
+ attr_accessor :success
20
+
21
+ attr_accessor :prompt_id
22
+
23
+ attr_accessor :images
24
+
25
+ attr_accessor :errors
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'success' => :'success',
31
+ :'prompt_id' => :'prompt_id',
32
+ :'images' => :'images',
33
+ :'errors' => :'errors'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'success' => :'Boolean',
51
+ :'prompt_id' => :'String',
52
+ :'images' => :'Array<String>',
53
+ :'errors' => :'Hash<String, Object>'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TensorsApi::GenerateResponse` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ acceptable_attribute_map = self.class.acceptable_attribute_map
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!acceptable_attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TensorsApi::GenerateResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'success')
80
+ self.success = attributes[:'success']
81
+ else
82
+ self.success = nil
83
+ end
84
+
85
+ if attributes.key?(:'prompt_id')
86
+ self.prompt_id = attributes[:'prompt_id']
87
+ else
88
+ self.prompt_id = nil
89
+ end
90
+
91
+ if attributes.key?(:'images')
92
+ if (value = attributes[:'images']).is_a?(Array)
93
+ self.images = value
94
+ end
95
+ end
96
+
97
+ if attributes.key?(:'errors')
98
+ if (value = attributes[:'errors']).is_a?(Hash)
99
+ self.errors = value
100
+ end
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
+ invalid_properties = Array.new
109
+ if @success.nil?
110
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
111
+ end
112
+
113
+ if @prompt_id.nil?
114
+ invalid_properties.push('invalid value for "prompt_id", prompt_id cannot be nil.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
+ return false if @success.nil?
125
+ return false if @prompt_id.nil?
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] success Value to be assigned
131
+ def success=(success)
132
+ if success.nil?
133
+ fail ArgumentError, 'success cannot be nil'
134
+ end
135
+
136
+ @success = success
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] prompt_id Value to be assigned
141
+ def prompt_id=(prompt_id)
142
+ if prompt_id.nil?
143
+ fail ArgumentError, 'prompt_id cannot be nil'
144
+ end
145
+
146
+ @prompt_id = prompt_id
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ success == o.success &&
155
+ prompt_id == o.prompt_id &&
156
+ images == o.images &&
157
+ errors == o.errors
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [success, prompt_id, images, errors].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ attributes = attributes.transform_keys(&:to_sym)
178
+ transformed_hash = {}
179
+ openapi_types.each_pair do |key, type|
180
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = nil
182
+ elsif type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[attribute_map[key]].is_a?(Array)
186
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
187
+ end
188
+ elsif !attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
190
+ end
191
+ end
192
+ new(transformed_hash)
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ end
212
+
213
+ end
@@ -0,0 +1,149 @@
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 HTTPValidationError < ApiModelBase
18
+ attr_accessor :detail
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'detail' => :'detail'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'detail' => :'Array<ValidationError>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TensorsApi::HTTPValidationError` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TensorsApi::HTTPValidationError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'detail')
67
+ if (value = attributes[:'detail']).is_a?(Array)
68
+ self.detail = value
69
+ end
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ detail == o.detail
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [detail].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ attributes = attributes.transform_keys(&:to_sym)
114
+ transformed_hash = {}
115
+ openapi_types.each_pair do |key, type|
116
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = nil
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[attribute_map[key]].is_a?(Array)
122
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+ new(transformed_hash)
129
+ end
130
+
131
+ # Returns the object in the form of hash
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = self.send(attr)
137
+ if value.nil?
138
+ is_nullable = self.class.openapi_nullable.include?(attr)
139
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
140
+ end
141
+
142
+ hash[param] = _to_hash(value)
143
+ end
144
+ hash
145
+ end
146
+
147
+ end
148
+
149
+ end
@@ -0,0 +1,103 @@
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
+ module LocationInner
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'Integer',
23
+ :'String'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = TensorsApi.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,181 @@
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 updating image metadata.
18
+ class MetadataUpdate < ApiModelBase
19
+ attr_accessor :tags
20
+
21
+ attr_accessor :notes
22
+
23
+ attr_accessor :rating
24
+
25
+ attr_accessor :favorite
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'tags' => :'tags',
31
+ :'notes' => :'notes',
32
+ :'rating' => :'rating',
33
+ :'favorite' => :'favorite'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'tags' => :'Array<String>',
51
+ :'notes' => :'String',
52
+ :'rating' => :'Integer',
53
+ :'favorite' => :'Boolean'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ :'tags',
61
+ :'notes',
62
+ :'rating',
63
+ :'favorite'
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TensorsApi::MetadataUpdate` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ acceptable_attribute_map = self.class.acceptable_attribute_map
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!acceptable_attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TensorsApi::MetadataUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'tags')
84
+ if (value = attributes[:'tags']).is_a?(Array)
85
+ self.tags = value
86
+ end
87
+ end
88
+
89
+ if attributes.key?(:'notes')
90
+ self.notes = attributes[:'notes']
91
+ end
92
+
93
+ if attributes.key?(:'rating')
94
+ self.rating = attributes[:'rating']
95
+ end
96
+
97
+ if attributes.key?(:'favorite')
98
+ self.favorite = attributes[:'favorite']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ warn '[DEPRECATED] the `valid?` method is obsolete'
114
+ true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ tags == o.tags &&
123
+ notes == o.notes &&
124
+ rating == o.rating &&
125
+ favorite == o.favorite
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [tags, notes, rating, favorite].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ attributes = attributes.transform_keys(&:to_sym)
146
+ transformed_hash = {}
147
+ openapi_types.each_pair do |key, type|
148
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = nil
150
+ elsif type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[attribute_map[key]].is_a?(Array)
154
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
155
+ end
156
+ elsif !attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
158
+ end
159
+ end
160
+ new(transformed_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
+ end
180
+
181
+ end