gonebusy-ruby-client 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +1963 -0
  4. data/lib/gonebusy/api_helper.rb +149 -0
  5. data/lib/gonebusy/configuration.rb +16 -0
  6. data/lib/gonebusy/controllers/base_controller.rb +45 -0
  7. data/lib/gonebusy/controllers/bookings_controller.rb +298 -0
  8. data/lib/gonebusy/controllers/categories_controller.rb +180 -0
  9. data/lib/gonebusy/controllers/pricing_models_controller.rb +241 -0
  10. data/lib/gonebusy/controllers/resources_controller.rb +355 -0
  11. data/lib/gonebusy/controllers/schedules_controller.rb +426 -0
  12. data/lib/gonebusy/controllers/search_controller.rb +64 -0
  13. data/lib/gonebusy/controllers/services_controller.rb +367 -0
  14. data/lib/gonebusy/controllers/users_controller.rb +288 -0
  15. data/lib/gonebusy/exceptions/api_exception.rb +16 -0
  16. data/lib/gonebusy/exceptions/entities_error_exception.rb +27 -0
  17. data/lib/gonebusy/gonebusy_client.rb +58 -0
  18. data/lib/gonebusy/http/auth/custom_auth.rb +16 -0
  19. data/lib/gonebusy/http/faraday_client.rb +41 -0
  20. data/lib/gonebusy/http/http_call_back.rb +17 -0
  21. data/lib/gonebusy/http/http_client.rb +82 -0
  22. data/lib/gonebusy/http/http_context.rb +15 -0
  23. data/lib/gonebusy/http/http_method_enum.rb +7 -0
  24. data/lib/gonebusy/http/http_request.rb +44 -0
  25. data/lib/gonebusy/http/http_response.rb +19 -0
  26. data/lib/gonebusy/models/base_model.rb +32 -0
  27. data/lib/gonebusy/models/cancel_booking_by_id_response.rb +35 -0
  28. data/lib/gonebusy/models/create_booking_body.rb +80 -0
  29. data/lib/gonebusy/models/create_booking_response.rb +35 -0
  30. data/lib/gonebusy/models/create_category_body.rb +71 -0
  31. data/lib/gonebusy/models/create_category_response.rb +35 -0
  32. data/lib/gonebusy/models/create_pricing_model_body.rb +80 -0
  33. data/lib/gonebusy/models/create_pricing_model_response.rb +35 -0
  34. data/lib/gonebusy/models/create_resource_body.rb +89 -0
  35. data/lib/gonebusy/models/create_resource_response.rb +35 -0
  36. data/lib/gonebusy/models/create_schedule_body.rb +144 -0
  37. data/lib/gonebusy/models/create_schedule_response.rb +35 -0
  38. data/lib/gonebusy/models/create_schedule_time_window_body.rb +117 -0
  39. data/lib/gonebusy/models/create_schedule_time_window_response.rb +35 -0
  40. data/lib/gonebusy/models/create_service_body.rb +98 -0
  41. data/lib/gonebusy/models/create_service_response.rb +35 -0
  42. data/lib/gonebusy/models/create_user_body.rb +89 -0
  43. data/lib/gonebusy/models/create_user_response.rb +35 -0
  44. data/lib/gonebusy/models/date_recurs_by_enum.rb +13 -0
  45. data/lib/gonebusy/models/delete_resource_by_id_response.rb +35 -0
  46. data/lib/gonebusy/models/delete_schedule_by_id_response.rb +35 -0
  47. data/lib/gonebusy/models/delete_schedule_time_window_by_id_response.rb +35 -0
  48. data/lib/gonebusy/models/delete_service_by_id_response.rb +35 -0
  49. data/lib/gonebusy/models/entities_address_entity.rb +116 -0
  50. data/lib/gonebusy/models/entities_availability_response.rb +58 -0
  51. data/lib/gonebusy/models/entities_booking_response.rb +71 -0
  52. data/lib/gonebusy/models/entities_category_response.rb +98 -0
  53. data/lib/gonebusy/models/entities_pricing_model_response.rb +89 -0
  54. data/lib/gonebusy/models/entities_resource_availabilities.rb +49 -0
  55. data/lib/gonebusy/models/entities_resource_response.rb +98 -0
  56. data/lib/gonebusy/models/entities_schedule_response.rb +76 -0
  57. data/lib/gonebusy/models/entities_search_response.rb +54 -0
  58. data/lib/gonebusy/models/entities_service_response.rb +116 -0
  59. data/lib/gonebusy/models/entities_slots.rb +45 -0
  60. data/lib/gonebusy/models/entities_thing_type_response.rb +44 -0
  61. data/lib/gonebusy/models/entities_time_window_response.rb +135 -0
  62. data/lib/gonebusy/models/entities_user_response.rb +152 -0
  63. data/lib/gonebusy/models/frequency_enum.rb +18 -0
  64. data/lib/gonebusy/models/gender_enum.rb +10 -0
  65. data/lib/gonebusy/models/get_booking_by_id_response.rb +35 -0
  66. data/lib/gonebusy/models/get_bookings_response.rb +40 -0
  67. data/lib/gonebusy/models/get_categories_response.rb +40 -0
  68. data/lib/gonebusy/models/get_category_by_id_response.rb +35 -0
  69. data/lib/gonebusy/models/get_pricing_model_by_id_response.rb +35 -0
  70. data/lib/gonebusy/models/get_pricing_models_response.rb +40 -0
  71. data/lib/gonebusy/models/get_resource_by_id_response.rb +35 -0
  72. data/lib/gonebusy/models/get_resource_things_response.rb +40 -0
  73. data/lib/gonebusy/models/get_resources_response.rb +40 -0
  74. data/lib/gonebusy/models/get_schedule_by_id_response.rb +35 -0
  75. data/lib/gonebusy/models/get_schedules_response.rb +40 -0
  76. data/lib/gonebusy/models/get_service_available_slots_by_id_response.rb +35 -0
  77. data/lib/gonebusy/models/get_service_by_id_response.rb +35 -0
  78. data/lib/gonebusy/models/get_services_response.rb +40 -0
  79. data/lib/gonebusy/models/get_user_by_id_response.rb +35 -0
  80. data/lib/gonebusy/models/get_users_pros_response.rb +40 -0
  81. data/lib/gonebusy/models/get_users_response.rb +40 -0
  82. data/lib/gonebusy/models/occurrence_enum.rb +22 -0
  83. data/lib/gonebusy/models/recurs_by_enum.rb +16 -0
  84. data/lib/gonebusy/models/search_query_response.rb +35 -0
  85. data/lib/gonebusy/models/update_booking_by_id_response.rb +35 -0
  86. data/lib/gonebusy/models/update_pricing_model_by_id_body.rb +62 -0
  87. data/lib/gonebusy/models/update_pricing_model_by_id_response.rb +35 -0
  88. data/lib/gonebusy/models/update_resource_by_id_body.rb +71 -0
  89. data/lib/gonebusy/models/update_resource_by_id_response.rb +35 -0
  90. data/lib/gonebusy/models/update_schedule_time_window_by_id_body.rb +117 -0
  91. data/lib/gonebusy/models/update_schedule_time_window_by_id_response.rb +35 -0
  92. data/lib/gonebusy/models/update_service_by_id_body.rb +89 -0
  93. data/lib/gonebusy/models/update_service_by_id_response.rb +35 -0
  94. data/lib/gonebusy/models/update_user_by_id_body.rb +89 -0
  95. data/lib/gonebusy/models/update_user_by_id_response.rb +35 -0
  96. data/lib/gonebusy.rb +105 -0
  97. metadata +186 -0
