activestorage-nft 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c04f87359f676125c3e3277b9828325a7f6d4ed495a89f6c993aa2c2205f1d8
4
- data.tar.gz: 27e87f850f294c3a264082312f5aeba0f4fb7682456bfbebf55e65d6829ba341
3
+ metadata.gz: 621576ef5625a89648ef4e24111bff5a466d2f5cb40e4aafc0d0bc2fca0560de
4
+ data.tar.gz: 79f77aac7c49fb69100852ae64347ca252ad9351e871a11b4e0cc774344dd6d8
5
5
  SHA512:
6
- metadata.gz: a485e2b7326beaa33011351c46359ed5de64ebbba15178f3ab678fb2d481f2c4cba1126e80209aee3d46fcb7d2b15486b6379e68f714abc8e0887475817ffcb1
7
- data.tar.gz: 7a30e4b192e8e8883ce04e302decbfc48f8f96e6e97b48d0cb7f880ea953ea529458e9f0501f1003cfafa89cf0d1f0e8bb73c7246a039414baed92c8ce27cc4e
6
+ metadata.gz: 6d4f0fcebf20d477fa1acf7266a4d80401f6f9b146a4093d9d41bfc1649bec48ab9565ca2d8ab50539aa18739bf850587e029c74c967030ff10f575abdc8df44
7
+ data.tar.gz: a9281cbb5cbb39d50f74fe90ea385920fedd196863b785fbc27a058f54887eb89feca0a061df563ab6f6631ff94a25eb0cb647b482aefbee8bcb6f2f36660e80
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # Activestorage::Nft
2
2
 
3
- This gem extends the ActiveStorage::Service with an implementation for
4
- [NFT.storage](https://nft.storage).
3
+ ActiveStorage adapter for [NFT.storage](https://nft.storage).
5
4
 
6
- We use [gateway.pinata.cloud](https://pinata.cloud) as IPFS gateway, because NFT.storage automatically pins all uploads to the pinata.cloud pinning service.
5
+ Uploaded files are automatically pinned on the pinata.cloud IPFS pinning service, courtesey of [Protocol Labs](https://protocol.ai).
6
+
7
+ Please note: This adapter adds a `unique` validation on ActiveRecord::Blob and will raise a validation error when trying to upload a file that already exists.
7
8
 
8
9
  ## Installation
9
10
 
@@ -18,7 +18,9 @@ module ActiveStorage
18
18
  def upload(key, io, checksum: nil, **)
19
19
  instrument :upload, key: key, checksum: checksum do
20
20
  cid_key = @client.add io.path
21
- Blob.find_by_key(key).update! key: cid_key
21
+ blob = Blob.find_by_key(key)
22
+ blob.key = cid_key
23
+ blob.save!
22
24
  end
23
25
  end
24
26
 
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module NftService
3
- VERSION = '0.0.3'.freeze
3
+ VERSION = '0.0.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage-nft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Buhrmester
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-13 00:00:00.000000000 Z
11
+ date: 2021-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http