nft_storage 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +68 -0
  4. data/README.md +118 -0
  5. data/Rakefile +10 -0
  6. data/docs/Deal.md +36 -0
  7. data/docs/DeleteResponse.md +18 -0
  8. data/docs/ErrorResponse.md +20 -0
  9. data/docs/ErrorResponseError.md +20 -0
  10. data/docs/ForbiddenErrorResponse.md +20 -0
  11. data/docs/ForbiddenErrorResponseError.md +20 -0
  12. data/docs/GetResponse.md +20 -0
  13. data/docs/Links.md +22 -0
  14. data/docs/LinksFile.md +20 -0
  15. data/docs/ListResponse.md +20 -0
  16. data/docs/NFT.md +32 -0
  17. data/docs/NFTStorageAPI.md +289 -0
  18. data/docs/Pin.md +26 -0
  19. data/docs/PinStatus.md +15 -0
  20. data/docs/UnauthorizedErrorResponse.md +20 -0
  21. data/docs/UnauthorizedErrorResponseError.md +20 -0
  22. data/docs/UploadResponse.md +20 -0
  23. data/git_push.sh +58 -0
  24. data/lib/nft_storage/api/nft_storage_api.rb +282 -0
  25. data/lib/nft_storage/api_client.rb +390 -0
  26. data/lib/nft_storage/api_error.rb +57 -0
  27. data/lib/nft_storage/configuration.rb +278 -0
  28. data/lib/nft_storage/models/deal.rb +364 -0
  29. data/lib/nft_storage/models/delete_response.rb +218 -0
  30. data/lib/nft_storage/models/error_response.rb +229 -0
  31. data/lib/nft_storage/models/error_response_error.rb +227 -0
  32. data/lib/nft_storage/models/forbidden_error_response.rb +229 -0
  33. data/lib/nft_storage/models/forbidden_error_response_error.rb +263 -0
  34. data/lib/nft_storage/models/get_response.rb +229 -0
  35. data/lib/nft_storage/models/links.rb +238 -0
  36. data/lib/nft_storage/models/links_file.rb +227 -0
  37. data/lib/nft_storage/models/list_response.rb +231 -0
  38. data/lib/nft_storage/models/nft.rb +329 -0
  39. data/lib/nft_storage/models/pin.rb +256 -0
  40. data/lib/nft_storage/models/pin_status.rb +39 -0
  41. data/lib/nft_storage/models/unauthorized_error_response.rb +229 -0
  42. data/lib/nft_storage/models/unauthorized_error_response_error.rb +231 -0
  43. data/lib/nft_storage/models/upload_response.rb +229 -0
  44. data/lib/nft_storage/version.rb +15 -0
  45. data/lib/nft_storage.rb +56 -0
  46. data/nft_storage.gemspec +38 -0
  47. data/spec/api/nft_storage_api_spec.rb +83 -0
  48. data/spec/api_client_spec.rb +226 -0
  49. data/spec/configuration_spec.rb +42 -0
  50. data/spec/models/deal_spec.rb +96 -0
  51. data/spec/models/delete_response_spec.rb +34 -0
  52. data/spec/models/error_response_error_spec.rb +40 -0
  53. data/spec/models/error_response_spec.rb +40 -0
  54. data/spec/models/forbidden_error_response_error_spec.rb +44 -0
  55. data/spec/models/forbidden_error_response_spec.rb +40 -0
  56. data/spec/models/get_response_spec.rb +40 -0
  57. data/spec/models/links_file_spec.rb +40 -0
  58. data/spec/models/links_spec.rb +46 -0
  59. data/spec/models/list_response_spec.rb +40 -0
  60. data/spec/models/nft_spec.rb +80 -0
  61. data/spec/models/pin_spec.rb +58 -0
  62. data/spec/models/pin_status_spec.rb +28 -0
  63. data/spec/models/unauthorized_error_response_error_spec.rb +40 -0
  64. data/spec/models/unauthorized_error_response_spec.rb +40 -0
  65. data/spec/models/upload_response_spec.rb +40 -0
  66. data/spec/spec_helper.rb +111 -0
  67. metadata +168 -0
