Module: BitShares

Defined in:
lib/bitshares.rb,
lib/bitshares/api.rb,
lib/bitshares/rpc.rb,
lib/bitshares/asset.rb,
lib/bitshares/wallet.rb,
lib/bitshares/account.rb,
lib/bitshares/version.rb,
lib/bitshares/wsocket.rb

Defined Under Namespace

Modules: WSocket Classes: Account, Api, Asset, Rpc, Wallet

Constant Summary collapse

API =
Api
RPC =
Rpc
VERSION =
"0.0.4"

Class Method Summary collapse

Class Method Details

.account(name) ⇒ Object



33
34
35
# File 'lib/bitshares.rb', line 33

def  name
	Account[name]
end

.assets(*ids) ⇒ Object



41
42
43
# File 'lib/bitshares.rb', line 41

def assets *ids
	Asset[*ids]
end

.balance(name, *ids) ⇒ Object



37
38
39
# File 'lib/bitshares.rb', line 37

def balance name,*ids
	Wallet[name,*ids]
end

.config(autoconnect = true, &block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/bitshares.rb', line 14

def config autoconnect=true, &block
	@node = 'wss://node.testnet.bitshares.eu'
	@login = ''
	@pass = ''
	instance_eval(&block) if block_given?
	start if autoconnect
end

.list_assets(name, limit = 1) ⇒ Object



45
46
47
# File 'lib/bitshares.rb', line 45

def list_assets name, limit=1
	Asset.search name, limit
end

.login(n = nil) ⇒ Object



23
# File 'lib/bitshares.rb', line 23

def (n=nil)	n ||= @login; @login = n; end

.node(n = nil) ⇒ Object



22
# File 'lib/bitshares.rb', line 22

def node(n=nil)		n ||= @node; @node = n;		end

.pass(n = nil) ⇒ Object



24
# File 'lib/bitshares.rb', line 24

def pass(n=nil)		n ||= @pass; @pass = n;		end

.startObject



26
27
28
29
# File 'lib/bitshares.rb', line 26

def start
	WSocket.start
	RPC.new(1,'login',[@login,@pass]).send
end

.stopObject



31
# File 'lib/bitshares.rb', line 31

def stop() WSocket.stop end

.subscribe_callback(id, clear_filter = true) ⇒ Object



49
50
51
# File 'lib/bitshares.rb', line 49

def subscribe_callback id, clear_filter=true
	RPC.new('set_subscribe_callback', [id, clear_filter]).send
end

.transfer(that, amount, from, to) ⇒ Object



53
54
55
# File 'lib/bitshares.rb', line 53

def transfer that, amount, from, to
	RPC.new 'transfer',[]
end