Class: Gonebusy::UpdateScheduleTimeWindowByIdBody

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/update_schedule_time_window_by_id_body.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(start_date = nil, end_date = nil, start_time = nil, end_time = nil, total_minutes = nil, days = nil, recurs_by = nil, frequency = nil, occurrence = nil, date_recurs_by = nil) ⇒ UpdateScheduleTimeWindowByIdBody

Returns a new instance of UpdateScheduleTimeWindowByIdBody.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 63

def initialize(start_date = nil,
               end_date = nil,
               start_time = nil,
               end_time = nil,
               total_minutes = nil,
               days = nil,
               recurs_by = nil,
               frequency = nil,
               occurrence = nil,
               date_recurs_by = nil)
  @start_date = start_date
  @end_date = end_date
  @start_time = start_time
  @end_time = end_time
  @total_minutes = total_minutes
  @days = days
  @recurs_by = recurs_by
  @frequency = frequency
  @occurrence = occurrence
  @date_recurs_by = date_recurs_by
end

Instance Attribute Details

#date_recurs_byDateRecursByEnum

Required only when :recurs_by is ‘monthly’ or ‘yearly’ to differentiate between exact date or ‘day in month/year’. See Schedule examples.

Returns:



43
44
45
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 43

def date_recurs_by
  @date_recurs_by
end

#daysString

List of comma-separated days of the week this window of time falls on. If provided, at least one must be specified.

Returns:



27
28
29
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 27

def days
  @days
end

#end_dateDate

End Date of TimeWindow, leave blank for infinitely available. Several formats are supported: ‘2014-10-31’, ‘October 31, 2014’.

Returns:

  • (Date)


11
12
13
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 11

def end_date
  @end_date
end

#end_timeString

End Time of first TimeWindow. Several formats are supported: ‘5pm’, ‘17:00’, ‘1700’

Returns:



19
20
21
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 19

def end_time
  @end_time
end

#frequencyFrequencyEnum

Optional frequency of recurrence as specified by :recurs_by. E.g, :single, :every, :every_other, etc. If not provided, assumed to be :every

Returns:



35
36
37
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 35

def frequency
  @frequency
end

#occurrenceOccurrenceEnum

Optional occurrence of frequency. E.g, :first, :2nd, :last, :2nd_to_last, etc. If not provided, assumed to be :every. See Schedule examples.

Returns:



39
40
41
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 39

def occurrence
  @occurrence
end

#recurs_byRecursByEnum

One of the possible recurrence values

Returns:



31
32
33
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 31

def recurs_by
  @recurs_by
end

#start_dateDate

Start Date of TimeWindow. Several formats are supported: ‘2014-10-31’, ‘October 31, 2014’.

Returns:

  • (Date)


7
8
9
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 7

def start_date
  @start_date
end

#start_timeString

Start Time of first TimeWindow. Several formats are supported: ‘9am’, ‘09:00’, ‘9:00’, ‘0900’

Returns:



15
16
17
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 15

def start_time
  @start_time
end

#total_minutesInteger

Optional total number of minutes in TimeWindow. Useful when duration of window is greater than 24 hours.

Returns:

  • (Integer)


23
24
25
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 23

def total_minutes
  @total_minutes
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash
  start_date = hash['start_date']
  end_date = hash['end_date']
  start_time = hash['start_time']
  end_time = hash['end_time']
  total_minutes = hash['total_minutes']
  days = hash['days']
  recurs_by = hash['recurs_by']
  frequency = hash['frequency']
  occurrence = hash['occurrence']
  date_recurs_by = hash['date_recurs_by']

  # Create object from extracted values
  UpdateScheduleTimeWindowByIdBody.new(start_date,
                                       end_date,
                                       start_time,
                                       end_time,
                                       total_minutes,
                                       days,
                                       recurs_by,
                                       frequency,
                                       occurrence,
                                       date_recurs_by)
end

.namesObject

A mapping from model property names to API property names



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/gonebusy/models/update_schedule_time_window_by_id_body.rb', line 46

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash["start_date"] = "start_date"
    @_hash["end_date"] = "end_date"
    @_hash["start_time"] = "start_time"
    @_hash["end_time"] = "end_time"
    @_hash["total_minutes"] = "total_minutes"
    @_hash["days"] = "days"
    @_hash["recurs_by"] = "recurs_by"
    @_hash["frequency"] = "frequency"
    @_hash["occurrence"] = "occurrence"
    @_hash["date_recurs_by"] = "date_recurs_by"
  end
  @_hash
end