gonebusy-ruby-client 0.1.0 → 0.1.1

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +2 -1
  4. data/lib/gonebusy/controllers/bookings_controller.rb +77 -74
  5. data/lib/gonebusy/controllers/categories_controller.rb +29 -29
  6. data/lib/gonebusy/controllers/pricing_models_controller.rb +47 -47
  7. data/lib/gonebusy/controllers/resources_controller.rb +77 -77
  8. data/lib/gonebusy/controllers/schedules_controller.rb +92 -92
  9. data/lib/gonebusy/controllers/services_controller.rb +86 -86
  10. data/lib/gonebusy/controllers/users_controller.rb +56 -56
  11. data/lib/gonebusy/models/cancel_booking_by_id_response.rb +10 -12
  12. data/lib/gonebusy/models/create_booking_body.rb +78 -80
  13. data/lib/gonebusy/models/create_booking_response.rb +10 -12
  14. data/lib/gonebusy/models/create_category_body.rb +34 -36
  15. data/lib/gonebusy/models/create_category_response.rb +10 -12
  16. data/lib/gonebusy/models/create_pricing_model_body.rb +35 -37
  17. data/lib/gonebusy/models/create_pricing_model_response.rb +10 -12
  18. data/lib/gonebusy/models/create_resource_body.rb +39 -41
  19. data/lib/gonebusy/models/create_resource_response.rb +10 -12
  20. data/lib/gonebusy/models/create_schedule_body.rb +92 -94
  21. data/lib/gonebusy/models/create_schedule_response.rb +10 -12
  22. data/lib/gonebusy/models/create_schedule_time_window_body.rb +64 -66
  23. data/lib/gonebusy/models/create_schedule_time_window_response.rb +10 -12
  24. data/lib/gonebusy/models/create_service_body.rb +57 -59
  25. data/lib/gonebusy/models/create_service_response.rb +10 -12
  26. data/lib/gonebusy/models/create_user_body.rb +40 -42
  27. data/lib/gonebusy/models/create_user_response.rb +10 -12
  28. data/lib/gonebusy/models/delete_resource_by_id_response.rb +10 -12
  29. data/lib/gonebusy/models/delete_schedule_by_id_response.rb +10 -12
  30. data/lib/gonebusy/models/delete_schedule_time_window_by_id_response.rb +10 -12
  31. data/lib/gonebusy/models/delete_service_by_id_response.rb +10 -12
  32. data/lib/gonebusy/models/entities_address_entity.rb +69 -71
  33. data/lib/gonebusy/models/entities_availability_response.rb +21 -23
  34. data/lib/gonebusy/models/entities_booking_response.rb +32 -34
  35. data/lib/gonebusy/models/entities_category_response.rb +52 -54
  36. data/lib/gonebusy/models/entities_pricing_model_response.rb +44 -46
  37. data/lib/gonebusy/models/entities_resource_availabilities.rb +24 -26
  38. data/lib/gonebusy/models/entities_resource_response.rb +60 -62
  39. data/lib/gonebusy/models/entities_schedule_response.rb +26 -28
  40. data/lib/gonebusy/models/entities_search_response.rb +29 -31
  41. data/lib/gonebusy/models/entities_service_response.rb +82 -84
  42. data/lib/gonebusy/models/entities_slots.rb +13 -15
  43. data/lib/gonebusy/models/entities_thing_type_response.rb +13 -15
  44. data/lib/gonebusy/models/entities_time_window_response.rb +81 -83
  45. data/lib/gonebusy/models/entities_user_response.rb +95 -97
  46. data/lib/gonebusy/models/get_booking_by_id_response.rb +10 -12
  47. data/lib/gonebusy/models/get_bookings_response.rb +14 -16
  48. data/lib/gonebusy/models/get_categories_response.rb +14 -16
  49. data/lib/gonebusy/models/get_category_by_id_response.rb +10 -12
  50. data/lib/gonebusy/models/get_pricing_model_by_id_response.rb +10 -12
  51. data/lib/gonebusy/models/get_pricing_models_response.rb +14 -16
  52. data/lib/gonebusy/models/get_resource_by_id_response.rb +10 -12
  53. data/lib/gonebusy/models/get_resource_things_response.rb +14 -16
  54. data/lib/gonebusy/models/get_resources_response.rb +14 -16
  55. data/lib/gonebusy/models/get_schedule_by_id_response.rb +10 -12
  56. data/lib/gonebusy/models/get_schedules_response.rb +14 -16
  57. data/lib/gonebusy/models/get_service_available_slots_by_id_response.rb +10 -12
  58. data/lib/gonebusy/models/get_service_by_id_response.rb +10 -12
  59. data/lib/gonebusy/models/get_services_response.rb +14 -16
  60. data/lib/gonebusy/models/get_user_by_id_response.rb +10 -12
  61. data/lib/gonebusy/models/get_users_response.rb +14 -16
  62. data/lib/gonebusy/models/search_query_response.rb +10 -12
  63. data/lib/gonebusy/models/update_booking_by_id_body.rb +58 -60
  64. data/lib/gonebusy/models/update_booking_by_id_response.rb +10 -12
  65. data/lib/gonebusy/models/update_pricing_model_by_id_body.rb +28 -30
  66. data/lib/gonebusy/models/update_pricing_model_by_id_response.rb +10 -12
  67. data/lib/gonebusy/models/update_resource_by_id_body.rb +33 -35
  68. data/lib/gonebusy/models/update_resource_by_id_response.rb +10 -12
  69. data/lib/gonebusy/models/update_schedule_time_window_by_id_body.rb +71 -73
  70. data/lib/gonebusy/models/update_schedule_time_window_by_id_response.rb +10 -12
  71. data/lib/gonebusy/models/update_service_by_id_body.rb +43 -45
  72. data/lib/gonebusy/models/update_service_by_id_response.rb +10 -12
  73. data/lib/gonebusy/models/update_user_by_id_body.rb +41 -43
  74. data/lib/gonebusy/models/update_user_by_id_response.rb +10 -12
  75. data/lib/gonebusy.rb +67 -67
  76. metadata +2 -3
  77. data/lib/gonebusy/exceptions/entities_error_exception.rb +0 -27
