Method: OnChain::BlockChain.fetch_response

Defined in:
lib/onchain/block_chain.rb

.fetch_response(url, do_json = true) ⇒ Object



179
180
181
182
183
184
185
186
187
188
# File 'lib/onchain/block_chain.rb', line 179

def fetch_response(url, do_json=true)
  resp = Net::HTTP.get_response(URI.parse(url))
  data = resp.body

  if do_json
    result = JSON.parse(data)
  else
    data
  end
end