nft_storage 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +68 -0
- data/README.md +118 -0
- data/Rakefile +10 -0
- data/docs/Deal.md +36 -0
- data/docs/DeleteResponse.md +18 -0
- data/docs/ErrorResponse.md +20 -0
- data/docs/ErrorResponseError.md +20 -0
- data/docs/ForbiddenErrorResponse.md +20 -0
- data/docs/ForbiddenErrorResponseError.md +20 -0
- data/docs/GetResponse.md +20 -0
- data/docs/Links.md +22 -0
- data/docs/LinksFile.md +20 -0
- data/docs/ListResponse.md +20 -0
- data/docs/NFT.md +32 -0
- data/docs/NFTStorageAPI.md +289 -0
- data/docs/Pin.md +26 -0
- data/docs/PinStatus.md +15 -0
- data/docs/UnauthorizedErrorResponse.md +20 -0
- data/docs/UnauthorizedErrorResponseError.md +20 -0
- data/docs/UploadResponse.md +20 -0
- data/git_push.sh +58 -0
- data/lib/nft_storage/api/nft_storage_api.rb +282 -0
- data/lib/nft_storage/api_client.rb +390 -0
- data/lib/nft_storage/api_error.rb +57 -0
- data/lib/nft_storage/configuration.rb +278 -0
- data/lib/nft_storage/models/deal.rb +364 -0
- data/lib/nft_storage/models/delete_response.rb +218 -0
- data/lib/nft_storage/models/error_response.rb +229 -0
- data/lib/nft_storage/models/error_response_error.rb +227 -0
- data/lib/nft_storage/models/forbidden_error_response.rb +229 -0
- data/lib/nft_storage/models/forbidden_error_response_error.rb +263 -0
- data/lib/nft_storage/models/get_response.rb +229 -0
- data/lib/nft_storage/models/links.rb +238 -0
- data/lib/nft_storage/models/links_file.rb +227 -0
- data/lib/nft_storage/models/list_response.rb +231 -0
- data/lib/nft_storage/models/nft.rb +329 -0
- data/lib/nft_storage/models/pin.rb +256 -0
- data/lib/nft_storage/models/pin_status.rb +39 -0
- data/lib/nft_storage/models/unauthorized_error_response.rb +229 -0
- data/lib/nft_storage/models/unauthorized_error_response_error.rb +231 -0
- data/lib/nft_storage/models/upload_response.rb +229 -0
- data/lib/nft_storage/version.rb +15 -0
- data/lib/nft_storage.rb +56 -0
- data/nft_storage.gemspec +38 -0
- data/spec/api/nft_storage_api_spec.rb +83 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/deal_spec.rb +96 -0
- data/spec/models/delete_response_spec.rb +34 -0
- data/spec/models/error_response_error_spec.rb +40 -0
- data/spec/models/error_response_spec.rb +40 -0
- data/spec/models/forbidden_error_response_error_spec.rb +44 -0
- data/spec/models/forbidden_error_response_spec.rb +40 -0
- data/spec/models/get_response_spec.rb +40 -0
- data/spec/models/links_file_spec.rb +40 -0
- data/spec/models/links_spec.rb +46 -0
- data/spec/models/list_response_spec.rb +40 -0
- data/spec/models/nft_spec.rb +80 -0
- data/spec/models/pin_spec.rb +58 -0
- data/spec/models/pin_status_spec.rb +28 -0
- data/spec/models/unauthorized_error_response_error_spec.rb +40 -0
- data/spec/models/unauthorized_error_response_spec.rb +40 -0
- data/spec/models/upload_response_spec.rb +40 -0
- data/spec/spec_helper.rb +111 -0
- metadata +168 -0
data/lib/nft_storage.rb
ADDED
@@ -0,0 +1,56 @@
|
|
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
|
+
# Common files
|
14
|
+
require 'nft_storage/api_client'
|
15
|
+
require 'nft_storage/api_error'
|
16
|
+
require 'nft_storage/version'
|
17
|
+
require 'nft_storage/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'nft_storage/models/deal'
|
21
|
+
require 'nft_storage/models/delete_response'
|
22
|
+
require 'nft_storage/models/error_response'
|
23
|
+
require 'nft_storage/models/error_response_error'
|
24
|
+
require 'nft_storage/models/forbidden_error_response'
|
25
|
+
require 'nft_storage/models/forbidden_error_response_error'
|
26
|
+
require 'nft_storage/models/get_response'
|
27
|
+
require 'nft_storage/models/links'
|
28
|
+
require 'nft_storage/models/links_file'
|
29
|
+
require 'nft_storage/models/list_response'
|
30
|
+
require 'nft_storage/models/nft'
|
31
|
+
require 'nft_storage/models/pin'
|
32
|
+
require 'nft_storage/models/pin_status'
|
33
|
+
require 'nft_storage/models/unauthorized_error_response'
|
34
|
+
require 'nft_storage/models/unauthorized_error_response_error'
|
35
|
+
require 'nft_storage/models/upload_response'
|
36
|
+
|
37
|
+
# APIs
|
38
|
+
require 'nft_storage/api/nft_storage_api'
|
39
|
+
|
40
|
+
module NFTStorage
|
41
|
+
class << self
|
42
|
+
# Customize default settings for the SDK using block.
|
43
|
+
# NFTStorage.configure do |config|
|
44
|
+
# config.username = "xxx"
|
45
|
+
# config.password = "xxx"
|
46
|
+
# end
|
47
|
+
# If no block given, return the default Configuration object.
|
48
|
+
def configure
|
49
|
+
if block_given?
|
50
|
+
yield(Configuration.default)
|
51
|
+
else
|
52
|
+
Configuration.default
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/nft_storage.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
=begin
|
4
|
+
#NFT Storage API
|
5
|
+
|
6
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
|
10
|
+
Generated by: https://openapi-generator.tech
|
11
|
+
OpenAPI Generator version: 5.1.1-SNAPSHOT
|
12
|
+
|
13
|
+
=end
|
14
|
+
|
15
|
+
$:.push File.expand_path("../lib", __FILE__)
|
16
|
+
require "nft_storage/version"
|
17
|
+
|
18
|
+
Gem::Specification.new do |s|
|
19
|
+
s.name = "nft_storage"
|
20
|
+
s.version = NFTStorage::VERSION
|
21
|
+
s.platform = Gem::Platform::RUBY
|
22
|
+
s.authors = ["OpenAPI-Generator"]
|
23
|
+
s.email = [""]
|
24
|
+
s.homepage = "https://openapi-generator.tech"
|
25
|
+
s.summary = "A client library for the https://nft.storage/ service."
|
26
|
+
s.description = "A client library for the https://nft.storage/ service."
|
27
|
+
s.license = "Unlicense"
|
28
|
+
s.required_ruby_version = ">= 2.4"
|
29
|
+
|
30
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
31
|
+
|
32
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
33
|
+
|
34
|
+
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
|
35
|
+
s.test_files = `find spec/*`.split("\n")
|
36
|
+
s.executables = []
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
end
|
@@ -0,0 +1,83 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for NFTStorage::NFTStorageAPI
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'NFTStorageAPI' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = NFTStorage::NFTStorageAPI.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of NFTStorageAPI' do
|
30
|
+
it 'should create an instance of NFTStorageAPI' do
|
31
|
+
expect(@api_instance).to be_instance_of(NFTStorage::NFTStorageAPI)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for delete
|
36
|
+
# Stop storing the content with the passed CID
|
37
|
+
# Stop storing the content with the passed CID on nft.storage. - Unpin the item from the underlying IPFS pinning service. - Cease renewals for expired Filecoin deals involving the CID. ⚠️ This does not remove the content from the network. - Does not terminate any established Filecoin deal. - Does not remove the content from other IPFS nodes in the network that already cached or pinned the CID. Note: the content will remain available if another user has stored the CID with nft.storage.
|
38
|
+
# @param cid CID for the NFT
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [DeleteResponse]
|
41
|
+
describe 'delete test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for list
|
48
|
+
# List all stored files
|
49
|
+
# @param [Hash] opts the optional parameters
|
50
|
+
# @option opts [Time] :before Return results created before provided timestamp
|
51
|
+
# @option opts [Integer] :limit Max records to return
|
52
|
+
# @return [ListResponse]
|
53
|
+
describe 'list test' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# unit tests for status
|
60
|
+
# Get information for the stored file CID
|
61
|
+
# Includes the IPFS pinning state and the Filecoin deal state.
|
62
|
+
# @param cid CID for the NFT
|
63
|
+
# @param [Hash] opts the optional parameters
|
64
|
+
# @return [GetResponse]
|
65
|
+
describe 'status test' do
|
66
|
+
it 'should work' do
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# unit tests for store
|
72
|
+
# Store a file
|
73
|
+
# Store a file with nft.storage. - Submit a HTTP `POST` request passing the file data in the request body. - To store multiple files in a directory, submit a `multipart/form-data` HTTP `POST` request. Use the `Content-Disposition` header for each part to specify a filename.
|
74
|
+
# @param body
|
75
|
+
# @param [Hash] opts the optional parameters
|
76
|
+
# @return [UploadResponse]
|
77
|
+
describe 'store test' do
|
78
|
+
it 'should work' do
|
79
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
@@ -0,0 +1,226 @@
|
|
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 'spec_helper'
|
14
|
+
|
15
|
+
describe NFTStorage::ApiClient do
|
16
|
+
context 'initialization' do
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
NFTStorage.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(NFTStorage::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
NFTStorage.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(NFTStorage::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
NFTStorage.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(NFTStorage::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
NFTStorage.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(NFTStorage::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
NFTStorage.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(NFTStorage::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
NFTStorage.configure { |c| c.base_path = nil }
|
48
|
+
expect(NFTStorage::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'params_encoding in #build_request' do
|
55
|
+
let(:config) { NFTStorage::Configuration.new }
|
56
|
+
let(:api_client) { NFTStorage::ApiClient.new(config) }
|
57
|
+
|
58
|
+
it 'defaults to nil' do
|
59
|
+
expect(NFTStorage::Configuration.default.params_encoding).to eq(nil)
|
60
|
+
expect(config.params_encoding).to eq(nil)
|
61
|
+
|
62
|
+
request = api_client.build_request(:get, '/test')
|
63
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'can be customized' do
|
67
|
+
config.params_encoding = :multi
|
68
|
+
request = api_client.build_request(:get, '/test')
|
69
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'timeout in #build_request' do
|
74
|
+
let(:config) { NFTStorage::Configuration.new }
|
75
|
+
let(:api_client) { NFTStorage::ApiClient.new(config) }
|
76
|
+
|
77
|
+
it 'defaults to 0' do
|
78
|
+
expect(NFTStorage::Configuration.default.timeout).to eq(0)
|
79
|
+
expect(config.timeout).to eq(0)
|
80
|
+
|
81
|
+
request = api_client.build_request(:get, '/test')
|
82
|
+
expect(request.options[:timeout]).to eq(0)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can be customized' do
|
86
|
+
config.timeout = 100
|
87
|
+
request = api_client.build_request(:get, '/test')
|
88
|
+
expect(request.options[:timeout]).to eq(100)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#deserialize' do
|
93
|
+
it "handles Array<Integer>" do
|
94
|
+
api_client = NFTStorage::ApiClient.new
|
95
|
+
headers = { 'Content-Type' => 'application/json' }
|
96
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
97
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
98
|
+
expect(data).to be_instance_of(Array)
|
99
|
+
expect(data).to eq([12, 34])
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'handles Array<Array<Integer>>' do
|
103
|
+
api_client = NFTStorage::ApiClient.new
|
104
|
+
headers = { 'Content-Type' => 'application/json' }
|
105
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
106
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
107
|
+
expect(data).to be_instance_of(Array)
|
108
|
+
expect(data).to eq([[12, 34], [56]])
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'handles Hash<String, String>' do
|
112
|
+
api_client = NFTStorage::ApiClient.new
|
113
|
+
headers = { 'Content-Type' => 'application/json' }
|
114
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
115
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
116
|
+
expect(data).to be_instance_of(Hash)
|
117
|
+
expect(data).to eq(:message => 'Hello')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "#object_to_hash" do
|
122
|
+
it 'ignores nils and includes empty arrays' do
|
123
|
+
# uncomment below to test object_to_hash for model
|
124
|
+
# api_client = NFTStorage::ApiClient.new
|
125
|
+
# _model = NFTStorage::ModelName.new
|
126
|
+
# update the model attribute below
|
127
|
+
# _model.id = 1
|
128
|
+
# update the expected value (hash) below
|
129
|
+
# expected = {id: 1, name: '', tags: []}
|
130
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe '#build_collection_param' do
|
135
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
136
|
+
let(:api_client) { NFTStorage::ApiClient.new }
|
137
|
+
|
138
|
+
it 'works for csv' do
|
139
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'works for ssv' do
|
143
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'works for tsv' do
|
147
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'works for pipes' do
|
151
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'works for multi' do
|
155
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'fails for invalid collection format' do
|
159
|
+
expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe '#json_mime?' do
|
164
|
+
let(:api_client) { NFTStorage::ApiClient.new }
|
165
|
+
|
166
|
+
it 'works' do
|
167
|
+
expect(api_client.json_mime?(nil)).to eq false
|
168
|
+
expect(api_client.json_mime?('')).to eq false
|
169
|
+
|
170
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
171
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
172
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
173
|
+
|
174
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
175
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
176
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe '#select_header_accept' do
|
181
|
+
let(:api_client) { NFTStorage::ApiClient.new }
|
182
|
+
|
183
|
+
it 'works' do
|
184
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
185
|
+
expect(api_client.select_header_accept([])).to be_nil
|
186
|
+
|
187
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
188
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
189
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
190
|
+
|
191
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
192
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe '#select_header_content_type' do
|
197
|
+
let(:api_client) { NFTStorage::ApiClient.new }
|
198
|
+
|
199
|
+
it 'works' do
|
200
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
201
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
202
|
+
|
203
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
204
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
205
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
206
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
207
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe '#sanitize_filename' do
|
212
|
+
let(:api_client) { NFTStorage::ApiClient.new }
|
213
|
+
|
214
|
+
it 'works' do
|
215
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
216
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
217
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
218
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
219
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
220
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
221
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
222
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
223
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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 'spec_helper'
|
14
|
+
|
15
|
+
describe NFTStorage::Configuration do
|
16
|
+
let(:config) { NFTStorage::Configuration.default }
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
# uncomment below to setup host and base_path
|
20
|
+
# require 'URI'
|
21
|
+
# uri = URI.parse("https://api.nft.storage")
|
22
|
+
# NFTStorage.configure do |c|
|
23
|
+
# c.host = uri.host
|
24
|
+
# c.base_path = uri.path
|
25
|
+
# end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#base_url' do
|
29
|
+
it 'should have the default value' do
|
30
|
+
# uncomment below to test default value of the base path
|
31
|
+
# expect(config.base_url).to eq("https://api.nft.storage")
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should remove trailing slashes' do
|
35
|
+
[nil, '', '/', '//'].each do |base_path|
|
36
|
+
config.base_path = base_path
|
37
|
+
# uncomment below to test trailing slashes
|
38
|
+
# expect(config.base_url).to eq("https://api.nft.storage")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,96 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for NFTStorage::Deal
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe NFTStorage::Deal do
|
21
|
+
let(:instance) { NFTStorage::Deal.new }
|
22
|
+
|
23
|
+
describe 'test an instance of Deal' do
|
24
|
+
it 'should create an instance of Deal' do
|
25
|
+
expect(instance).to be_instance_of(NFTStorage::Deal)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
describe 'test attribute "batch_root_cid"' do
|
29
|
+
it 'should work' do
|
30
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'test attribute "last_change"' do
|
35
|
+
it 'should work' do
|
36
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'test attribute "miner"' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'test attribute "network"' do
|
47
|
+
it 'should work' do
|
48
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
49
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["nerpanet", "mainnet"])
|
50
|
+
# validator.allowable_values.each do |value|
|
51
|
+
# expect { instance.network = value }.not_to raise_error
|
52
|
+
# end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'test attribute "piece_cid"' do
|
57
|
+
it 'should work' do
|
58
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'test attribute "status"' do
|
63
|
+
it 'should work' do
|
64
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
65
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["queued", "proposing", "accepted", "failed", "active", "published", "terminated"])
|
66
|
+
# validator.allowable_values.each do |value|
|
67
|
+
# expect { instance.status = value }.not_to raise_error
|
68
|
+
# end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'test attribute "status_text"' do
|
73
|
+
it 'should work' do
|
74
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe 'test attribute "chain_deal_id"' do
|
79
|
+
it 'should work' do
|
80
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'test attribute "deal_activation"' do
|
85
|
+
it 'should work' do
|
86
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe 'test attribute "deal_expiration"' do
|
91
|
+
it 'should work' do
|
92
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for NFTStorage::DeleteResponse
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe NFTStorage::DeleteResponse do
|
21
|
+
let(:instance) { NFTStorage::DeleteResponse.new }
|
22
|
+
|
23
|
+
describe 'test an instance of DeleteResponse' do
|
24
|
+
it 'should create an instance of DeleteResponse' do
|
25
|
+
expect(instance).to be_instance_of(NFTStorage::DeleteResponse)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
describe 'test attribute "ok"' do
|
29
|
+
it 'should work' do
|
30
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for NFTStorage::ErrorResponseError
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe NFTStorage::ErrorResponseError do
|
21
|
+
let(:instance) { NFTStorage::ErrorResponseError.new }
|
22
|
+
|
23
|
+
describe 'test an instance of ErrorResponseError' do
|
24
|
+
it 'should create an instance of ErrorResponseError' do
|
25
|
+
expect(instance).to be_instance_of(NFTStorage::ErrorResponseError)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
describe 'test attribute "name"' do
|
29
|
+
it 'should work' do
|
30
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'test attribute "message"' do
|
35
|
+
it 'should work' do
|
36
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for NFTStorage::ErrorResponse
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe NFTStorage::ErrorResponse do
|
21
|
+
let(:instance) { NFTStorage::ErrorResponse.new }
|
22
|
+
|
23
|
+
describe 'test an instance of ErrorResponse' do
|
24
|
+
it 'should create an instance of ErrorResponse' do
|
25
|
+
expect(instance).to be_instance_of(NFTStorage::ErrorResponse)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
describe 'test attribute "ok"' do
|
29
|
+
it 'should work' do
|
30
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'test attribute "error"' do
|
35
|
+
it 'should work' do
|
36
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|