gonebusy-ruby-client 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -68
  3. data/lib/gonebusy/api_helper.rb +181 -149
  4. data/lib/gonebusy/configuration.rb +51 -16
  5. data/lib/gonebusy/controllers/base_controller.rb +46 -45
  6. data/lib/gonebusy/controllers/bookings_controller.rb +257 -293
  7. data/lib/gonebusy/controllers/categories_controller.rb +151 -180
  8. data/lib/gonebusy/controllers/pricing_models_controller.rb +202 -241
  9. data/lib/gonebusy/controllers/resources_controller.rb +295 -355
  10. data/lib/gonebusy/controllers/schedules_controller.rb +361 -428
  11. data/lib/gonebusy/controllers/search_controller.rb +52 -63
  12. data/lib/gonebusy/controllers/services_controller.rb +310 -367
  13. data/lib/gonebusy/controllers/users_controller.rb +199 -239
  14. data/lib/gonebusy/exceptions/api_exception.rb +16 -16
  15. data/lib/gonebusy/exceptions/entities_error_error_exception.rb +27 -0
  16. data/lib/gonebusy/exceptions/entities_error_exception.rb +26 -26
  17. data/lib/gonebusy/gonebusy_client.rb +58 -58
  18. data/lib/gonebusy/http/auth/custom_auth.rb +15 -15
  19. data/lib/gonebusy/http/faraday_client.rb +43 -41
  20. data/lib/gonebusy/http/http_call_back.rb +17 -17
  21. data/lib/gonebusy/http/http_client.rb +84 -82
  22. data/lib/gonebusy/http/http_context.rb +15 -15
  23. data/lib/gonebusy/http/http_method_enum.rb +7 -7
  24. data/lib/gonebusy/http/http_request.rb +44 -44
  25. data/lib/gonebusy/http/http_response.rb +19 -19
  26. data/lib/gonebusy/models/base_model.rb +31 -31
  27. data/lib/gonebusy/models/cancel_booking_by_id_response.rb +35 -35
  28. data/lib/gonebusy/models/create_booking_body.rb +134 -80
  29. data/lib/gonebusy/models/create_booking_response.rb +35 -35
  30. data/lib/gonebusy/models/create_category_body.rb +71 -71
  31. data/lib/gonebusy/models/create_category_response.rb +35 -35
  32. data/lib/gonebusy/models/create_pricing_model_body.rb +80 -80
  33. data/lib/gonebusy/models/create_pricing_model_response.rb +35 -35
  34. data/lib/gonebusy/models/create_resource_body.rb +89 -89
  35. data/lib/gonebusy/models/create_resource_response.rb +35 -35
  36. data/lib/gonebusy/models/create_schedule_body.rb +143 -144
  37. data/lib/gonebusy/models/create_schedule_response.rb +35 -35
  38. data/lib/gonebusy/models/create_schedule_time_window_body.rb +116 -117
  39. data/lib/gonebusy/models/create_schedule_time_window_response.rb +35 -35
  40. data/lib/gonebusy/models/create_service_body.rb +107 -107
  41. data/lib/gonebusy/models/create_service_response.rb +35 -35
  42. data/lib/gonebusy/models/create_user_body.rb +89 -89
  43. data/lib/gonebusy/models/create_user_response.rb +35 -35
  44. data/lib/gonebusy/models/date_recurs_by_enum.rb +12 -12
  45. data/lib/gonebusy/models/delete_resource_by_id_response.rb +35 -35
  46. data/lib/gonebusy/models/delete_schedule_by_id_response.rb +35 -35
  47. data/lib/gonebusy/models/delete_schedule_time_window_by_id_response.rb +35 -35
  48. data/lib/gonebusy/models/delete_service_by_id_response.rb +35 -35
  49. data/lib/gonebusy/models/entities_address_entity.rb +116 -116
  50. data/lib/gonebusy/models/entities_availability_response.rb +58 -58
  51. data/lib/gonebusy/models/entities_booking_response.rb +71 -71
  52. data/lib/gonebusy/models/entities_category_response.rb +98 -98
  53. data/lib/gonebusy/models/entities_pricing_model_response.rb +89 -89
  54. data/lib/gonebusy/models/entities_resource_availabilities.rb +49 -49
  55. data/lib/gonebusy/models/entities_resource_response.rb +107 -107
  56. data/lib/gonebusy/models/entities_schedule_response.rb +76 -76
  57. data/lib/gonebusy/models/entities_search_response.rb +54 -54
  58. data/lib/gonebusy/models/entities_service_response.rb +134 -130
  59. data/lib/gonebusy/models/entities_slots.rb +44 -45
  60. data/lib/gonebusy/models/entities_thing_type_response.rb +44 -44
  61. data/lib/gonebusy/models/entities_time_window_response.rb +134 -135
  62. data/lib/gonebusy/models/entities_user_response.rb +152 -152
  63. data/lib/gonebusy/models/frequency_enum.rb +17 -17
  64. data/lib/gonebusy/models/gender_enum.rb +9 -9
  65. data/lib/gonebusy/models/get_booking_by_id_response.rb +35 -35
  66. data/lib/gonebusy/models/get_bookings_response.rb +40 -40
  67. data/lib/gonebusy/models/get_categories_response.rb +40 -40
  68. data/lib/gonebusy/models/get_category_by_id_response.rb +35 -35
  69. data/lib/gonebusy/models/get_pricing_model_by_id_response.rb +35 -35
  70. data/lib/gonebusy/models/get_pricing_models_response.rb +40 -40
  71. data/lib/gonebusy/models/get_resource_by_id_response.rb +35 -35
  72. data/lib/gonebusy/models/get_resource_things_response.rb +40 -40
  73. data/lib/gonebusy/models/get_resources_response.rb +40 -40
  74. data/lib/gonebusy/models/get_schedule_by_id_response.rb +35 -35
  75. data/lib/gonebusy/models/get_schedules_response.rb +40 -40
  76. data/lib/gonebusy/models/get_service_available_slots_by_id_response.rb +35 -35
  77. data/lib/gonebusy/models/get_service_by_id_response.rb +35 -35
  78. data/lib/gonebusy/models/get_services_response.rb +40 -40
  79. data/lib/gonebusy/models/get_user_by_id_response.rb +35 -35
  80. data/lib/gonebusy/models/get_users_response.rb +40 -40
  81. data/lib/gonebusy/models/occurrence_enum.rb +21 -21
  82. data/lib/gonebusy/models/recurs_by_enum.rb +15 -15
  83. data/lib/gonebusy/models/search_query_response.rb +35 -35
  84. data/lib/gonebusy/models/update_booking_by_id_body.rb +116 -0
  85. data/lib/gonebusy/models/update_booking_by_id_response.rb +35 -35
  86. data/lib/gonebusy/models/update_pricing_model_by_id_body.rb +62 -62
  87. data/lib/gonebusy/models/update_pricing_model_by_id_response.rb +35 -35
  88. data/lib/gonebusy/models/update_resource_by_id_body.rb +71 -71
  89. data/lib/gonebusy/models/update_resource_by_id_response.rb +35 -35
  90. data/lib/gonebusy/models/update_schedule_time_window_by_id_body.rb +116 -117
  91. data/lib/gonebusy/models/update_schedule_time_window_by_id_response.rb +35 -35
  92. data/lib/gonebusy/models/update_service_by_id_body.rb +98 -98
  93. data/lib/gonebusy/models/update_service_by_id_response.rb +35 -35
  94. data/lib/gonebusy/models/update_user_by_id_body.rb +89 -89
  95. data/lib/gonebusy/models/update_user_by_id_response.rb +35 -35
  96. data/lib/gonebusy.rb +108 -104
  97. metadata +53 -17