@@ -2,25 +2,25 @@
2
2
 
3
3
  module Gonebusy
4
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
5
  # ID of Service being booked
10
6
  # @return [Integer]
11
7
  attr_accessor :service_id
12
8
 
9
+ # Desired date of booking. Several formats are supported: "2014-10-31", "October 31, 2014"
10
+ # @return [Date]
11
+ attr_accessor :date
12
+
13
13
  # Desired time of booking. Several formats are supported: '9am', '09:00', '9:00', '0900'
14
14
  # @return [String]
15
15
  attr_accessor :time
16
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
17
+ # Create a booking for this User Id. You must be authorized to manage this User Id.
18
+ # @return [Integer]
19
+ attr_accessor :user_id
20
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
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
24
 
25
25
  # Length of time, in minutes, for the desired booking - if Service allows requesting a variable amount of time
26
26
  # @return [Integer]
@@ -30,105 +30,103 @@ module Gonebusy
30
30
  # @return [Date]
31
31
  attr_accessor :end_date
32
32
 
33
+ # One of the possible recurrence values. If not provided, assumed to be :once to indicate a single Booking.
34
+ # @return [RecursByEnum]
35
+ attr_accessor :recurs_by
36
+
33
37
  # Optional frequency of recurrence as specified by :recurs_by. E.g, :single, :every, :every_other, etc. If not provided, assumed to be :once
34
38
  # @return [FrequencyEnum]
35
39
  attr_accessor :frequency
36
40
 
41
+ # List of comma-separated days of the week this Booking falls on. Useful for recurring Bookings. If provided, at least one must be specified.
42
+ # @return [String]
43
+ attr_accessor :days
44
+
37
45
  # Optional occurrence of frequency. E.g, :first, :2nd, :last, :2nd_to_last, etc. If not provided, assumed to be :every
38
46
  # @return [OccurrenceEnum]
39
47
  attr_accessor :occurrence
40
48
 
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
49
+ # Required only when :recurs_by is 'monthly' or 'yearly' to differentiate between exact date or 'day in month/year'. See Recurring Booking examples.
50
+ # @return [DateRecursByEnum]
51
+ attr_accessor :date_recurs_by
52
52
 
53
53
  # A mapping from model property names to API property names
