Class: Gonebusy::UpdateBookingByIdBody

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/update_booking_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(date = nil, date_recurs_by = nil, days = nil, duration = nil, end_date = nil, frequency = nil, occurrence = nil, recurs_by = nil, time = nil, update_recurring = nil) ⇒ UpdateBookingByIdBody

Returns a new instance of UpdateBookingByIdBody.



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_booking_by_id_body.rb', line 63

def initialize(date = nil,
               date_recurs_by = nil,
               days = nil,
               duration = nil,
               end_date = nil,
               frequency = nil,
               occurrence = nil,
               recurs_by = nil,
               time = nil,
               update_recurring = nil)
  @date = date
  @date_recurs_by = date_recurs_by
  @days = days
  @duration = duration
  @end_date = end_date
  @frequency = frequency
  @occurrence = occurrence
  @recurs_by = recurs_by
  @time = time
  @update_recurring = update_recurring
end

Instance Attribute Details

#dateDate

New date of booking. If a recurring booking, must be a date of an instance. Several formats are supported: ‘2014-10-31’, ‘October 31, 2014’

Returns:

  • (Date)


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

def date
  @date
end

#date_recurs_byDateRecursByEnum

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

Returns:



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

def date_recurs_by
  @date_recurs_by
end

#daysString

List of comma-separated days of the week this Booking falls on. Useful for recurring Bookings. If provided, at least one must be specified.

Returns:



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

def days
  @days
end

#durationInteger

New length of time, in minutes, for the desired booking - if Service allows requesting a variable amount of time

Returns:

  • (Integer)


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

def duration
  @duration
end

#end_dateDate

New end date of a recurring booking. If recurring, leave blank for infinite booking. Several formats are supported: ‘2014-10-31’, ‘October 31, 2014’.

Returns:

  • (Date)


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

def end_date
  @end_date
end

#frequencyFrequencyEnum

Optional frequency of recurrence as specified by :recurs_by. E.g, :single, :every, :every_other, etc.

Returns:



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

def frequency
  @frequency
end

#occurrenceOccurrenceEnum

Optional occurrence of frequency. E.g, :first, :2nd, :last, :2nd_to_last, etc.

Returns:



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

def occurrence
  @occurrence
end

#recurs_byRecursByEnum

One of the possible recurrence values.

Returns:



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

def recurs_by
  @recurs_by
end

#timeString

New time of booking. Several formats are supported: ‘9am’, ‘09:00’, ‘9:00’, ‘0900’

Returns:



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

def time
  @time
end

#update_recurringString

When a recurring booking, one of: [‘instance’, ‘all’, ‘infinite’]

Returns:



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

def update_recurring
  @update_recurring
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
113
114
# File 'lib/gonebusy/models/update_booking_by_id_body.rb', line 86

def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash
    date = hash['date']
    date_recurs_by = hash['date_recurs_by']
    days = hash['days']
    duration = hash['duration']
    end_date = hash['end_date']
    frequency = hash['frequency']
    occurrence = hash['occurrence']
    recurs_by = hash['recurs_by']
    time = hash['time']
    update_recurring = hash['update_recurring']

    # Create object from extracted values
    UpdateBookingByIdBody.new(date,
                              date_recurs_by,
                              days,
                              duration,
                              end_date,
                              frequency,
                              occurrence,
                              recurs_by,
                              time,
                              update_recurring)
  end
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_booking_by_id_body.rb', line 46

def self.names
  if @hash.nil?
    @hash = {}
    @hash["date"] = "date"
    @hash["date_recurs_by"] = "date_recurs_by"
    @hash["days"] = "days"
    @hash["duration"] = "duration"
    @hash["end_date"] = "end_date"
    @hash["frequency"] = "frequency"
    @hash["occurrence"] = "occurrence"
    @hash["recurs_by"] = "recurs_by"
    @hash["time"] = "time"
    @hash["update_recurring"] = "update_recurring"
  end
  @hash
end