@@ -1,15 +1,15 @@
1
- # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
-
3
- module Gonebusy
4
- class HttpContext
5
- attr_accessor :request, :response
6
-
7
- # The constructor.
8
- # @param [HttpRequest] An HttpRequest object representing the HTTP request.
9
- # @param [HttpResponse] An HttpResponse object representing the HTTP response.
10
- def initialize(request, response)
11
- @request = request
12
- @response = response
13
- end
14
- end
15
- end
1
+ # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class HttpContext
5
+ attr_accessor :request, :response
6
+
7
+ # The constructor.
8
+ # @param [HttpRequest] An HttpRequest object representing the HTTP request.
9
+ # @param [HttpResponse] An HttpResponse object representing the HTTP response.
10
+ def initialize(request, response)
11
+ @request = request
12
+ @response = response
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,7 @@
1
- # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
-
3
- module Gonebusy
4
- class HttpMethodEnum
5
- HTTPMETHODENUM = [GET = "GET", POST = "POST", PUT = "PUT", PATCH = "PATCH", DELETE = "DELETE"]
6
- end
7
- end
1
+ # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class HttpMethodEnum
5
+ HTTPMETHODENUM = [GET = 'GET', POST = 'POST', PUT = 'PUT', PATCH = 'PATCH', DELETE = 'DELETE']
6
+ end
7
+ end
@@ -1,44 +1,44 @@
1
- # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
-
3
- module Gonebusy
4
- class HttpRequest
5
- attr_accessor :http_method, :query_url, :headers, :parameters, :username, :password
6
-
7
- # The constructor.
8
- # @param [HttpMethodEnum] The HTTP method.
9
- # @param [String] The URL to send the request to.
10
- # @param [Hash, Optional] The headers for the HTTP Request.
11
- # @param [Hash, Optional] The parameters for the HTTP Request.
12
- def initialize(http_method,
13
- query_url,
14
- headers: {},
15
- parameters: {})
16
- @http_method = http_method
17
- @query_url = query_url
18
- @headers = headers
19
- @parameters = parameters
20
- end
21
-
22
- # Add a header to the HttpRequest.
23
- # @param [String] The name of the header.
24
- # @param [String] The value of the header.
25
- def add_header(name, value)
26
- @headers[name] = value
27
- end
28
-
29
- # Add a parameter to the HttpRequest.
30
- # @param [String] The name of the parameter.
31
- # @param [String] The value of the parameter.
32
- def add_parameter(name, value)
33
- @parameters[name] = value
34
- end
35
-
36
- # Add a query parameter to the HttpRequest.
37
- # @param [String] The name of the query parameter.
38
- # @param [String] The value of the query parameter.
39
- def add_query_parameter(name, value)
40
- @query_url = APIHelper.append_url_with_query_parameters(@query_url, {name => value})
41
- @query_url = APIHelper.clean_url(@query_url)
42
- end
43
- end
44
- end
1
+ # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class HttpRequest
5
+ attr_accessor :http_method, :query_url, :headers, :parameters, :username, :password
6
+
7
+ # The constructor.
8
+ # @param [HttpMethodEnum] The HTTP method.
9
+ # @param [String] The URL to send the request to.
10
+ # @param [Hash, Optional] The headers for the HTTP Request.
11
+ # @param [Hash, Optional] The parameters for the HTTP Request.
12
+ def initialize(http_method,
13
+ query_url,
14
+ headers: {},
15
+ parameters: {})
16
+ @http_method = http_method
17
+ @query_url = query_url
18
+ @headers = headers
19
+ @parameters = parameters
20
+ end
21
+
22
+ # Add a header to the HttpRequest.
23
+ # @param [String] The name of the header.
24
+ # @param [String] The value of the header.
25
+ def add_header(name, value)
26
+ @headers[name] = value
27
+ end
28
+
29
+ # Add a parameter to the HttpRequest.
30
+ # @param [String] The name of the parameter.
31
+ # @param [String] The value of the parameter.
32
+ def add_parameter(name, value)
33
+ @parameters[name] = value
34
+ end
35
+
36
+ # Add a query parameter to the HttpRequest.
37
+ # @param [String] The name of the query parameter.
38
+ # @param [String] The value of the query parameter.
39
+ def add_query_parameter(name, value)
40
+ @query_url = APIHelper.append_url_with_query_parameters(@query_url, name => value)
41
+ @query_url = APIHelper.clean_url(@query_url)
42
+ end
43
+ end
44
+ end
@@ -1,19 +1,19 @@
1
- # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
-
3
- module Gonebusy
4
- class HttpResponse
5
- attr_accessor :status_code, :headers, :raw_body
6
-
7
- # The constructor.
8
- # @param [Integer] The status code returned by the server.
9
- # @param [Hash] The headers sent by the server in the response.
10
- # @param [String] The raw body of the response.
11
- def initialize(status_code,
12
- headers,
13
- raw_body)
14
- @status_code = status_code
15
- @headers = headers
16
- @raw_body = raw_body
17
- end
18
- end
19
- end
1
+ # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class HttpResponse
5
+ attr_accessor :status_code, :headers, :raw_body
6
+
7
+ # The constructor
8
+ # @param [Integer] The status code returned by the server.
9
+ # @param [Hash] The headers sent by the server in the response.
10
+ # @param [String] The raw body of the response.
11
+ def initialize(status_code,
12
+ headers,
13
+ raw_body)
14
+ @status_code = status_code
15
+ @headers = headers
16
+ @raw_body = raw_body
17
+ end
18
+ end
19
+ end
@@ -1,32 +1,32 @@
1
- # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
-
3
- module Gonebusy
4
- class BaseModel
5
- # Returns a Hash representation of the current object
6
- def to_hash
7
- hash = {}
8
- self.instance_variables.each do |name|
9
- value = self.instance_variable_get(name)
10
- name = name[1..-1]
11
- key = self.class.names.key?(name) ? self.class.names[name] : name
12
- if value.instance_of? Array
13
- hash[key] = value.map{|v| v.kind_of?(BaseModel) ? v.to_hash : v}
14
- elsif value.instance_of? Hash
15
- hash[key] = {}
16
- value.each do |k, v|
17
- hash[key][k] = v.kind_of?(BaseModel) ? v.to_hash : v
18
- end
19
- else
20
- hash[key] = value.kind_of?(BaseModel) ? value.to_hash : value
21
- end
22
- end
23
- hash
24
- end
25
-
26
- # Returns a JSON representation of the curent object
27
- def to_json(options = {})
28
- hash = to_hash
29
- hash.to_json(options)
30
- end
31
- end
1
+ # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class BaseModel
5
+ # Returns a Hash representation of the current object
6
+ def to_hash
7
+ hash = {}
8
+ self.instance_variables.each do |name|
9
+ value = self.instance_variable_get(name)
10
+ name = name[1..-1]
11
+ key = self.class.names.key?(name) ? self.class.names[name] : name
12
+ if value.instance_of? Array
13
+ hash[key] = value.map{|v| v.kind_of?(BaseModel) ? v.to_hash : v}
14
+ elsif value.instance_of? Hash
15
+ hash[key] = {}
16
+ value.each do |k, v|
17
+ hash[key][k] = v.kind_of?(BaseModel) ? v.to_hash : v
18
+ end
19
+ else
20
+ hash[key] = value.kind_of?(BaseModel) ? value.to_hash : value
21
+ end
22
+ end
23
+ hash
24
+ end
25
+
26
+ # Returns a JSON representation of the curent object
27
+ def to_json(options = {})
28
+ hash = to_hash
29
+ hash.to_json(options)
30
+ end
31
+ end
32
32
  end
