lib/money/bank/open_exchange_rates_bank.rb
def valid_rates?(text)
        return false unless text
        parsed = JSON.parse(text)
        parsed && parsed.key?(RATES_KEY) && parsed.key?(TIMESTAMP_KEY)
      rescue JSON::ParserError
        false
      end
# Check validity of rates response only for store in cache
#
# @example
#   oxr.valid_rates?("{\"rates\": {\"AED\": 3.67304}}")
#
# @param [String] text is JSON content
# @return [Boolean] valid or not
Check validity of rates response only for store in cache
Check validity of rates response only for store in cache
def valid_rates?(text)
        return false unless text
        parsed = JSON.parse(text)
        parsed && parsed.key?(RATES_KEY) && parsed.key?(TIMESTAMP_KEY)
      rescue JSON::ParserError
        false
      end
def valid_rates? ( text ) return false unless text parsed = JSON . parse ( text ) parsed && parsed . key? ( RATES_KEY ) && parsed . key? ( TIMESTAMP_KEY ) rescue JSON :: ParserError false end
Check validity of rates response only for store in cache
Check validity of rates response only for store in cache
valid or not
valid or not
Boolean
text
text is JSON content
text is JSON content
example
None