lib/mcoin/market/base.rb in mcoin-0.2.0 vs lib/mcoin/market/base.rb in mcoin-0.2.1
- old
+ new
@@ -9,18 +9,23 @@
# :nodoc:
class Base
def initialize(type, currency)
@type = type
@currency = currency
+ @retries = 0
end
def name
self.class.name.split('::').last
end
def fetch
@data ||= JSON.parse(Net::HTTP.get(uri))
self
+ rescue JSON::ParserError
+ raise if @retries >= 3
+ @retries += 1
+ retry
end
def to_ticker
raise NotImplementedError
end