54
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"
55
+ if @_hash.nil?
56
+ @_hash = {}
57
+ @_hash["service_id"] = "service_id"
58
+ @_hash["date"] = "date"
59
+ @_hash["time"] = "time"
60
+ @_hash["user_id"] = "user_id"
61
+ @_hash["resource_id"] = "resource_id"
62
+ @_hash["duration"] = "duration"
63
+ @_hash["end_date"] = "end_date"
64
+ @_hash["recurs_by"] = "recurs_by"
65
+ @_hash["frequency"] = "frequency"
66
+ @_hash["days"] = "days"
67
+ @_hash["occurrence"] = "occurrence"
68
+ @_hash["date_recurs_by"] = "date_recurs_by"
69
69
  end
70
- @hash
70
+ @_hash
71
71
  end
72
72
 
73
- def initialize(date = nil,
74
- service_id = nil,
73
+ def initialize(service_id = nil,
74
+ date = nil,
75
75
  time = nil,
76
- date_recurs_by = nil,
77
- days = nil,
76
+ user_id = nil,
77
+ resource_id = nil,
78
78
  duration = nil,
79
79
  end_date = nil,
80
+ recurs_by = nil,
80
81
  frequency = nil,
82
+ days = nil,
81
83
  occurrence = nil,
82
- recurs_by = nil,
83
- resource_id = nil,
84
- user_id = nil)
85
- @date = date
84
+ date_recurs_by = nil)
86
85
  @service_id = service_id
86
+ @date = date
87
87
  @time = time
88
- @date_recurs_by = date_recurs_by
89
- @days = days
88
+ @user_id = user_id
89
+ @resource_id = resource_id
90
90
  @duration = duration
91
91
  @end_date = end_date
92
+ @recurs_by = recurs_by
92
93
  @frequency = frequency
94
+ @days = days
93
95
  @occurrence = occurrence
94
- @recurs_by = recurs_by
95
- @resource_id = resource_id
96
- @user_id = user_id
96
+ @date_recurs_by = date_recurs_by
97
97
  end
98
98
 
99
99
  # Creates an instance of the object from a hash
100
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
101
+ return nil unless hash
102
+
103
+ # Extract variables from the hash
104
+ service_id = hash['service_id']
105
+ date = hash['date']
106
+ time = hash['time']
107
+ user_id = hash['user_id']
108
+ resource_id = hash['resource_id']
109
+ duration = hash['duration']
110
+ end_date = hash['end_date']
111
+ recurs_by = hash['recurs_by']
112
+ frequency = hash['frequency']
113
+ days = hash['days']
114
+ occurrence = hash['occurrence']
115
+ date_recurs_by = hash['date_recurs_by']
116
+
117
+ # Create object from extracted values
118
+ CreateBookingBody.new(service_id,
119
+ date,
120
+ time,
121
+ user_id,
122
+ resource_id,
123
+ duration,
124
+ end_date,
125
+ recurs_by,
126
+ frequency,
127
+ days,
128
+ occurrence,
129
+ date_recurs_by)
132
130
  end
133
131
  end
134
132
  end
@@ -8,11 +8,11 @@ module Gonebusy
8
8
 
9
9
  # A mapping from model property names to API property names
10
10
  def self.names
11
- if @hash.nil?
12
- @hash = {}
13
- @hash["booking"] = "booking"
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["booking"] = "booking"
14
14
  end
15
- @hash
15
+ @_hash
16
16
  end
17
17
 
18
18
  def initialize(booking = nil)
@@ -21,15 +21,13 @@ module Gonebusy
21
21
 
22
22
  # Creates an instance of the object from a hash
23
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']
24
+ return nil unless hash
29
25
 
30
- # Create object from extracted values
31
- CreateBookingResponse.new(booking)
32
- end
26
+ # Extract variables from the hash
27
+ booking = EntitiesBookingResponse.from_hash(hash['booking']) if hash['booking']
28
+
29
+ # Create object from extracted values
30
+ CreateBookingResponse.new(booking)
33
31
  end
34
32
  end
35
33
  end
@@ -2,13 +2,17 @@
2
2
 
3
3
  module Gonebusy
4
4
  class CreateCategoryBody < BaseModel