@@ -0,0 +1,16 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class APIException < StandardError
5
+ attr_reader :context, :response_code
6
+
7
+ # The constructor.
8
+ # @param [String] The reason for raising an exception
9
+ # @param [HttpContext] The HttpContext of the API call.
10
+ def initialize(reason, context)
11
+ super(reason)
12
+ @context = context
13
+ @response_code = context.response.status_code
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,27 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class EntitiesErrorException < APIException
5
+ # description of error
6
+ # @return [String]
7
+ attr_accessor :message
8
+
9
+ # The constructor.
10
+ # @param [String] The reason for raising an exception
11
+ # @param [HttpContext] The HttpContext of the API call.
12
+ def initialize(reason, context)
13
+ super(reason, context)
14
+ begin
15
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
16
+ unbox(hash)
17
+ rescue TypeError
18
+ end
19
+ end
20
+
21
+ # Populates this object by extracting properties from a hash.
22
+ # @param [Hash] The deserialized response sent by the server in the response body.
23
+ def unbox(hash)
24
+ @message = hash["message"]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,58 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class GonebusyClient
5
+ # Singleton access to bookings controller
6
+ # @return [BookingsController] Returns the controller instance
7
+ def bookings
8
+ BookingsController.instance
9
+ end
10
+
11
+ # Singleton access to users controller
12
+ # @return [UsersController] Returns the controller instance
13
+ def users
14
+ UsersController.instance
15
+ end
16
+
17
+ # Singleton access to services controller
18
+ # @return [ServicesController] Returns the controller instance
19
+ def services
20
+ ServicesController.instance
21
+ end
22
+
23
+ # Singleton access to search controller
24
+ # @return [SearchController] Returns the controller instance
25
+ def search
26
+ SearchController.instance
27
+ end
28
+
29
+ # Singleton access to schedules controller
30
+ # @return [SchedulesController] Returns the controller instance
31
+ def schedules
32
+ SchedulesController.instance
33
+ end
34
+
35
+ # Singleton access to resources controller
36
+ # @return [ResourcesController] Returns the controller instance
37
+ def resources
38
+ ResourcesController.instance
39
+ end
40
+
41
+ # Singleton access to pricing_models controller
42
+ # @return [PricingModelsController] Returns the controller instance
43
+ def pricing_models
44
+ PricingModelsController.instance
45
+ end
46
+
47
+ # Singleton access to categories controller
48
+ # @return [CategoriesController] Returns the controller instance
49
+ def categories
50
+ CategoriesController.instance
51
+ end
52
+
53
+ # Initializer with authentication and configuration parameters
54
+ def initialize(authorization: 'Token <your API key>')
55
+ Configuration.authorization = authorization if authorization
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,16 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class CustomAuth
5
+ # Add custom authentication to the request.
6
+ # @param [HttpRequest] The HttpRequest object to which authentication will be added.
7
+ def self.apply(http_request)
8
+ # TODO: Add your custom authentication here
9
+ # The following properties are available to use
10
+ # Configuration.authorization
11
+ #
12
+ # Example:
13
+ # Add a header through: http_request.headers["key"] = "value"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,41 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class FaradayClient < HttpClient
5
+ # The constructor.
6
+ def initialize(timeout)
7
+ @connection = Faraday.new do |faraday|
8
+ faraday.request :multipart
9
+ faraday.request :url_encoded
10
+ faraday.ssl[:ca_file] = Certifi.where
11
+ faraday.adapter Faraday.default_adapter
12
+ faraday.options[:open_timeout] = timeout
13
+ end
14
+ end
15
+
16
+ # Method overridden from HttpClient.
17
+ def execute_as_string(http_request)
18
+ response = @connection.send(http_request.http_method.downcase, http_request.query_url) do |request|
19
+ request.headers = http_request.headers
20
+ request.body = http_request.parameters
21
+ end
22
+
23
+ return convert_response(response)
24
+ end
25
+
26
+ # Method overridden from HttpClient.
27
+ def execute_as_binary(http_request)
28
+ response = @connection.send(http_request.http_method.downcase, http_request.query_url) do |request|
29
+ request.headers = http_request.headers
30
+ request.body = http_request.parameters
31
+ end
32
+
33
+ return convert_response(response)
34
+ end
35
+
36
+ # Method overridden from HttpClient.
37
+ def convert_response(response)
38
+ return HttpResponse.new(response.status, response.headers, response.body)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,17 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class HttpCallBack
5
+ # A controller will call this method before making an HTTP Request.
6
+ # @param [HttpRequest] The HttpRequest object which the HttpClient will execute.
7
+ def on_before_request(http_request)
8
+ raise NotImplementedError, "This method needs to be implemented in a child class."
9
+ end
10
+
11
+ # A controller will call this method after making an HTTP Request.
12
+ # @param [HttpContext] The HttpContext of the API call.
13
+ def on_after_response(http_context)
14
+ raise NotImplementedError, "This method needs to be implemented in a child class."
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,82 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class HttpClient
5
+ # Execute an HttpRequest when the response is expected to be a string.
6
+ # @param [HttpRequest] The HttpRequest to be executed.
7
+ def execute_as_string(http_request)
8
+ raise NotImplementedError, "This method needs to be implemented in a child class."
9
+ end
10
+
11
+ # Execute an HttpRequest when the response is expected to be binary.
12
+ # @param [HttpRequest] The HttpRequest to be executed.
13
+ def execute_as_binary(http_request)
14
+ raise NotImplementedError, "This method needs to be implemented in a child class."
15
+ end
16
+
17
+ # Converts the HTTP Response from the client to an HttpResponse object.
18
+ # @param [Dynamic] The response object received from the client.
19
+ def convert_response(response)
20
+ raise NotImplementedError, "This method needs to be implemented in a child class."
21
+ end
22
+
23
+ # Get a GET HttpRequest object.
24
+ # @param [String] The URL to send the request to.
25
+ # @param [Hash, Optional] The headers for the HTTP Request.
26
+ def get(query_url,
27
+ headers: {})
28
+ return HttpRequest.new(HttpMethodEnum::GET,
29
+ query_url,
30
+ headers: headers)
31
+ end
32
+
33
+ # Get a POST HttpRequest object.
34
+ # @param [String] The URL to send the request to.
35
+ # @param [Hash, Optional] The headers for the HTTP Request.
36
+ # @param [Hash, Optional] The parameters for the HTTP Request.
37
+ def post(query_url,
38
+ headers: {},
39
+ parameters: {})
40
+ return HttpRequest.new(HttpMethodEnum::POST,
41
+ query_url,
42
+ headers: headers,
43
+ parameters: parameters)
44
+ end
45
+
46
+ # Get a PUT HttpRequest object.
47
+ # @param [String] The URL to send the request to.
48
+ # @param [Hash, Optional] The headers for the HTTP Request.
49
+ # @param [Hash, Optional] The parameters for the HTTP Request.
50
+ def put(query_url,
51
+ headers: {},
52
+ parameters: {})
53
+ return HttpRequest.new(HttpMethodEnum::PUT,
54
+ query_url,
55
+ headers: headers,
56
+ parameters: parameters)
57
+ end
58
+
59
+ # Get a PATCH HttpRequest object.
60
+ # @param [String] The URL to send the request to.
61
+ # @param [Hash, Optional] The headers for the HTTP Request.
62
+ # @param [Hash, Optional] The parameters for the HTTP Request.
63
+ def patch(query_url,
64
+ headers: {},
65
+ parameters: {})
66
+ return HttpRequest.new(HttpMethodEnum::PATCH,
67
+ query_url,
68
+ headers: headers,
69
+ parameters: parameters)
70
+ end
71
+
72
+ # Get a DELETE HttpRequest object.
73
+ # @param [String] The URL to send the request to.
74
+ # @param [Hash, Optional] The headers for the HTTP Request.
75
+ def delete(query_url,
76
+ headers: {})
77
+ return HttpRequest.new(HttpMethodEnum::DELETE,
78
+ query_url,
79
+ headers: headers)
80
+ end
81
+ end
82
+ end
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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
32
+ end
@@ -0,0 +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
@@ -0,0 +1,80 @@
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