I'm trying to implement Bitcoin payments using Block.io, and when I request a balance from the bitcoin address, it responds with a hash. How can I extract specific information and make the data user friendly.
The hash I need to extract the information from looks like this:
{"status"=>"success", "data"=>{"network"=>"BTCTEST", "available_balance"=>"0.01000000", "pending_received_balance"=>"0.00000000"}}
I have a controller with method:
class PaymentsController < ApplicationController
def index
@balance = BlockIo.get_balance
end
end
And in the view I have:
<%= @balance.each do |bal| %>
<p>Balance: <%= bal[1]["available_balance"] %></p>
<% end %>
And the result that I get in the index.html.erb view is like this:
Balance:
Balance: 0.01000000
{"status"=>"success", "data"=>{"network"=>"BTCTEST", "available_balance"=>"0.01000000", "pending_received_balance"=>"0.00000000"}}
As you can see above, it shows Balance twice and also still shows the hash in the view.
How can I only show Balance: 0.01000000? Any assistance or comment is greatly appreciated.