5
+ # Category Name
6
+ # @return [String]
7
+ attr_accessor :name
8
+
5
9
  # Category Description
6
10
  # @return [String]
7
11
  attr_accessor :description
8
12
 
9
- # Category Name
13
+ # Optional abbreviated Category name
10
14
  # @return [String]
11
- attr_accessor :name
15
+ attr_accessor :short_name
12
16
 
13
17
  # Optional full name of Category
14
18
  # @return [String]
@@ -18,54 +22,48 @@ module Gonebusy
18
22
  # @return [Integer]
19
23
  attr_accessor :parent_category_id
20
24
 
21
- # Optional abbreviated Category name
22
- # @return [String]
23
- attr_accessor :short_name
24
-
25
25
  # A mapping from model property names to API property names
26
26
  def self.names
27
- if @hash.nil?
28
- @hash = {}
29
- @hash["description"] = "description"
30
- @hash["name"] = "name"
31
- @hash["long_name"] = "long_name"
32
- @hash["parent_category_id"] = "parent_category_id"
33
- @hash["short_name"] = "short_name"
27
+ if @_hash.nil?
28
+ @_hash = {}
29
+ @_hash["name"] = "name"
30
+ @_hash["description"] = "description"
31
+ @_hash["short_name"] = "short_name"
32
+ @_hash["long_name"] = "long_name"
33
+ @_hash["parent_category_id"] = "parent_category_id"
34
34
  end
35
- @hash
35
+ @_hash
36
36
  end
37
37
 
38
- def initialize(description = nil,
39
- name = nil,
38
+ def initialize(name = nil,
39
+ description = nil,
40
+ short_name = nil,
40
41
  long_name = nil,
41
- parent_category_id = nil,
42
- short_name = nil)
43
- @description = description
42
+ parent_category_id = nil)
44
43
  @name = name
44
+ @description = description
45
+ @short_name = short_name
45
46
  @long_name = long_name
46
47
  @parent_category_id = parent_category_id
47
- @short_name = short_name
48
48
  end
49
49
 
50
50
  # Creates an instance of the object from a hash
51
51
  def self.from_hash(hash)
52
- if hash == nil
53
- nil
54
- else
55
- # Extract variables from the hash
56
- description = hash['description']
57
- name = hash['name']
58
- long_name = hash['long_name']
59
- parent_category_id = hash['parent_category_id']
60
- short_name = hash['short_name']
52
+ return nil unless hash
61
53
 
62
- # Create object from extracted values
63
- CreateCategoryBody.new(description,
64
- name,
65
- long_name,
66
- parent_category_id,
67
- short_name)
68
- end
54
+ # Extract variables from the hash
55
+ name = hash['name']
56
+ description = hash['description']
57
+ short_name = hash['short_name']
58
+ long_name = hash['long_name']
59
+ parent_category_id = hash['parent_category_id']
60
+
61
+ # Create object from extracted values
62
+ CreateCategoryBody.new(name,
63
+ description,
64
+ short_name,
65
+ long_name,
66
+ parent_category_id)
69
67
  end
70
68
  end
71
69
  end
@@ -8,11 +8,11 @@ module Gonebusy
8
8
 
9
9
  # A mapping from model property names to API property names
10
10
  def self.names
11
- if @hash.nil?
12
- @hash = {}
13
- @hash["category"] = "category"
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["category"] = "category"
14
14
  end
15
- @hash
15
+ @_hash
16
16
  end
17
17
 
18
18
  def initialize(category = nil)
@@ -21,15 +21,13 @@ module Gonebusy
21
21
 
22
22
  # Creates an instance of the object from a hash
23
23
  def self.from_hash(hash)
24
- if hash == nil
25
- nil
26
- else
27
- # Extract variables from the hash
28
- category = EntitiesCategoryResponse.from_hash(hash['category']) if hash['category']
24
+ return nil unless hash
29
25
 
30
- # Create object from extracted values
31
- CreateCategoryResponse.new(category)
32
- end
26
+ # Extract variables from the hash
27
+ category = EntitiesCategoryResponse.from_hash(hash['category']) if hash['category']
28
+
29
+ # Create object from extracted values
30
+ CreateCategoryResponse.new(category)
33
31
  end
34
32
  end
