zold 0.11.22 → 0.12

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
2
  SHA1:
3
- metadata.gz: bc7e111fc1e96f2796c64c793edd9714972680d8
4
- data.tar.gz: 5149c712d5e30dd6e92f7e3ead90d0329d904399
3
+ metadata.gz: 55aa7db31be1a30fe5c6a5e0cb9759292ffb8d81
4
+ data.tar.gz: e46a40ac9384be0766f8c3625eea404fb7fec0ae
5
5
  SHA512:
6
- metadata.gz: 29bf131b899ac382814b6ffcefa8b472167387b081269b9224b972ec4d3229bf40aad759c4cd39298e11af193a0d27f49b448679138c434d0c46d0d91f29b700
7
- data.tar.gz: f676f48ea7719ccf1552220381e0df2e0a732791686d0b8128a5c57c2d3ca2711318910c70a24f2141d31dad3d835ebc78ca766e817ef963917b89a6aa023c88
6
+ metadata.gz: f00f34b9bb37a64469dde5f135ffc94ca8ebf85412e7cc4c1a87061f34727e981e9b8a822556eead5487ab19076fb1a0b20d8714048119999ac2fef0f94df6d3
7
+ data.tar.gz: 592316cadf0d993a0c0d669e96e3b2cb76d92cb11c92f49a8f280eb2fd5608a4e20534e8bd2b224f0343ee4a672a50b8ab1e13b3f9b8392d9fd278b98b5ec3d6
@@ -145,6 +145,14 @@ module Zold
145
145
  }.to_json
146
146
  end
147
147
 
148
+ get %r{/wallet/(?<id>[A-Fa-f0-9]{16})/balance} do
149
+ id = Id.new(params[:id])
150
+ wallet = settings.wallets.find(id)
151
+ error 404 unless wallet.exists?
152
+ content_type 'text/plain'
153
+ wallet.balance.to_i.to_s
154
+ end
155
+
148
156
  put %r{/wallet/(?<id>[A-Fa-f0-9]{16})/?} do
149
157
  id = Id.new(params[:id])
150
158
  wallet = settings.wallets.find(id)
data/lib/zold/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Zold
26
- VERSION = '0.11.22'.freeze
26
+ VERSION = '0.12'.freeze
27
27
  end
@@ -54,6 +54,17 @@ class FrontTest < Minitest::Test
54
54
  end
55
55
  end
56
56
 
57
+ def test_renders_wallet_pages
58
+ FakeNode.new(log: test_log).run(['--ignore-score-weakness']) do |port|
59
+ FakeHome.new.run do |home|
60
+ wallet = home.create_wallet
61
+ response = Zold::Http.new("http://localhost:#{port}/wallet/#{wallet.id}?sync=true").put(File.read(wallet.path))
62
+ assert_equal('200', response.code, response.body)
63
+ assert_equal('0', Zold::Http.new("http://localhost:#{port}/wallet/#{wallet.id}/balance").get.body)
64
+ end
65
+ end
66
+ end
67
+
57
68
  def test_pushes_twice
58
69
  FakeNode.new(log: test_log).run do |port|
59
70
  FakeHome.new.run do |home|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.22
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko