bitcoin-client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.rdoc +79 -0
- data/Rakefile +9 -0
- data/bitcoind-client.gemspec +28 -0
- data/lib/bitcoin-client.rb +1 -0
- data/lib/bitcoin.rb +19 -0
- data/lib/bitcoin/api.rb +33 -0
- data/lib/bitcoin/client.rb +227 -0
- data/lib/bitcoin/dsl.rb +259 -0
- data/lib/bitcoin/errors.rb +4 -0
- data/lib/bitcoin/request.rb +35 -0
- data/lib/bitcoin/rpc.rb +50 -0
- data/lib/bitcoin/version.rb +12 -0
- data/spec/fixtures/backupwallet_without_params.json +8 -0
- data/spec/fixtures/build_fixture.rb +19 -0
- data/spec/fixtures/getbalance.json +8 -0
- data/spec/fixtures/getblockcount.json +8 -0
- data/spec/fixtures/getblocknumber.json +8 -0
- data/spec/fixtures/getconnectioncount.json +8 -0
- data/spec/fixtures/getdifficulty.json +8 -0
- data/spec/fixtures/getgenerate.json +8 -0
- data/spec/fixtures/gethashespersec.json +8 -0
- data/spec/fixtures/getinfo.json +8 -0
- data/spec/fixtures/help.json +8 -0
- data/spec/fixtures/listreceivedbyaddress_with_minconf_0.json +8 -0
- data/spec/fixtures/listreceivedbyaddress_with_minconf_0_and_includeempty_true.json +7 -0
- data/spec/fixtures/listreceivedbyaddress_without_params.json +7 -0
- data/spec/lib/bitcoin/api_spec.rb +28 -0
- data/spec/lib/bitcoin/client_spec.rb +108 -0
- data/spec/lib/bitcoin/request_spec.rb +19 -0
- data/spec/lib/bitcoin_spec.rb +34 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/fixtures_helper.rb +5 -0
- data/spec/support/rpc_service_helper.rb +34 -0
- metadata +141 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'fakeweb'
|
2
|
+
|
3
|
+
# bitcoin user settings
|
4
|
+
$user = 'user'
|
5
|
+
$pass = 'pass'
|
6
|
+
|
7
|
+
require File.expand_path('../lib/bitcoin-client', File.dirname(__FILE__))
|
8
|
+
|
9
|
+
Dir[File.expand_path("support/**/*.rb", File.dirname(__FILE__))].each { |f| require f }
|
10
|
+
|
11
|
+
FakeWeb.allow_net_connect = false
|
12
|
+
|
13
|
+
RSpec.configure do |c|
|
14
|
+
c.include FixturesHelper
|
15
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module RPCServiceHelper
|
2
|
+
def service(name, &block)
|
3
|
+
context "'#{name}'" do
|
4
|
+
define_method :fixture_name do
|
5
|
+
suffix = self.class.fixture_suffix.gsub(/\s/, '_')
|
6
|
+
if suffix.length > 0
|
7
|
+
"#{name}_#{suffix}"
|
8
|
+
else
|
9
|
+
name
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
define_method :result do |*args|
|
14
|
+
FakeWeb.register_uri(:post, "http://user:pass@localhost:8332", :response => fixture(fixture_name))
|
15
|
+
subject.send(name, *args)
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def fixture_suffix
|
20
|
+
@fixture_suffix ||= ""
|
21
|
+
end
|
22
|
+
|
23
|
+
def context(desc, &block)
|
24
|
+
super desc do
|
25
|
+
fixture_suffix.concat desc
|
26
|
+
instance_eval &block
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
instance_eval &block
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bitcoin-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Colin MacKenzie IV
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-08-22 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.6.0
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: fakeweb
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - "="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.3.0
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rest-client
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - "="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.6.3
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id003
|
48
|
+
description: Provides a Ruby library to the complete Bitcoin JSON-RPC API. Implements all methods listed at https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list and lets you set options such as the host and port number, and whether to use SSL.
|
49
|
+
email:
|
50
|
+
- sinisterchipmunk@gmail.com
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
files:
|
58
|
+
- .gitignore
|
59
|
+
- Gemfile
|
60
|
+
- README.rdoc
|
61
|
+
- Rakefile
|
62
|
+
- bitcoind-client.gemspec
|
63
|
+
- lib/bitcoin-client.rb
|
64
|
+
- lib/bitcoin.rb
|
65
|
+
- lib/bitcoin/api.rb
|
66
|
+
- lib/bitcoin/client.rb
|
67
|
+
- lib/bitcoin/dsl.rb
|
68
|
+
- lib/bitcoin/errors.rb
|
69
|
+
- lib/bitcoin/request.rb
|
70
|
+
- lib/bitcoin/rpc.rb
|
71
|
+
- lib/bitcoin/version.rb
|
72
|
+
- spec/fixtures/backupwallet_without_params.json
|
73
|
+
- spec/fixtures/build_fixture.rb
|
74
|
+
- spec/fixtures/getbalance.json
|
75
|
+
- spec/fixtures/getblockcount.json
|
76
|
+
- spec/fixtures/getblocknumber.json
|
77
|
+
- spec/fixtures/getconnectioncount.json
|
78
|
+
- spec/fixtures/getdifficulty.json
|
79
|
+
- spec/fixtures/getgenerate.json
|
80
|
+
- spec/fixtures/gethashespersec.json
|
81
|
+
- spec/fixtures/getinfo.json
|
82
|
+
- spec/fixtures/help.json
|
83
|
+
- spec/fixtures/listreceivedbyaddress_with_minconf_0.json
|
84
|
+
- spec/fixtures/listreceivedbyaddress_with_minconf_0_and_includeempty_true.json
|
85
|
+
- spec/fixtures/listreceivedbyaddress_without_params.json
|
86
|
+
- spec/lib/bitcoin/api_spec.rb
|
87
|
+
- spec/lib/bitcoin/client_spec.rb
|
88
|
+
- spec/lib/bitcoin/request_spec.rb
|
89
|
+
- spec/lib/bitcoin_spec.rb
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
- spec/support/fixtures_helper.rb
|
92
|
+
- spec/support/rpc_service_helper.rb
|
93
|
+
homepage: http://github.com/sinisterchipmunk/bitcoin-client
|
94
|
+
licenses: []
|
95
|
+
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: "0"
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: "0"
|
113
|
+
requirements: []
|
114
|
+
|
115
|
+
rubyforge_project: bitcoin-client
|
116
|
+
rubygems_version: 1.8.5
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: Provides a Ruby library to the complete Bitcoin JSON-RPC API.
|
120
|
+
test_files:
|
121
|
+
- spec/fixtures/backupwallet_without_params.json
|
122
|
+
- spec/fixtures/build_fixture.rb
|
123
|
+
- spec/fixtures/getbalance.json
|
124
|
+
- spec/fixtures/getblockcount.json
|
125
|
+
- spec/fixtures/getblocknumber.json
|
126
|
+
- spec/fixtures/getconnectioncount.json
|
127
|
+
- spec/fixtures/getdifficulty.json
|
128
|
+
- spec/fixtures/getgenerate.json
|
129
|
+
- spec/fixtures/gethashespersec.json
|
130
|
+
- spec/fixtures/getinfo.json
|
131
|
+
- spec/fixtures/help.json
|
132
|
+
- spec/fixtures/listreceivedbyaddress_with_minconf_0.json
|
133
|
+
- spec/fixtures/listreceivedbyaddress_with_minconf_0_and_includeempty_true.json
|
134
|
+
- spec/fixtures/listreceivedbyaddress_without_params.json
|
135
|
+
- spec/lib/bitcoin/api_spec.rb
|
136
|
+
- spec/lib/bitcoin/client_spec.rb
|
137
|
+
- spec/lib/bitcoin/request_spec.rb
|
138
|
+
- spec/lib/bitcoin_spec.rb
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
- spec/support/fixtures_helper.rb
|
141
|
+
- spec/support/rpc_service_helper.rb
|