35
33
  end
@@ -10,9 +10,9 @@ module Gonebusy
10
10
  # @return [String]
11
11
  attr_accessor :type
12
12
 
13
- # 3 Letter ISO Currency Code
14
- # @return [String]
15
- attr_accessor :currency
13
+ # Create a PricingModel for this User Id. You must be authorized to manage this User Id.
14
+ # @return [Integer]
15
+ attr_accessor :user_id
16
16
 
17
17
  # Optional Notes Field
18
18
  # @return [String]
@@ -22,59 +22,57 @@ module Gonebusy
22
22
  # @return [Float]
23
23
  attr_accessor :price
24
24
 
25
- # Create a PricingModel for this User Id. You must be authorized to manage this User Id.
26
- # @return [Integer]
27
- attr_accessor :user_id
25
+ # 3 Letter ISO Currency Code
26
+ # @return [String]
27
+ attr_accessor :currency
28
28
 
29
29
  # A mapping from model property names to API property names
30
30
  def self.names
31
- if @hash.nil?
32
- @hash = {}
33
- @hash["name"] = "name"
34
- @hash["type"] = "type"
35
- @hash["currency"] = "currency"
36
- @hash["notes"] = "notes"
37
- @hash["price"] = "price"
38
- @hash["user_id"] = "user_id"
31
+ if @_hash.nil?
32
+ @_hash = {}
33
+ @_hash["name"] = "name"
34
+ @_hash["type"] = "type"
35
+ @_hash["user_id"] = "user_id"
36
+ @_hash["notes"] = "notes"
37
+ @_hash["price"] = "price"
38
+ @_hash["currency"] = "currency"
39
39
  end
40
- @hash
40
+ @_hash
41
41
  end
42
42
 
43
43
  def initialize(name = nil,
44
44
  type = nil,
45
- currency = nil,
45
+ user_id = nil,
46
46
  notes = nil,
47
47
  price = nil,
48
- user_id = nil)
48
+ currency = nil)
49
49
  @name = name
50
50
  @type = type
51
- @currency = currency
51
+ @user_id = user_id
52
52
  @notes = notes
53
53
  @price = price
54
- @user_id = user_id
54
+ @currency = currency
55
55
  end
56
56
 
57
57
  # Creates an instance of the object from a hash
58
58
  def self.from_hash(hash)
59
- if hash == nil
60
- nil
61
- else
62
- # Extract variables from the hash
63
- name = hash['name']
64
- type = hash['type']
65
- currency = hash['currency']
66
- notes = hash['notes']
67
- price = hash['price']
68
- user_id = hash['user_id']
59
+ return nil unless hash
69
60
 
70
- # Create object from extracted values
71
- CreatePricingModelBody.new(name,
72
- type,
73
- currency,
74
- notes,
75
- price,
76
- user_id)
77
- end
61
+ # Extract variables from the hash
62
+ name = hash['name']
63
+ type = hash['type']
64
+ user_id = hash['user_id']
65
+ notes = hash['notes']
66
+ price = hash['price']
67
+ currency = hash['currency']
68
+
69
+ # Create object from extracted values
70
+ CreatePricingModelBody.new(name,
71
+ type,
72
+ user_id,
73
+ notes,
74
+ price,
75
+ currency)
78
76
  end
79
77
  end
80
78
  end
@@ -8,11 +8,11 @@ module Gonebusy
8
8
 
9
9
  # A mapping from model property names to API property names
10
10
  def self.names
11
- if @hash.nil?
12
- @hash = {}
13
- @hash["pricing_model"] = "pricing_model"
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["pricing_model"] = "pricing_model"
14
14
  end
15
- @hash
15
+ @_hash
16
16
  end
17
17
 
18
18
  def initialize(pricing_model = nil)
@@ -21,15 +21,13 @@ module Gonebusy
21
21
 
22
22
  # Creates an instance of the object from a hash
23
23
  def self.from_hash(hash)
24
- if hash == nil
25
- nil
26
- else
27
- # Extract variables from the hash
28
- pricing_model = EntitiesPricingModelResponse.from_hash(hash['pricing_model']) if hash['pricing_model']
24
+ return nil unless hash
29
25
 
