class StartcoinClient::Request
Attributes
params[R]
service_name[R]
Public Class Methods
new(service_name, params = [])
click to toggle source
# File lib/startcoin_client/request.rb, line 6 def initialize(service_name, params = []) @service_name = service_name @params = params.dup # bitcoin rejects null values even for optional params. Since # even params following those may have default non-nil values, # we'll assume the first non-nil value marks a set of optional # params, and drop it and everything following it. # # ex: # [nil] => [] # [1,nil,nil] => [1] # [1,nil,nil,1] => [1] if index = @params.index(nil) @params = @params[0...index] end end
Public Instance Methods
to_hash()
click to toggle source
# File lib/startcoin_client/request.rb, line 24 def to_hash { :method => service_name, :params => params, :id => "jsonrpc" } end
to_post_data()
click to toggle source
# File lib/startcoin_client/request.rb, line 32 def to_post_data to_hash.to_json end