~singpolyma/sgx-jmp

946b50dea5e5c9553e7eaf6ab2d958e66034800f — Stephen Paul Weber 1 year, 8 months ago 210ab8c
Work in the presence of em-synchrony

em-synchrony monkeypatches em-http when loaded. The old functionality is still
present, but under different method names.
2 files changed, 6 insertions(+), 3 deletions(-)

M lib/btc_sell_prices.rb
M lib/electrum.rb
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"