30
- # Create object from extracted values
31
- CreatePricingModelResponse.new(pricing_model)
32
- end
26
+ # Extract variables from the hash
27
+ pricing_model = EntitiesPricingModelResponse.from_hash(hash['pricing_model']) if hash['pricing_model']
28
+
29
+ # Create object from extracted values
30
+ CreatePricingModelResponse.new(pricing_model)
33
31
  end
34
32
  end
35
33
  end
@@ -10,14 +10,18 @@ module Gonebusy
10
10
  # @return [String]
11
11
  attr_accessor :type
12
12
 
13
- # Optional Capacity
13
+ # Create a Resource for this User Id. You must be authorized to manage this User Id.
14
14
  # @return [Integer]
15
- attr_accessor :capacity
15
+ attr_accessor :user_id
16
16
 
17
17
  # Optional Description
18
18
  # @return [String]
19
19
  attr_accessor :description
20
20
 
21
+ # Optional Capacity
22
+ # @return [Integer]
23
+ attr_accessor :capacity
24
+
21
25
  # Optional Gender
22
26
  # @return [GenderEnum]
23
27
  attr_accessor :gender
@@ -26,64 +30,58 @@ module Gonebusy
26
30
  # @return [Integer]
27
31
  attr_accessor :thing_type_id
28
32
 
29
- # Create a Resource for this User Id. You must be authorized to manage this User Id.
30
- # @return [Integer]
31
- attr_accessor :user_id
32
-
33
33
  # A mapping from model property names to API property names
34
34
  def self.names
35
- if @hash.nil?
36
- @hash = {}
37
- @hash["name"] = "name"
38
- @hash["type"] = "type"
39
- @hash["capacity"] = "capacity"
40
- @hash["description"] = "description"
41
- @hash["gender"] = "gender"
42
- @hash["thing_type_id"] = "thing_type_id"
43
- @hash["user_id"] = "user_id"
35
+ if @_hash.nil?
36
+ @_hash = {}
37
+ @_hash["name"] = "name"
38
+ @_hash["type"] = "type"
39
+ @_hash["user_id"] = "user_id"
40
+ @_hash["description"] = "description"
41
+ @_hash["capacity"] = "capacity"
42
+ @_hash["gender"] = "gender"
43
+ @_hash["thing_type_id"] = "thing_type_id"
44
44
  end
45
- @hash
45
+ @_hash
46
46
  end
47
47
 
48
48
  def initialize(name = nil,
49
49
  type = nil,
50
- capacity = nil,
50
+ user_id = nil,
51
51
  description = nil,
52
+ capacity = nil,
52
53
  gender = nil,
53
- thing_type_id = nil,
54
- user_id = nil)
54
+ thing_type_id = nil)
55
55
  @name = name
56
56
  @type = type
57
- @capacity = capacity
57
+ @user_id = user_id
58
58
  @description = description
59
+ @capacity = capacity
59
60
  @gender = gender
60
61
  @thing_type_id = thing_type_id
61
- @user_id = user_id
62
62
  end
63
63
 
64
64
  # Creates an instance of the object from a hash
65
65
  def self.from_hash(hash)
66
- if hash == nil
67
- nil
68
- else
69
- # Extract variables from the hash
70
- name = hash['name']
71
- type = hash['type']
72
- capacity = hash['capacity']
73
- description = hash['description']
74
- gender = hash['gender']
75
- thing_type_id = hash['thing_type_id']
76
- user_id = hash['user_id']
66
+ return nil unless hash
77
67
 
78
- # Create object from extracted values
79
- CreateResourceBody.new(name,
80
- type,
81
- capacity,
82
- description,
83
- gender,
84
- thing_type_id,
85
- user_id)
86
- end
68
+ # Extract variables from the hash
69
+ name = hash['name']
70
+ type = hash['type']
71
+ user_id = hash['user_id']
72
+ description = hash['description']
73
+ capacity = hash['capacity']
74
+ gender = hash['gender']
75
+ thing_type_id = hash['thing_type_id']
76
+
77
+ # Create object from extracted values
78
+ CreateResourceBody.new(name,
79
+ type,
80
+ user_id,
81
+ description,
82
+ capacity,
83
+ gender,
84
+ thing_type_id)
87
85
  end
88
86
  end
89
87
  end