Class: Gonebusy::CreateBookingBody
- Defined in:
- lib/gonebusy/models/create_booking_body.rb
Instance Attribute Summary collapse
-
#date ⇒ Date
Desired date of booking.
-
#date_recurs_by ⇒ DateRecursByEnum
Required only when :recurs_by is ‘monthly’ or ‘yearly’ to differentiate between exact date or ‘day in month/year’.
-
#days ⇒ String
List of comma-separated days of the week this Booking falls on.
-
#duration ⇒ Integer
Length of time, in minutes, for the desired booking - if Service allows requesting a variable amount of time.
-
#end_date ⇒ Date
Optional end date if a recurring booking - i.e, :recurs_by other than :once.
-
#frequency ⇒ FrequencyEnum
Optional frequency of recurrence as specified by :recurs_by.
-
#occurrence ⇒ OccurrenceEnum
Optional occurrence of frequency.
-
#recurs_by ⇒ RecursByEnum
One of the possible recurrence values.
-
#resource_id ⇒ Integer
ID of a Resource to be booked.
-
#service_id ⇒ Integer
ID of Service being booked.
-
#time ⇒ String
Desired time of booking.
-
#user_id ⇒ Integer
Create a booking for this User Id.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(date = nil, service_id = nil, time = nil, date_recurs_by = nil, days = nil, duration = nil, end_date = nil, frequency = nil, occurrence = nil, recurs_by = nil, resource_id = nil, user_id = nil) ⇒ CreateBookingBody
constructor
A new instance of CreateBookingBody.
Methods inherited from BaseModel
Constructor Details
#initialize(date = nil, service_id = nil, time = nil, date_recurs_by = nil, days = nil, duration = nil, end_date = nil, frequency = nil, occurrence = nil, recurs_by = nil, resource_id = nil, user_id = nil) ⇒ CreateBookingBody
Returns a new instance of CreateBookingBody.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 73 def initialize(date = nil, service_id = nil, time = nil, date_recurs_by = nil, days = nil, duration = nil, end_date = nil, frequency = nil, occurrence = nil, recurs_by = nil, resource_id = nil, user_id = nil) @date = date @service_id = service_id @time = time @date_recurs_by = date_recurs_by @days = days @duration = duration @end_date = end_date @frequency = frequency @occurrence = occurrence @recurs_by = recurs_by @resource_id = resource_id @user_id = user_id end |
Instance Attribute Details
#date ⇒ Date
Desired date of booking. Several formats are supported: “2014-10-31”, “October 31, 2014”
7 8 9 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 7 def date @date end |
#date_recurs_by ⇒ DateRecursByEnum
Required only when :recurs_by is ‘monthly’ or ‘yearly’ to differentiate between exact date or ‘day in month/year’. See Recurring Booking examples.
19 20 21 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 19 def date_recurs_by @date_recurs_by end |
#days ⇒ String
List of comma-separated days of the week this Booking falls on. Useful for recurring Bookings. If provided, at least one must be specified.
23 24 25 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 23 def days @days end |
#duration ⇒ Integer
Length of time, in minutes, for the desired booking - if Service allows requesting a variable amount of time
27 28 29 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 27 def duration @duration end |
#end_date ⇒ Date
Optional end date if a recurring booking - i.e, :recurs_by other than :once. If recurring, leave blank for infinite booking. Several formats are supported: ‘2014-10-31’, ‘October 31, 2014’.
31 32 33 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 31 def end_date @end_date end |
#frequency ⇒ FrequencyEnum
Optional frequency of recurrence as specified by :recurs_by. E.g, :single, :every, :every_other, etc. If not provided, assumed to be :once
35 36 37 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 35 def frequency @frequency end |
#occurrence ⇒ OccurrenceEnum
Optional occurrence of frequency. E.g, :first, :2nd, :last, :2nd_to_last, etc. If not provided, assumed to be :every
39 40 41 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 39 def occurrence @occurrence end |
#recurs_by ⇒ RecursByEnum
One of the possible recurrence values. If not provided, assumed to be :once to indicate a single Booking.
43 44 45 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 43 def recurs_by @recurs_by end |
#resource_id ⇒ Integer
ID of a Resource to be booked. If not provided, the first available Resource will be booked.
47 48 49 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 47 def resource_id @resource_id end |
#service_id ⇒ Integer
ID of Service being booked
11 12 13 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 11 def service_id @service_id end |
#time ⇒ String
Desired time of booking. Several formats are supported: ‘9am’, ‘09:00’, ‘9:00’, ‘0900’
15 16 17 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 15 def time @time end |
#user_id ⇒ Integer
Create a booking for this User Id. You must be authorized to manage this User Id.
51 52 53 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 51 def user_id @user_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 100 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash date = hash['date'] service_id = hash['service_id'] time = hash['time'] 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'] resource_id = hash['resource_id'] user_id = hash['user_id'] # Create object from extracted values CreateBookingBody.new(date, service_id, time, date_recurs_by, days, duration, end_date, frequency, occurrence, recurs_by, resource_id, user_id) end end |
.names ⇒ Object
A mapping from model property names to API property names
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 54 def self.names if @hash.nil? @hash = {} @hash["date"] = "date" @hash["service_id"] = "service_id" @hash["time"] = "time" @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["resource_id"] = "resource_id" @hash["user_id"] = "user_id" end @hash end |