Class: KristClient
- Inherits:
-
Object
show all
- Defined in:
- lib/krist/kristclient.rb
Constant Summary
collapse
- @@baseurl =
"http://krist.ceriat.net/"
Instance Method Summary
collapse
Constructor Details
#initialize(privatekey) ⇒ KristClient
Returns a new instance of KristClient.
5
6
7
8
|
# File 'lib/krist/kristclient.rb', line 5
def initialize(privatekey)
@privatekey = generatePrivateKey(privatekey: privatekey)
@address = post("v2",{privatekey: @privatekey})["address"]
end
|
Instance Method Details
#deleteWebhook(id:) ⇒ Object
50
51
52
|
# File 'lib/krist/kristclient.rb', line 50
def deleteWebhook(id:)
post("webhooks/#{id}/delete", {privatekey: @privatekey, owner: @address})
end
|
#getAddress ⇒ Object
10
11
12
|
# File 'lib/krist/kristclient.rb', line 10
def getAddress
@address
end
|
#getDomains ⇒ Object
31
32
33
|
# File 'lib/krist/kristclient.rb', line 31
def getDomains
get("addresses/#{@address}/names")
end
|
#getInfo ⇒ Object
14
15
16
|
# File 'lib/krist/kristclient.rb', line 14
def getInfo
get("addresses/#{@address}")
end
|
#getWebhooks ⇒ Object
46
47
48
|
# File 'lib/krist/kristclient.rb', line 46
def getWebhooks
post("webhooks/#{@address}", {privatekey: @privatekey})
end
|
#recentTransactions(limit: 50, offset: 0) ⇒ Object
27
28
29
|
# File 'lib/krist/kristclient.rb', line 27
def recentTransactions(limit: 50, offset: 0)
get("addresses/#{@address}/transactions?limit=#{limit}&offset=#{offset}")
end
|
#registerDomain(name:) ⇒ Object
54
55
56
|
# File 'lib/krist/kristclient.rb', line 54
def registerDomain(name:)
post("names/#{name}", {privatekey: @privatekey})
end
|
#registerWebhook(event: "transaction", url:, method: "post", addresses: "") ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/krist/kristclient.rb', line 35
def registerWebhook(event: "transaction", url:, method: "post", addresses: "")
post("webhooks", {
privatekey: @privatekey,
owner: @address,
event: event,
url: url,
method: method,
addresses: addresses
})
end
|
#sendTo(to:, amount:, metadata: "") ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/krist/kristclient.rb', line 18
def sendTo(to:, amount:, metadata: "")
post("transactions", {
privatekey: @privatekey,
to: to,
amount: amount,
metadata: metadata
})
end
|
#transferDomain(name:, to:) ⇒ Object
62
63
64
|
# File 'lib/krist/kristclient.rb', line 62
def transferDomain(name:, to:)
post("names/#{name}/transfer", {address: to, privatekey: @privatekey})
end
|
#updateDomainRecord(name:, a:) ⇒ Object
58
59
60
|
# File 'lib/krist/kristclient.rb', line 58
def updateDomainRecord(name:, a:)
post("names#{name}/update", {a: a, privatekey: @privatekey})
end
|