M lib/btc_sell_prices.rb => lib/btc_sell_prices.rb +3 -1
@@ 1,6 1,8 @@
# frozen_string_literal: true
require "em-http"
+require "em_promise"
+require "em-synchrony/em-http" # For aget vs get
require "money/bank/open_exchange_rates_bank"
require "nokogiri"
@@ 38,7 40,7 @@ protected
EM::HttpRequest.new(
"https://www.canadianbitcoins.com",
tls: { verify_peer: true }
- ).get
+ ).aget
end
def cad_to_usd
M lib/electrum.rb => lib/electrum.rb +3 -2
@@ 1,9 1,10 @@
# frozen_string_literal: true
require "bigdecimal"
+require "em-http"
require "em_promise"
+require "em-synchrony/em-http" # For apost vs post
require "json"
-require "net/http"
require "securerandom"
class Electrum
@@ 69,7 70,7 @@ protected
EM::HttpRequest.new(
@rpc_uri,
tls: { verify_peer: true }
- ).post(
+ ).apost(
head: {
"Authorization" => [@rpc_username, @rpc_password],
"Content-Type" => "application/json"