Class: D2L::Valence::TimestampError

Inherits:
Object
  • Object
show all
Defined in:
lib/d2l/valence/timestamp_error.rb

Overview

TimestampError

This class is aimed at parsing and providing diagnostics for time based issues between the D2L Brightspace Server and Ruby Client

Instance Method Summary collapse

Constructor Details

#initialize(error_message) ⇒ TimestampError

Returns a new instance of TimestampError.

Parameters:

  • D2L (String)

    Brightspace Server Error Message



8
9
10
# File 'lib/d2l/valence/timestamp_error.rb', line 8

def initialize(error_message)
  @error_message = error_message
end

Instance Method Details

#server_skewInteger

Returns difference in D2L Server timestamp in seconds.

Returns:

  • (Integer)

    difference in D2L Server timestamp in seconds



13
14
15
16
17
# File 'lib/d2l/valence/timestamp_error.rb', line 13

def server_skew
  return 0 if server_time_in_seconds.nil?

  @server_skew ||= server_time_in_seconds - now_in_seconds
end

#timestamp_out_of_range?Integer

Returns true if our timestamp is out of range with the D2L Server.

Returns:

  • (Integer)

    true if our timestamp is out of range with the D2L Server



20
21
22
# File 'lib/d2l/valence/timestamp_error.rb', line 20

def timestamp_out_of_range?
  server_time_in_seconds != nil
end