From aa127a1a7d104548aa4b2d28cdc4e1b3e621ee83 Mon Sep 17 00:00:00 2001 From: Jack Wong Date: Wed, 31 Oct 2018 16:16:51 +0800 Subject: [PATCH] add letsdocoinz trade_page_url, fix fake timestamp --- lib/cryptoexchange/exchanges/letsdocoinz/market.rb | 4 ++++ .../exchanges/letsdocoinz/services/market.rb | 2 +- spec/exchanges/letsdocoinz/integration/market_spec.rb | 8 ++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/cryptoexchange/exchanges/letsdocoinz/market.rb b/lib/cryptoexchange/exchanges/letsdocoinz/market.rb index c1b5e985b..1f6e8cab6 100644 --- a/lib/cryptoexchange/exchanges/letsdocoinz/market.rb +++ b/lib/cryptoexchange/exchanges/letsdocoinz/market.rb @@ -3,6 +3,10 @@ module Letsdocoinz class Market < Cryptoexchange::Models::Market NAME = 'letsdocoinz' API_URL = 'http://api.letsdocoinz.com' + + def self.trade_page_url(args={}) + "https://letsdocoinz.com/#{args[:base]}-#{args[:target]}" + end end end end diff --git a/lib/cryptoexchange/exchanges/letsdocoinz/services/market.rb b/lib/cryptoexchange/exchanges/letsdocoinz/services/market.rb index 5a4be7210..3ded12a57 100644 --- a/lib/cryptoexchange/exchanges/letsdocoinz/services/market.rb +++ b/lib/cryptoexchange/exchanges/letsdocoinz/services/market.rb @@ -39,7 +39,7 @@ def adapt(market_pair, output) ticker.ask = NumericHelper.to_d(output['ask']) ticker.volume = NumericHelper.to_d(output['volume']) ticker.change = NumericHelper.to_d(output['change']) - ticker.timestamp = DateTime.parse(output['timestamp']).to_time.to_i + ticker.timestamp = nil ticker.payload = output ticker end diff --git a/spec/exchanges/letsdocoinz/integration/market_spec.rb b/spec/exchanges/letsdocoinz/integration/market_spec.rb index a2e603961..5a096fd22 100644 --- a/spec/exchanges/letsdocoinz/integration/market_spec.rb +++ b/spec/exchanges/letsdocoinz/integration/market_spec.rb @@ -4,6 +4,11 @@ let(:client) { Cryptoexchange::Client.new } let(:pk_btc_pair) { Cryptoexchange::Models::MarketPair.new(base: 'PK', target: 'BTC', market: 'letsdocoinz') } + it 'give trade url' do + trade_page_url = client.trade_page_url pk_btc_pair.market, base: pk_btc_pair.base, target: pk_btc_pair.target + expect(trade_page_url).to eq "https://letsdocoinz.com/PK-BTC" + end + it 'fetch pairs' do pairs = client.pairs('letsdocoinz') expect(pairs).not_to be_empty @@ -25,8 +30,7 @@ expect(ticker.ask).to be_a Numeric expect(ticker.change).to be_a Numeric expect(ticker.volume).to be_a Numeric - expect(ticker.timestamp).to be_a Numeric - expect(2000..Date.today.year).to include(Time.at(ticker.timestamp).year) + expect(ticker.timestamp).to be nil expect(ticker.payload).to_not be nil end #