bitclient 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 +6 -0
- data/Rakefile +2 -0
- data/bitclient.gemspec +24 -0
- data/lib/bitclient.rb +27 -0
- data/lib/bitclient/version.rb +3 -0
- metadata +100 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README
ADDED
data/Rakefile
ADDED
data/bitclient.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "bitclient/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "bitclient"
|
7
|
+
s.version = Bitclient::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Indrek Juhkam"]
|
10
|
+
s.email = ["indrek@urgas.eu"]
|
11
|
+
s.homepage = "http://github.com/indrekj/bitclient"
|
12
|
+
s.summary = "Simple interface to the Bitclient JSON-RPC API"
|
13
|
+
s.description = ""
|
14
|
+
|
15
|
+
s.rubyforge_project = "bitclient"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency "json"
|
23
|
+
s.add_dependency "httparty"
|
24
|
+
end
|
data/lib/bitclient.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require "httparty"
|
2
|
+
|
3
|
+
# https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
|
4
|
+
#
|
5
|
+
module Bitclient
|
6
|
+
def initialize(opts = {})
|
7
|
+
@url = opts[:url] || "http://localhost:8332"
|
8
|
+
@auth = {:username => opts[:username], :password => opts[:password]}
|
9
|
+
end
|
10
|
+
|
11
|
+
def method_missing(method, *args)
|
12
|
+
options = {
|
13
|
+
:body => {
|
14
|
+
:method => method.to_s.gsub(/\_/, ""),
|
15
|
+
:params => args
|
16
|
+
}.to_json,
|
17
|
+
:basic_auth => @auth,
|
18
|
+
:format => :json
|
19
|
+
}
|
20
|
+
res = HTTParty.post(@url, options).parsed_response
|
21
|
+
if res["error"]
|
22
|
+
raise Exception, res["error"]
|
23
|
+
else
|
24
|
+
res["result"]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bitclient
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: "0.1"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Indrek Juhkam
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-08-26 00:00:00 +03:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: json
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: httparty
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
description: ""
|
49
|
+
email:
|
50
|
+
- indrek@urgas.eu
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
files:
|
58
|
+
- .gitignore
|
59
|
+
- Gemfile
|
60
|
+
- README
|
61
|
+
- Rakefile
|
62
|
+
- bitclient.gemspec
|
63
|
+
- lib/bitclient.rb
|
64
|
+
- lib/bitclient/version.rb
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: http://github.com/indrekj/bitclient
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
requirements: []
|
93
|
+
|
94
|
+
rubyforge_project: bitclient
|
95
|
+
rubygems_version: 1.5.2
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: Simple interface to the Bitclient JSON-RPC API
|
99
|
+
test_files: []
|
100
|
+
|