Class: Nylas::When

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Model::Attributable
Defined in:
lib/nylas/when.rb

Overview

Structure to represent all the Nylas time types.

Instance Method Summary collapse

Methods included from Model::Attributable

#attributes, included, #initialize, #to_h

Instance Method Details

#as_timespanObject



29
30
31
32
33
# File 'lib/nylas/when.rb', line 29

def as_timespan
  return unless object == "timespan"

  Timespan.new(object: object, start_time: start_time, end_time: end_time)
end

#rangeObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/nylas/when.rb', line 35

def range
  case object
  when "timespan"
    Range.new(start_time, end_time)
  when "datespan"
    Range.new(start_date, end_date)
  when "date"
    Range.new(date, date)
  when "time"
    Range.new(time, time)
  end
end