@@ -0,0 +1,329 @@
1
+ =begin
2
+ #NFT Storage API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module NFTStorage
17
+ class NFT
18
+ # Self-describing content-addressed identifiers for distributed systems. Check [spec](https://github.com/multiformats/cid) for more info.
19
+ attr_accessor :cid
20
+
21
+ # Size in bytes of the NFT data.
22
+ attr_accessor :size
23
+
24
+ # This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: YYYY-MM-DDTHH:MM:SSZ.
25
+ attr_accessor :created
26
+
27
+ # MIME type of the upload file or 'directory' when uploading multiple files.
28
+ attr_accessor :type
29
+
30
+ # Name of the JWT token used to create this NFT.
31
+ attr_accessor :scope
32
+
33
+ attr_accessor :pin
34
+
35
+ # Files in the directory (only if this NFT is a directory).
36
+ attr_accessor :files
37
+
38
+ attr_accessor :deals
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
+ :'cid' => :'cid',
66
+ :'size' => :'size',
67
+ :'created' => :'created',
68
+ :'type' => :'type',
69
+ :'scope' => :'scope',
70
+ :'pin' => :'pin',
71
+ :'files' => :'files',
72
+ :'deals' => :'deals'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'cid' => :'String',
85
+ :'size' => :'Float',
86
+ :'created' => :'Time',
87
+ :'type' => :'String',
88
+ :'scope' => :'String',
89
+ :'pin' => :'Pin',
90
+ :'files' => :'Array<Object>',
91
+ :'deals' => :'Array<Deal>'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `NFTStorage::NFT` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NFTStorage::NFT`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'cid')
117
+ self.cid = attributes[:'cid']
118
+ end
119
+
120
+ if attributes.key?(:'size')
121
+ self.size = attributes[:'size']
122
+ else
123
+ self.size = 132614
124
+ end
125
+
126
+ if attributes.key?(:'created')
127
+ self.created = attributes[:'created']
128
+ end
129
+
130
+ if attributes.key?(:'type')
131
+ self.type = attributes[:'type']
132
+ end
133
+
134
+ if attributes.key?(:'scope')
135
+ self.scope = attributes[:'scope']
136
+ else
137
+ self.scope = 'default'
138
+ end
139
+
140
+ if attributes.key?(:'pin')
141
+ self.pin = attributes[:'pin']
142
+ end
143
+
144
+ if attributes.key?(:'files')
145
+ if (value = attributes[:'files']).is_a?(Array)
146
+ self.files = value
147
+ end
148
+ end
149
+
150
+ if attributes.key?(:'deals')
151
+ if (value = attributes[:'deals']).is_a?(Array)
152
+ self.deals = value
153
+ end
154
+ end
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ invalid_properties = Array.new
161
+ invalid_properties
162
+ end
163
+
164
+ # Check to see if the all the properties in the model are valid
165
+ # @return true if the model is valid
166
+ def valid?
167
+ type_validator = EnumAttributeValidator.new('String', ["directory", "image/jpeg", "application/json", "other mime types"])
168
+ return false unless type_validator.valid?(@type)
169
+ true
170
+ end
171
+
172
+ # Custom attribute writer method checking allowed values (enum).
173
+ # @param [Object] type Object to be assigned
174
+ def type=(type)
175
+ validator = EnumAttributeValidator.new('String', ["directory", "image/jpeg", "application/json", "other mime types"])
176
+ unless validator.valid?(type)
177
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
178
+ end
179
+ @type = type
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
+ cid == o.cid &&
188
+ size == o.size &&
189
+ created == o.created &&
190
+ type == o.type &&
191
+ scope == o.scope &&
192
+ pin == o.pin &&
193
+ files == o.files &&
194
+ deals == o.deals
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
+ [cid, size, created, type, scope, pin, files, deals].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
+ new.build_from_hash(attributes)
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
223
+ self.send("#{key}=", nil)
224
+ elsif type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
228
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
232
+ end
233
+ end
234
+
235
+ self
236
+ end
237
+
238
+ # Deserializes the data based on type
239
+ # @param string type Data type
240
+ # @param string value Value to be deserialized
241
+ # @return [Object] Deserialized data
242
+ def _deserialize(type, value)
243
+ case type.to_sym
244
+ when :Time
245
+ Time.parse(value)
246
+ when :Date
247
+ Date.parse(value)
248
+ when :String
249
+ value.to_s
250
+ when :Integer
251
+ value.to_i
252
+ when :Float
253
+ value.to_f
254
+ when :Boolean
255
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
256
+ true
257
+ else
258
+ false
259
+ end
260
+ when :Object
261
+ # generic object (usually a Hash), return directly
262
+ value
263
+ when /\AArray<(?<inner_type>.+)>\z/
264
+ inner_type = Regexp.last_match[:inner_type]
265
+ value.map { |v| _deserialize(inner_type, v) }
266
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
267
+ k_type = Regexp.last_match[:k_type]
268
+ v_type = Regexp.last_match[:v_type]
269
+ {}.tap do |hash|
270
+ value.each do |k, v|
271
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
272
+ end
273
+ end
274
+ else # model
275
+ # models (e.g. Pet) or oneOf
276
+ klass = NFTStorage.const_get(type)
277
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
278
+ end
279
+ end
280
+
281
+ # Returns the string representation of the object
282
+ # @return [String] String presentation of the object
283
+ def to_s
284
+ to_hash.to_s
285
+ end
286
+
287
+ # to_body is an alias to to_hash (backward compatibility)
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_body
290
+ to_hash
291
+ end
292
+
293
+ # Returns the object in the form of hash
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_hash
296
+ hash = {}
297
+ self.class.attribute_map.each_pair do |attr, param|
298
+ value = self.send(attr)
299
+ if value.nil?
300
+ is_nullable = self.class.openapi_nullable.include?(attr)
301
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
302
+ end
303
+
304
+ hash[param] = _to_hash(value)
305
+ end
306
+ hash
307
+ end
308
+
309
+ # Outputs non-array value in the form of hash
310
+ # For object, use to_hash. Otherwise, just return the value
311
+ # @param [Object] value Any valid value
312
+ # @return [Hash] Returns the value in the form of hash
313
+ def _to_hash(value)
314
+ if value.is_a?(Array)
315
+ value.compact.map { |v| _to_hash(v) }
316
+ elsif value.is_a?(Hash)
317
+ {}.tap do |hash|
318
+ value.each { |k, v| hash[k] = _to_hash(v) }
319
+ end
320
+ elsif value.respond_to? :to_hash
321
+ value.to_hash
322
+ else
323
+ value
324
+ end
325
+ end
326
+
327
+ end
328
+
329
+ end
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #NFT Storage API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module NFTStorage
17
+ class Pin
18
+ # Self-describing content-addressed identifiers for distributed systems. Check [spec](https://github.com/multiformats/cid) for more info.
19
+ attr_accessor :cid
20
+
21
+ attr_accessor :name
22
+
23
+ attr_accessor :status
24
+
25
+ # This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: YYYY-MM-DDTHH:MM:SSZ.
26
+ attr_accessor :created
27
+
28
+ attr_accessor :size
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'cid' => :'cid',
34
+ :'name' => :'name',
35
+ :'status' => :'status',
36
+ :'created' => :'created',
37
+ :'size' => :'size'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'cid' => :'String',
50
+ :'name' => :'String',
51
+ :'status' => :'PinStatus',
52
+ :'created' => :'Time',
53
+ :'size' => :'Float'
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 `NFTStorage::Pin` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `NFTStorage::Pin`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'cid')
79
+ self.cid = attributes[:'cid']
80
+ end
81
+
82
+ if attributes.key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.key?(:'status')
87
+ self.status = attributes[:'status']
88
+ end
89
+
90
+ if attributes.key?(:'created')
91
+ self.created = attributes[:'created']
92
+ end
93
+
94
+ if attributes.key?(:'size')
95
+ self.size = attributes[:'size']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ cid == o.cid &&
118
+ name == o.name &&
119
+ status == o.status &&
120
+ created == o.created &&
121
+ size == o.size
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [cid, name, status, created, size].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ new.build_from_hash(attributes)
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ self.class.openapi_types.each_pair do |key, type|
149
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
+ self.send("#{key}=", nil)
151
+ elsif type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = NFTStorage.const_get(type)
204
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end
@@ -0,0 +1,39 @@
1
+ =begin
2
+ #NFT Storage API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module NFTStorage
17
+ class PinStatus
18
+ QUEUED = "queued".freeze
19
+ PINNING = "pinning".freeze
20
+ PINNED = "pinned".freeze
21
+ FAILED = "failed".freeze
22
+
23
+ # Builds the enum from string
24
+ # @param [String] The enum value in the form of the string
25
+ # @return [String] The enum value
26
+ def self.build_from_hash(value)
27
+ new.build_from_hash(value)
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ constantValues = PinStatus.constants.select { |c| PinStatus::const_get(c) == value }
35
+ raise "Invalid ENUM value #{value} for class #PinStatus" if constantValues.empty?
36
+ value
37
+ end
38
+ end
39
+ end