• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / tigerdata-app / 93cce249-3dee-4f64-bd68-4e50b5cbf48e

21 Oct 2025 09:49PM UTC coverage: 82.779% (+1.5%) from 81.319%
93cce249-3dee-4f64-bd68-4e50b5cbf48e

push

circleci

web-flow
Stop mediaflux when we stop everything else (#2066)

Ref #2065

2490 of 3008 relevant lines covered (82.78%)

226.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.0
/app/models/mediaflux/time.rb
1
# frozen_string_literal: true
2
module Mediaflux
1✔
3
  class Time
1✔
4
    # Converts the givin time snippet into local princeton time while accounting for potential time zone of the asset.
5
    #
6
    # @param xml_snip [:nokigiri], response_xml from a mediaflux request
7
    # @return [String] returns a iso8601 Princeton time value.
8
    def convert(xml_snip:)
1✔
9
      xml = xml_snip
×
10
      time = xml.text.to_time
×
11
      gmt = xml.xpath("./@gmt-offset").text.to_f
×
12

13
      if gmt.zero?
×
14
        return time.in_time_zone("America/New_York").iso8601
×
15
      elsif gmt.positive?
×
16
        time -= gmt.hours
×
17
      else
18
        time += gmt.hours
×
19
      end
20

21
      princeton_time = time.in_time_zone("America/New_York").iso8601
×
22
      princeton_time
×
23
    end
24

25
    # Transform iso8601 dates to MediaFlux expected format
26
    # @example
27
    #   Mediaflux::Time.format_date_for_mediaflux("2024-02-26T10:33:11-05:00") => "22-FEB-2024 13:57:19"
28
    def self.format_date_for_mediaflux(iso8601_date)
1✔
29
      return if iso8601_date.nil?
×
30
      Object::Time.zone.parse(iso8601_date).strftime("%e-%b-%Y %H:%M:%S").upcase
×
31
    end
32
  end
33
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc