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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fa47b6a9a892c8afabb228926d4c802527acbcb1de01e761baf08453ab1491d3
4
+ data.tar.gz: 0e12911ab256ef5b532c21c9ed7fb818e1f7f7de5057c67ae485159b155b25a9
5
+ SHA512:
6
+ metadata.gz: 2b38d7626b3a3e704bc75d5b59a243df40469ae67689515c06bbfa903e619fe8870635786cfd5345a850538f721c45d3539f37771eed65c085c9f6ba71011f12
7
+ data.tar.gz: 24565d5ed9676aab002f2de277344bd06d675aee68fae44a266accee3bb55ec25c48e0e038bb4f9d3d84b317efead126fcfdd643e01610553b603ac4fc678170
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,68 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nft_storage (1.0.0)
5
+ typhoeus (~> 1.0, >= 1.0.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ byebug (11.1.3)
12
+ coderay (1.1.3)
13
+ diff-lcs (1.4.4)
14
+ ethon (0.15.0)
15
+ ffi (>= 1.15.0)
16
+ ffi (1.15.4)
17
+ jaro_winkler (1.5.4)
18
+ method_source (1.0.0)
19
+ parallel (1.21.0)
20
+ parser (3.0.2.0)
21
+ ast (~> 2.4.1)
22
+ pry (0.13.1)
23
+ coderay (~> 1.1)
24
+ method_source (~> 1.0)
25
+ pry-byebug (3.9.0)
26
+ byebug (~> 11.0)
27
+ pry (~> 0.13.0)
28
+ psych (4.0.2)
29
+ rainbow (3.0.0)
30
+ rake (13.0.6)
31
+ rspec (3.10.0)
32
+ rspec-core (~> 3.10.0)
33
+ rspec-expectations (~> 3.10.0)
34
+ rspec-mocks (~> 3.10.0)
35
+ rspec-core (3.10.1)
36
+ rspec-support (~> 3.10.0)
37
+ rspec-expectations (3.10.1)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.10.0)
40
+ rspec-mocks (3.10.2)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.10.0)
43
+ rspec-support (3.10.3)
44
+ rubocop (0.66.0)
45
+ jaro_winkler (~> 1.5.1)
46
+ parallel (~> 1.10)
47
+ parser (>= 2.5, != 2.5.1.1)
48
+ psych (>= 3.1.0)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ ruby-progressbar (~> 1.7)
51
+ unicode-display_width (>= 1.4.0, < 1.6)
52
+ ruby-progressbar (1.11.0)
53
+ typhoeus (1.4.0)
54
+ ethon (>= 0.9.0)
55
+ unicode-display_width (1.5.0)
56
+
57
+ PLATFORMS
58
+ x86_64-linux
59
+
60
+ DEPENDENCIES
61
+ nft_storage!
62
+ pry-byebug
63
+ rake (~> 13.0.1)
64
+ rspec (~> 3.6, >= 3.6.0)
65
+ rubocop (~> 0.66.0)
66
+
67
+ BUNDLED WITH
68
+ 2.2.22
data/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # nft_storage
2
+
3
+ _This client was generated via the OpenAPI schema and is experimental, unsupported, and may not work at all!_
4
+
5
+ NFTStorage - the Ruby gem for the NFT Storage API
6
+
7
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+
9
+ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
10
+
11
+ - API version: 1.0
12
+ - Package version: 1.0.0
13
+ - Build package: org.openapitools.codegen.languages.RubyClientCodegen
14
+
15
+ ## Installation
16
+
17
+ ### Build a gem
18
+
19
+ To build the Ruby code into a gem:
20
+
21
+ ```shell
22
+ gem build nft_storage.gemspec
23
+ ```
24
+
25
+ Then either install the gem locally:
26
+
27
+ ```shell
28
+ gem install ./nft_storage-1.0.0.gem
29
+ ```
30
+
31
+ (for development, run `gem install --dev ./nft_storage-1.0.0.gem` to install the development dependencies)
32
+
33
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
34
+
35
+ Finally add this to the Gemfile:
36
+
37
+ gem 'nft_storage', '~> 1.0.0'
38
+
39
+ ### Install from Git
40
+
41
+ If the Ruby gem is hosted at a git repository: https://github.com/nftstorage/ruby-client, then add the following in the Gemfile:
42
+
43
+ gem 'nft_storage', :git => 'https://github.com/nftstorage/ruby-client.git'
44
+
45
+ ### Include the Ruby code directly
46
+
47
+ Include the Ruby code directly using `-I` as follows:
48
+
49
+ ```shell
50
+ ruby -Ilib script.rb
51
+ ```
52
+
53
+ ## Getting Started
54
+
55
+ Please follow the [installation](#installation) procedure and then run the following code:
56
+
57
+ ```ruby
58
+ # Load the gem
59
+ require 'nft_storage'
60
+
61
+ # Setup authorization
62
+ NFTStorage.configure do |config|
63
+ # Configure Bearer authorization (JWT): bearerAuth
64
+ config.access_token = 'YOUR_BEARER_TOKEN'
65
+ end
66
+
67
+ api_instance = NFTStorage::NFTStorageAPI.new
68
+ cid = 'cid_example' # String | CID for the NFT
69
+
70
+ begin
71
+ #Stop storing the content with the passed CID
72
+ result = api_instance.delete(cid)
73
+ p result
74
+ rescue NFTStorage::ApiError => e
75
+ puts "Exception when calling NFTStorageAPI->delete: #{e}"
76
+ end
77
+
78
+ ```
79
+
80
+ ## Documentation for API Endpoints
81
+
82
+ All URIs are relative to *https://api.nft.storage*
83
+
84
+ Class | Method | HTTP request | Description
85
+ ------------ | ------------- | ------------- | -------------
86
+ *NFTStorage::NFTStorageAPI* | [**delete**](docs/NFTStorageAPI.md#delete) | **DELETE** /{cid} | Stop storing the content with the passed CID
87
+ *NFTStorage::NFTStorageAPI* | [**list**](docs/NFTStorageAPI.md#list) | **GET** / | List all stored files
88
+ *NFTStorage::NFTStorageAPI* | [**status**](docs/NFTStorageAPI.md#status) | **GET** /{cid} | Get information for the stored file CID
89
+ *NFTStorage::NFTStorageAPI* | [**store**](docs/NFTStorageAPI.md#store) | **POST** /upload | Store a file
90
+
91
+
92
+ ## Documentation for Models
93
+
94
+ - [NFTStorage::Deal](docs/Deal.md)
95
+ - [NFTStorage::DeleteResponse](docs/DeleteResponse.md)
96
+ - [NFTStorage::ErrorResponse](docs/ErrorResponse.md)
97
+ - [NFTStorage::ErrorResponseError](docs/ErrorResponseError.md)
98
+ - [NFTStorage::ForbiddenErrorResponse](docs/ForbiddenErrorResponse.md)
99
+ - [NFTStorage::ForbiddenErrorResponseError](docs/ForbiddenErrorResponseError.md)
100
+ - [NFTStorage::GetResponse](docs/GetResponse.md)
101
+ - [NFTStorage::Links](docs/Links.md)
102
+ - [NFTStorage::LinksFile](docs/LinksFile.md)
103
+ - [NFTStorage::ListResponse](docs/ListResponse.md)
104
+ - [NFTStorage::NFT](docs/NFT.md)
105
+ - [NFTStorage::Pin](docs/Pin.md)
106
+ - [NFTStorage::PinStatus](docs/PinStatus.md)
107
+ - [NFTStorage::UnauthorizedErrorResponse](docs/UnauthorizedErrorResponse.md)
108
+ - [NFTStorage::UnauthorizedErrorResponseError](docs/UnauthorizedErrorResponseError.md)
109
+ - [NFTStorage::UploadResponse](docs/UploadResponse.md)
110
+
111
+
112
+ ## Documentation for Authorization
113
+
114
+
115
+ ### bearerAuth
116
+
117
+ - **Type**: Bearer authentication (JWT)
118
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
data/docs/Deal.md ADDED
@@ -0,0 +1,36 @@
1
+ # NFTStorage::Deal
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **batch_root_cid** | **String** | | [optional] |
8
+ | **last_change** | **String** | This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: YYYY-MM-DDTHH:MM:SSZ. | |
9
+ | **miner** | **String** | Miner ID | [optional] |
10
+ | **network** | **String** | Filecoin network for this Deal | [optional] |
11
+ | **piece_cid** | **String** | Piece CID string | [optional] |
12
+ | **status** | **String** | Deal status | |
13
+ | **status_text** | **String** | Deal status description. | [optional] |
14
+ | **chain_deal_id** | **Float** | Identifier for the deal stored on chain. | [optional] |
15
+ | **deal_activation** | **String** | This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: YYYY-MM-DDTHH:MM:SSZ. | [optional] |
16
+ | **deal_expiration** | **String** | This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: YYYY-MM-DDTHH:MM:SSZ. | [optional] |
17
+
18
+ ## Example
19
+
20
+ ```ruby
21
+ require 'nft_storage'
22
+
23
+ instance = NFTStorage::Deal.new(
24
+ batch_root_cid: bafkreidivzimqfqtoqxkrpge6bjyhlvxqs3rhe73owtmdulaxr5do5in7u,
25
+ last_change: 2021-03-18T11:46:50.000Z,
26
+ miner: f05678,
27
+ network: null,
28
+ piece_cid: bafkreidivzimqfqtoqxkrpge6bjyhlvxqs3rhe73owtmdulaxr5do5in7u,
29
+ status: null,
30
+ status_text: miner rejected my data,
31
+ chain_deal_id: 138,
32
+ deal_activation: 2021-03-18T11:46:50.000Z,
33
+ deal_expiration: 2021-03-18T11:46:50.000Z
34
+ )
35
+ ```
36
+
@@ -0,0 +1,18 @@
1
+ # NFTStorage::DeleteResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **ok** | **Boolean** | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'nft_storage'
13
+
14
+ instance = NFTStorage::DeleteResponse.new(
15
+ ok: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # NFTStorage::ErrorResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **ok** | **Boolean** | | [optional][default to false] |
8
+ | **error** | [**ErrorResponseError**](ErrorResponseError.md) | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'nft_storage'
14
+
15
+ instance = NFTStorage::ErrorResponse.new(
16
+ ok: null,
17
+ error: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # NFTStorage::ErrorResponseError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | | [optional] |
8
+ | **message** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'nft_storage'
14
+
15
+ instance = NFTStorage::ErrorResponseError.new(
16
+ name: null,
17
+ message: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # NFTStorage::ForbiddenErrorResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **ok** | **Boolean** | | [optional][default to false] |
8
+ | **error** | [**ForbiddenErrorResponseError**](ForbiddenErrorResponseError.md) | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'nft_storage'
14
+
15
+ instance = NFTStorage::ForbiddenErrorResponse.new(
16
+ ok: null,
17
+ error: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # NFTStorage::ForbiddenErrorResponseError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | | [optional][default to &#39;HTTP Error&#39;] |
8
+ | **message** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'nft_storage'
14
+
15
+ instance = NFTStorage::ForbiddenErrorResponseError.new(
16
+ name: null,
17
+ message: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # NFTStorage::GetResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **ok** | **Boolean** | | [optional][default to true] |
8
+ | **value** | [**NFT**](.md) | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'nft_storage'
14
+
15
+ instance = NFTStorage::GetResponse.new(
16
+ ok: null,
17
+ value: null
18
+ )
19
+ ```
20
+
data/docs/Links.md ADDED
@@ -0,0 +1,22 @@
1
+ # NFTStorage::Links
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **ipfs** | **String** | | [optional] |
8
+ | **http** | **String** | | [optional] |
9
+ | **file** | [**Array&lt;LinksFile&gt;**](LinksFile.md) | | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'nft_storage'
15
+
16
+ instance = NFTStorage::Links.new(
17
+ ipfs: ipfs://bafkreidivzimqfqtoqxkrpge6bjyhlvxqs3rhe73owtmdulaxr5do5in7u,
18
+ http: http://bafkreidivzimqfqtoqxkrpge6bjyhlvxqs3rhe73owtmdulaxr5do5in7u.ipfs.dweb.link,
19
+ file: null
20
+ )
21
+ ```
22
+
data/docs/LinksFile.md ADDED
@@ -0,0 +1,20 @@
1
+ # NFTStorage::LinksFile
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **ipfs** | **String** | | [optional] |
8
+ | **http** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'nft_storage'
14
+
15
+ instance = NFTStorage::LinksFile.new(
16
+ ipfs: ipfs://bafkreidivzimqfqtoqxkrpge6bjyhlvxqs3rhe73owtmdulaxr5do5in7u/image.jpg,
17
+ http: http://bafkreidivzimqfqtoqxkrpge6bjyhlvxqs3rhe73owtmdulaxr5do5in7u.ipfs.dweb.link/image.jpg
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # NFTStorage::ListResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **ok** | **Boolean** | | [optional][default to true] |
8
+ | **value** | [**Array&lt;NFT&gt;**](NFT.md) | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'nft_storage'
14
+
15
+ instance = NFTStorage::ListResponse.new(
16
+ ok: null,
17
+ value: null
18
+ )
19
+ ```
20
+
data/docs/NFT.md ADDED
@@ -0,0 +1,32 @@
1
+ # NFTStorage::NFT
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **cid** | **String** | Self-describing content-addressed identifiers for distributed systems. Check [spec](https://github.com/multiformats/cid) for more info. | [optional] |
8
+ | **size** | **Float** | Size in bytes of the NFT data. | [optional][default to 132614] |
9
+ | **created** | **Time** | This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: YYYY-MM-DDTHH:MM:SSZ. | [optional] |
10
+ | **type** | **String** | MIME type of the upload file or &#39;directory&#39; when uploading multiple files. | [optional] |
11
+ | **scope** | **String** | Name of the JWT token used to create this NFT. | [optional][default to &#39;default&#39;] |
12
+ | **pin** | [**Pin**](Pin.md) | | [optional] |
13
+ | **files** | **Array&lt;Object&gt;** | Files in the directory (only if this NFT is a directory). | [optional] |
14
+ | **deals** | [**Array&lt;Deal&gt;**](Deal.md) | | [optional] |
15
+
16
+ ## Example
17
+
18
+ ```ruby
19
+ require 'nft_storage'
20
+
21
+ instance = NFTStorage::NFT.new(
22
+ cid: bafkreidivzimqfqtoqxkrpge6bjyhlvxqs3rhe73owtmdulaxr5do5in7u,
23
+ size: null,
24
+ created: 2021-03-12T17:03:07.787Z,
25
+ type: image/jpeg,
26
+ scope: null,
27
+ pin: null,
28
+ files: null,
29
+ deals: null
30
+ )
31
+ ```
32
+