@@ -1,35 +1,35 @@
1
- # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
-
3
- module Gonebusy
4
- class CancelBookingByIdResponse < BaseModel
5
- # TODO: Write general description for this method
6
- # @return [EntitiesBookingResponse]
7
- attr_accessor :booking
8
-
9
- # A mapping from model property names to API property names
10
- def self.names
11
- if @hash.nil?
12
- @hash = {}
13
- @hash["booking"] = "booking"
14
- end
15
- @hash
16
- end
17
-
18
- def initialize(booking = nil)
19
- @booking = booking
20
- end
21
-
22
- # Creates an instance of the object from a hash
23
- def self.from_hash(hash)
24
- if hash == nil
25
- nil
26
- else
27
- # Extract variables from the hash
28
- booking = EntitiesBookingResponse.from_hash(hash["booking"]) if hash["booking"]
29
-
30
- # Create object from extracted values
31
- CancelBookingByIdResponse.new(booking)
32
- end
33
- end
34
- end
35
- end
1
+ # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class CancelBookingByIdResponse < BaseModel
5
+ # TODO: Write general description for this method
6
+ # @return [EntitiesBookingResponse]
7
+ attr_accessor :booking
8
+
9
+ # A mapping from model property names to API property names
10
+ def self.names
11
+ if @hash.nil?
12
+ @hash = {}
13
+ @hash["booking"] = "booking"
14
+ end
15
+ @hash
16
+ end
17
+
18
+ def initialize(booking = nil)
19
+ @booking = booking
20
+ end
21
+
22
+ # Creates an instance of the object from a hash
23
+ def self.from_hash(hash)
24
+ if hash == nil
25
+ nil
26
+ else
27
+ # Extract variables from the hash
28
+ booking = EntitiesBookingResponse.from_hash(hash['booking']) if hash['booking']
29
+
30
+ # Create object from extracted values
31
+ CancelBookingByIdResponse.new(booking)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,80 +1,134 @@
1
- # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
-
3
- module Gonebusy
4
- class CreateBookingBody < BaseModel
5
- # Desired date of booking. Several formats are supported: "2014-10-31", "October 31, 2014"
6
- # @return [String]
7
- attr_accessor :date
8
-
9
- # ID of Service being booked
10
- # @return [Integer]
11
- attr_accessor :service_id
12
-
13
- # Desired time of booking. Several formats are supported: '9am', '09:00', '9:00', '0900'
14
- # @return [String]
15
- attr_accessor :time
16
-
17
- # Length of time, in minutes, for the desired booking - if Service allows requesting a variable amount of time
18
- # @return [Integer]
19
- attr_accessor :duration
20
-
21
- # ID of a Resource to be booked. If not provided, the first available Resource will be booked.
22
- # @return [Integer]
23
- attr_accessor :resource_id
24
-
25
- # Create a booking for this User Id. You must be authorized to manage this User Id.
26
- # @return [Integer]
27
- attr_accessor :user_id
28
-
29
- # A mapping from model property names to API property names
30
- def self.names
31
- if @hash.nil?
32
- @hash = {}
33
- @hash["date"] = "date"
34
- @hash["service_id"] = "service_id"
35
- @hash["time"] = "time"
36
- @hash["duration"] = "duration"
37
- @hash["resource_id"] = "resource_id"
38
- @hash["user_id"] = "user_id"
39
- end
40
- @hash
41
- end
42
-
43
- def initialize(date = nil,
44
- service_id = nil,
45
- time = nil,
46
- duration = nil,
47
- resource_id = nil,
48
- user_id = nil)
49
- @date = date
50
- @service_id = service_id
51
- @time = time
52
- @duration = duration
53
- @resource_id = resource_id
54
- @user_id = user_id
55
- end
56
-
57
- # Creates an instance of the object from a hash
58
- def self.from_hash(hash)
59
- if hash == nil
60
- nil
61
- else
62
- # Extract variables from the hash
63
- date = hash["date"]
64
- service_id = hash["service_id"]
65
- time = hash["time"]
66
- duration = hash["duration"]
67
- resource_id = hash["resource_id"]
68
- user_id = hash["user_id"]
69
-
70
- # Create object from extracted values
71
- CreateBookingBody.new(date,
72
- service_id,
73
- time,
74
- duration,
75
- resource_id,
76
- user_id)
77
- end
78
- end
79
- end
80
- end
1
+ # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class CreateBookingBody < BaseModel
5
+ # Desired date of booking. Several formats are supported: "2014-10-31", "October 31, 2014"
6
+ # @return [Date]
7
+ attr_accessor :date
8
+
9
+ # ID of Service being booked
10
+ # @return [Integer]
11
+ attr_accessor :service_id
12
+
13
+ # Desired time of booking. Several formats are supported: '9am', '09:00', '9:00', '0900'
14
+ # @return [String]
15
+ attr_accessor :time
16
+
17
+ # Required only when :recurs_by is 'monthly' or 'yearly' to differentiate between exact date or 'day in month/year'. See Recurring Booking examples.
18
+ # @return [DateRecursByEnum]
19
+ attr_accessor :date_recurs_by
20
+
21
+ # List of comma-separated days of the week this Booking falls on. Useful for recurring Bookings. If provided, at least one must be specified.
22
+ # @return [String]
23
+ attr_accessor :days
24
+
25
+ # Length of time, in minutes, for the desired booking - if Service allows requesting a variable amount of time
26
+ # @return [Integer]
27
+ attr_accessor :duration
28
+
29
+ # 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'.
30
+ # @return [Date]
31
+ attr_accessor :end_date
32
+
33
+ # Optional frequency of recurrence as specified by :recurs_by. E.g, :single, :every, :every_other, etc. If not provided, assumed to be :once
34
+ # @return [FrequencyEnum]
35
+ attr_accessor :frequency
36
+
37
+ # Optional occurrence of frequency. E.g, :first, :2nd, :last, :2nd_to_last, etc. If not provided, assumed to be :every
38
+ # @return [OccurrenceEnum]
39
+ attr_accessor :occurrence
40
+
41
+ # One of the possible recurrence values. If not provided, assumed to be :once to indicate a single Booking.
42
+ # @return [RecursByEnum]
43
+ attr_accessor :recurs_by
44
+
45
+ # ID of a Resource to be booked. If not provided, the first available Resource will be booked.
46
+ # @return [Integer]
47
+ attr_accessor :resource_id
48
+
49
+ # Create a booking for this User Id. You must be authorized to manage this User Id.
50
+ # @return [Integer]
51
+ attr_accessor :user_id
52
+
53
+ # A mapping from model property names to API property names
54
+ def self.names
55
+ if @hash.nil?
56
+ @hash = {}
57
+ @hash["date"] = "date"
58
+ @hash["service_id"] = "service_id"
59
+ @hash["time"] = "time"
60
+ @hash["date_recurs_by"] = "date_recurs_by"
61
+ @hash["days"] = "days"
62
+ @hash["duration"] = "duration"
63
+ @hash["end_date"] = "end_date"
64
+ @hash["frequency"] = "frequency"
65
+ @hash["occurrence"] = "occurrence"
66
+ @hash["recurs_by"] = "recurs_by"
67
+ @hash["resource_id"] = "resource_id"
68
+ @hash["user_id"] = "user_id"
69
+ end
70
+ @hash
71
+ end
72
+
73
+ def initialize(date = nil,
74
+ service_id = nil,
75
+ time = nil,
76
+ date_recurs_by = nil,
77
+ days = nil,
78
+ duration = nil,
79
+ end_date = nil,
80
+ frequency = nil,
81
+ occurrence = nil,
82
+ recurs_by = nil,
83
+ resource_id = nil,
84
+ user_id = nil)
85
+ @date = date
86
+ @service_id = service_id
87
+ @time = time
88
+ @date_recurs_by = date_recurs_by
89
+ @days = days
90
+ @duration = duration
91
+ @end_date = end_date
92
+ @frequency = frequency
93
+ @occurrence = occurrence
94
+ @recurs_by = recurs_by
95
+ @resource_id = resource_id
96
+ @user_id = user_id
97
+ end
98
+
99
+ # Creates an instance of the object from a hash
100
+ def self.from_hash(hash)
101
+ if hash == nil
102
+ nil
103
+ else
104
+ # Extract variables from the hash
105
+ date = hash['date']
106
+ service_id = hash['service_id']
107
+ time = hash['time']
108
+ date_recurs_by = hash['date_recurs_by']
109
+ days = hash['days']
110
+ duration = hash['duration']
111
+ end_date = hash['end_date']
112
+ frequency = hash['frequency']
113
+ occurrence = hash['occurrence']
114
+ recurs_by = hash['recurs_by']
115
+ resource_id = hash['resource_id']
116
+ user_id = hash['user_id']
117
+
118
+ # Create object from extracted values
119
+ CreateBookingBody.new(date,
120
+ service_id,
121
+ time,
122
+ date_recurs_by,
123
+ days,
124
+ duration,
125
+ end_date,
126
+ frequency,
127
+ occurrence,
128
+ recurs_by,
129
+ resource_id,
130
+ user_id)
131
+ end
132
+ end
133
+ end
134
+ end