Module: Bitbank
- Defined in:
- lib/bitbank.rb,
lib/bitbank/client.rb,
lib/bitbank/account.rb,
lib/bitbank/transaction.rb
Defined Under Namespace
Classes: Account, Client, Transaction
Constant Summary
collapse
- @@defaults =
{
:host => 'localhost',
:port => 8332
}
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
20
21
22
|
# File 'lib/bitbank.rb', line 20
def self.config
@config
end
|
.config=(filename_or_hash) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/bitbank.rb', line 24
def self.config=(filename_or_hash)
if filename_or_hash.is_a?(String)
options = YAML.load_file(filename_or_hash)
else
options = filename_or_hash
end
options.symbolize_keys!
if options.has_key?(:username) && options.has_key?(:password)
@config = @@defaults.merge(options)
else
raise ArgumentError, 'Please specify a username and password for bitcoind'
end
end
|
.new(options = {}) ⇒ Object
15
16
17
18
|
# File 'lib/bitbank.rb', line 15
def self.new(options={})
self.config = options
Client.new(config)
end
|
.version ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/bitbank.rb', line 39
def self.version
version_path = File.join(File.dirname(__FILE__), '..', 'VERSION')
if File.file?(version_path)
File.read(version_path).chomp
else
'0.0.0'
end
end
|