class Reddcoin::Client
Attributes
get_key[RW]
post_key[RW]
Public Class Methods
new(api_keys = {})
click to toggle source
# File lib/reddcoin.rb, line 29 def initialize(api_keys = {}) @get_key = api_keys[:get] @post_key = api_keys[:post] end
Public Instance Methods
create_new_user(username)
click to toggle source
# File lib/reddcoin.rb, line 34 def create_new_user(username) response = self.class.post('/CreateNewUser', { :body => { APIKey: @post_key, Username: username }.to_json, :headers => { 'Content-Type' => 'application/json' } }) response.parsed_response end
get_user_balance(username)
click to toggle source
# File lib/reddcoin.rb, line 94 def get_user_balance(username) response = self.class.get('/GetUserBalance/'+@get_key+'/'+username) response.parsed_response end
get_user_balance_detail(username)
click to toggle source
# File lib/reddcoin.rb, line 100 def get_user_balance_detail(username) response = self.class.get('/GetUserBalanceDetail/'+@get_key+'/'+username) response.parsed_response end
get_user_info(username)
click to toggle source
# File lib/reddcoin.rb, line 86 def get_user_info(username) response = self.class.get('/GetUserInfo/'+@get_key+'/'+username) attr = response.parsed_response User.new(attr) end
get_user_list()
click to toggle source
# File lib/reddcoin.rb, line 80 def get_user_list response = self.class.get('/GetUserList/'+@get_key) response.parsed_response.map { |attr| User.new(attr) } end
move_to_user(username_from, username_to, amount)
click to toggle source
# File lib/reddcoin.rb, line 64 def move_to_user(username_from, username_to, amount) response = self.class.post('/MoveToUser', { :body => { APIKey: @post_key, UsernameFrom: username_from, UsernameTo: username_to, Amount: amount }.to_json, :headers => { 'Content-Type' => 'application/json' } }) response.parsed_response end
send_to_address(username_from, address_to, amount)
click to toggle source
# File lib/reddcoin.rb, line 48 def send_to_address(username_from, address_to, amount) response = self.class.post('/SendToAddress', { :body => { APIKey: @post_key, UsernameFrom: username_from, AddressTo: address_to, Amount: amount }.to_json, :headers => { 'Content-Type' => 'application/json' } }) response.parsed_response end