Sha256: 5fc2422d84026be7e467ac24497b5d69116fd568c23310dc2e31c18816e74572
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
require "nordea/bank" require "nordea/exchange_rates" require "nordea/version" require "tzinfo" # Ruby interface to the Nordea Bank exchange rate data. module Nordea # The default timezone, Europe/Helsinki TZ = TZInfo::Timezone.get("Europe/Helsinki") # Parses the datetime format used in the Nordea data. # # @example # Nordea.parse_time("20150101120056") #=> 2015-01-01 10:00:05 UTC # # @param [String] the datetime string (YYYYMMDDHHmmSS) # @return [Time] the string converted into a Time object def self.parse_time(datetime) time = Time.utc( datetime[0..3].to_i, datetime[4..5].to_i, datetime[6..7].to_i, datetime[8..9].to_i, datetime[10..11].to_i, datetime[11..12].to_i ) # Convert the local time to UTC time. TZ.local_to_utc(time) rescue nil end # Parses the date format used in the Nordea data. # # @param [String] the date string (YYYYMMDD) # @return [Date] the string converted into a Date object def self.parse_date(date) Date.new(date[0..3].to_i, date[4..5].to_i, date[6..7].to_i) rescue nil end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nordea-2.0.2 | lib/nordea.rb |
nordea-2.0.1 | lib/nordea.rb |
nordea-2.0.0 | lib/nordea.rb |
nordea-1.1.0 | lib/nordea.rb |