Class: Gonebusy::CreateBookingBody
- Defined in:
- lib/gonebusy/models/create_booking_body.rb
Instance Attribute Summary collapse
-
#date ⇒ String
Desired date of booking.
-
#duration ⇒ Integer
Length of time, in minutes, for the desired booking - if Service allows requesting a variable amount of time.
-
#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, duration = 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, duration = nil, resource_id = nil, user_id = nil) ⇒ CreateBookingBody
Returns a new instance of CreateBookingBody.
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 43 def initialize(date = nil, service_id = nil, time = nil, duration = nil, resource_id = nil, user_id = nil) @date = date @service_id = service_id @time = time @duration = duration @resource_id = resource_id @user_id = user_id end |
Instance Attribute Details
#date ⇒ String
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 |
#duration ⇒ Integer
Length of time, in minutes, for the desired booking - if Service allows requesting a variable amount of time
19 20 21 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 19 def duration @duration end |
#resource_id ⇒ Integer
ID of a Resource to be booked. If not provided, the first available Resource will be booked.
23 24 25 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 23 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.
27 28 29 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 27 def user_id @user_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 58 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"] duration = hash["duration"] resource_id = hash["resource_id"] user_id = hash["user_id"] # Create object from extracted values CreateBookingBody.new(date, service_id, time, duration, resource_id, user_id) end end |
.names ⇒ Object
A mapping from model property names to API property names
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gonebusy/models/create_booking_body.rb', line 30 def self.names if @hash.nil? @hash = {} @hash["date"] = "date" @hash["service_id"] = "service_id" @hash["time"] = "time" @hash["duration"] = "duration" @hash["resource_id"] = "resource_id" @hash["user_id"] = "user_id" end @hash end |