ipfs-api 0.3.0 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6b33b926a8240b157a5cfa1e14d35093d0f9a4ed
4
- data.tar.gz: '0596fee2ce4d0a8a20226a1dbacb8bd47bdaf348'
2
+ SHA256:
3
+ metadata.gz: 9bd8f7653d00434d0ee809fa1c0225c5ea983ccc53c61157932cf10953f00679
4
+ data.tar.gz: 93e65ff69174cb7a06f8cd63c3a4277055c8d8e5d9759a1715ac6d083f5c750a
5
5
  SHA512:
6
- metadata.gz: 2723b6ec115c399d23c4fb0cc3fd4af506fcc83a3d2675a58f42139b755ef012563cb4bd4f81e34c6f2693016334548fa94bf819816f4ca5576a8314f329c074
7
- data.tar.gz: 2849a2ef6807c906c622cd869b16a527b18965d433c9e0e9d5515e2c054d7aa8e653fcc0ac65b1d73e3e40bc96723bbbca8dfbd2df29c9df6841be18333ed28a
6
+ metadata.gz: 99d6311039ea27fbb777af8211b34a17e6b1458c9c45336bdaa3f634d2aab21afc4cee6ada77068eab51ad93a8c2a347925ee419bead1f3a2c8fa3d7327146d3
7
+ data.tar.gz: fbfaadb695eb7fab708573778e794652c13cae4432418ecade50b78fd70feb68b399375fc9af8da67c770060581203c6005037e9daa092a6f8a49c6168294e74
data/README.md CHANGED
@@ -17,7 +17,7 @@ To install this gem, run
17
17
 
18
18
  or simply add this line to your ``Gemfile``
19
19
 
20
- gem 'ipfs-api', '~> 0.3.0'
20
+ gem 'ipfs-api', '~> 0.4.0'
21
21
 
22
22
  ## Basic examples
23
23
 
data/Rakefile CHANGED
@@ -40,7 +40,6 @@ spec = Gem::Specification.new do |s|
40
40
  s.authors = AUTHORS
41
41
  s.email = EMAIL
42
42
  s.homepage = HOMEPAGE
43
- s.rubyforge_project = PKG_NAME
44
43
  s.summary = SUMMARY
45
44
  s.description = DESCRIPTION
46
45
  s.platform = Gem::Platform::RUBY
@@ -49,7 +48,6 @@ spec = Gem::Specification.new do |s|
49
48
  s.executables = []
50
49
  s.files = PKG_FILES
51
50
  s.test_files = []
52
- s.has_rdoc = true
53
51
  s.extra_rdoc_files = RDOC_FILES
54
52
  s.rdoc_options = RDOC_OPTIONS
55
53
  s.required_ruby_version = ">= 2.0.0"
@@ -78,7 +76,7 @@ namespace :gem do
78
76
  spec.instance_variables.sort.each do |ivar|
79
77
  value = spec.instance_variable_get(ivar)
80
78
  name = ivar.to_s.split("@").last
81
- next if skip_fields.include?(name) || value.nil? || value == "" || (value.respond_to?(:empty?) && value.empty?)
79
+ next if skip_fields.include?(name) || value.nil? || (value.respond_to?(:empty?) && value.empty?)
82
80
  if name == "dependencies"
83
81
  value.each do |d|
84
82
  dep, *ver = d.to_s.split(" ")
data/ipfs-api.gemspec CHANGED
@@ -28,8 +28,7 @@ Gem::Specification.new do |s|
28
28
  "test/test_cmd_ls.rb",
29
29
  "test/test_io.rb",
30
30
  "test/test_upload.rb"]
31
- s.full_name = "ipfs-api-0.3.0"
32
- s.has_rdoc = true
31
+ s.full_name = "ipfs-api-0.4.0"
33
32
  s.homepage = "http://hjoest.github.io/ruby-ipfs-api"
34
33
  s.licenses = ["MIT"]
35
34
  s.name = "ipfs-api"
@@ -38,9 +37,8 @@ Gem::Specification.new do |s|
38
37
  s.require_paths = ["lib"]
39
38
  s.required_ruby_version = ">= 2.0.0"
40
39
  s.required_rubygems_version = ">= 0"
41
- s.rubyforge_project = "ipfs-api"
42
- s.rubygems_version = "2.6.10"
40
+ s.rubygems_version = "3.1.4"
43
41
  s.specification_version = 4
44
42
  s.summary = "Interplanetary File System for Ruby"
45
- s.version = "0.3.0"
43
+ s.version = "0.4.0"
46
44
  end
@@ -156,6 +156,14 @@ Content-Type: application/octet-stream\r\n\
156
156
  end
157
157
  end
158
158
 
159
+ def publish node, key = nil
160
+ params = "arg=#{CGI.escape(node.hash)}"
161
+ params << "&key=#{CGI.escape(key)}" if key
162
+ @connection.instance_exec(self) do
163
+ JSON.parse(post("name/publish?#{params}").body)['Name']
164
+ end
165
+ end
166
+
159
167
  end
160
168
 
161
169
  end
@@ -1,4 +1,4 @@
1
1
  module IPFS
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
4
4
 
data/test/test_cmd_id.rb CHANGED
@@ -10,8 +10,11 @@ class CommandIdTest < Minitest::Test
10
10
  def test_id
11
11
  ipfs = Connection.new
12
12
  id = ipfs.id
13
- assert_equal 46, id.size
14
- assert id.start_with?('Qm')
13
+ if id.start_with?('Qm')
14
+ assert_equal 46, id.size
15
+ else
16
+ assert_equal 52, id.size
17
+ end
15
18
  end
16
19
 
17
20
  end
data/test/test_cmd_ls.rb CHANGED
@@ -12,6 +12,7 @@ class CommandLsTest < Minitest::Test
12
12
  Samples.some_virtual_folders do |fixture, expectation|
13
13
  ipfs.add fixture
14
14
  actual = ipfs.ls('QmcsmfcY8SQzNxJQYGZMHLXCkeTgxDBhASDPJyVEGi8Wrv')
15
+ actual = streamline_result(actual)
15
16
  expectation = {
16
17
  'Objects' => [
17
18
  {
@@ -20,13 +21,13 @@ class CommandLsTest < Minitest::Test
20
21
  {
21
22
  'Name' => 'foo.txt',
22
23
  'Hash' => 'QmTz3oc4gdpRMKP2sdGUPZTAGRngqjsi99BPoztyP53JMM',
23
- 'Size' => 12,
24
+ 'Size' => 4,
24
25
  'Type' => 2
25
26
  },
26
27
  {
27
28
  'Name' => 'hello.txt',
28
29
  'Hash' => 'QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG',
29
- 'Size' => 21,
30
+ 'Size' => 13,
30
31
  'Type' => 2
31
32
  }
32
33
  ]
@@ -37,4 +38,19 @@ class CommandLsTest < Minitest::Test
37
38
  end
38
39
  end
39
40
 
41
+ # At some point, around version 0.4.2, a new property "Target" was introduced
42
+ # to the "Links" objects. In order to match the test expectation, and still not
43
+ # fail for older versions, we just remove these here whenever they're empty.
44
+ private
45
+ def streamline_result result
46
+ result['Objects'].each do |object|
47
+ object['Links'].each do |link|
48
+ if link['Target'] == ''
49
+ link.delete('Target')
50
+ end
51
+ end
52
+ end
53
+ result
54
+ end
55
+
40
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipfs-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Holger Joest
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-05 00:00:00.000000000 Z
11
+ date: 2022-07-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a client library to access the IPFS from Ruby
14
14
  email: holger@joest.org
@@ -42,7 +42,7 @@ homepage: http://hjoest.github.io/ruby-ipfs-api
42
42
  licenses:
43
43
  - MIT
44
44
  metadata: {}
45
- post_install_message:
45
+ post_install_message:
46
46
  rdoc_options:
47
47
  - "--title"
48
48
  - Interplanetary File System for Ruby
@@ -62,9 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubyforge_project: ipfs-api
66
- rubygems_version: 2.6.10
67
- signing_key:
65
+ rubygems_version: 3.1.4
66
+ signing_key:
68
67
  specification_version: 4
69
68
  summary: Interplanetary File System for Ruby
70
69
  test_files: []