gonebusy-ruby-client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -12,12 +12,12 @@ module Gonebusy
12
12
 
13
13
  # A mapping from model property names to API property names
14
14
  def self.names
15
- if @hash.nil?
16
- @hash = {}
17
- @hash["id"] = "id"
18
- @hash["name"] = "name"
15
+ if @_hash.nil?
16
+ @_hash = {}
17
+ @_hash["id"] = "id"
18
+ @_hash["name"] = "name"
19
19
  end
20
- @hash
20
+ @_hash
21
21
  end
22
22
 
23
23
  def initialize(id = nil,
@@ -28,17 +28,15 @@ module Gonebusy
28
28
 
29
29
  # Creates an instance of the object from a hash
30
30
  def self.from_hash(hash)
31
- if hash == nil
32
- nil
33
- else
34
- # Extract variables from the hash
35
- id = hash['id']
36
- name = hash['name']
31
+ return nil unless hash
37
32
 
38
- # Create object from extracted values
39
- EntitiesThingTypeResponse.new(id,
40
- name)
41
- end
33
+ # Extract variables from the hash
34
+ id = hash['id']
35
+ name = hash['name']
36
+
37
+ # Create object from extracted values
38
+ EntitiesThingTypeResponse.new(id,
39
+ name)
42
40
  end
43
41
  end
44
42
  end
@@ -2,49 +2,49 @@
2
2
 
3
3
  module Gonebusy
4
4
  class EntitiesTimeWindowResponse < BaseModel
5
- # date_recurs_by
6
- # @return [String]
7
- attr_accessor :date_recurs_by
5
+ # id of TimeWindow
6
+ # @return [Integer]
7
+ attr_accessor :id
8
8
 
9
- # array of days of week TimeWindow falls on
10
- # @return [List of String]
11
- attr_accessor :days
9
+ # start date
10
+ # @return [Date]
11
+ attr_accessor :start_date
12
12
 
13
13
  # end date
14
14
  # @return [Date]
15
15
  attr_accessor :end_date
16
16
 
17
+ # start time
18
+ # @return [String]
19
+ attr_accessor :start_time
20
+
17
21
  # end time
18
22
  # @return [String]
19
23
  attr_accessor :end_time
20
24
 
25
+ # total minutes spanned
26
+ # @return [Integer]
27
+ attr_accessor :total_minutes
28
+
29
+ # recurs by
30
+ # @return [String]
31
+ attr_accessor :recurs_by
32
+
21
33
  # frequency
22
34
  # @return [String]
23
35
  attr_accessor :frequency
24
36
 
25
- # id of TimeWindow
26
- # @return [Integer]
27
- attr_accessor :id
28
-
29
37
  # occurrence
30
38
  # @return [String]
31
39
  attr_accessor :occurrence
32
40
 
33
- # recurs by
34
- # @return [String]
35
- attr_accessor :recurs_by
36
-
37
- # start date
38
- # @return [Date]
39
- attr_accessor :start_date
40
-
41
- # start time
41
+ # date_recurs_by
42
42
  # @return [String]
43
- attr_accessor :start_time
43
+ attr_accessor :date_recurs_by
44
44
 
45
- # total minutes spanned
46
- # @return [Integer]
47
- attr_accessor :total_minutes
45
+ # array of days of week TimeWindow falls on
46
+ # @return [List of String]
47
+ attr_accessor :days
48
48
 
49
49
  # true is available, false is unavailable
50
50
  # @return [Boolean]
@@ -52,83 +52,81 @@ module Gonebusy
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_recurs_by"] = "date_recurs_by"
58
- @hash["days"] = "days"
59
- @hash["end_date"] = "end_date"
60
- @hash["end_time"] = "end_time"
61
- @hash["frequency"] = "frequency"
62
- @hash["id"] = "id"
63
- @hash["occurrence"] = "occurrence"
64
- @hash["recurs_by"] = "recurs_by"
65
- @hash["start_date"] = "start_date"
66
- @hash["start_time"] = "start_time"
67
- @hash["total_minutes"] = "total_minutes"
68
- @hash["unavailable"] = "unavailable"
55
+ if @_hash.nil?
56
+ @_hash = {}
57
+ @_hash["id"] = "id"
58
+ @_hash["start_date"] = "start_date"
59
+ @_hash["end_date"] = "end_date"
60
+ @_hash["start_time"] = "start_time"
61
+ @_hash["end_time"] = "end_time"
62
+ @_hash["total_minutes"] = "total_minutes"
63
+ @_hash["recurs_by"] = "recurs_by"
64
+ @_hash["frequency"] = "frequency"
65
+ @_hash["occurrence"] = "occurrence"
66
+ @_hash["date_recurs_by"] = "date_recurs_by"
67
+ @_hash["days"] = "days"
68
+ @_hash["unavailable"] = "unavailable"
69
69
  end
70
- @hash
70
+ @_hash
71
71
  end
72
72
 
73
- def initialize(date_recurs_by = nil,
74
- days = nil,
73
+ def initialize(id = nil,
74
+ start_date = nil,
75
75
  end_date = nil,
76
+ start_time = nil,
76
77
  end_time = nil,
78
+ total_minutes = nil,
79
+ recurs_by = nil,
77
80
  frequency = nil,
78
- id = nil,
79
81
  occurrence = nil,
80
- recurs_by = nil,
81
- start_date = nil,
82
- start_time = nil,
83
- total_minutes = nil,
82
+ date_recurs_by = nil,
83
+ days = nil,
84
84
  unavailable = nil)
85
- @date_recurs_by = date_recurs_by
86
- @days = days
87
- @end_date = end_date
88
- @end_time = end_time
89
- @frequency = frequency
90
85
  @id = id
91
- @occurrence = occurrence
92
- @recurs_by = recurs_by
93
86
  @start_date = start_date
87
+ @end_date = end_date
94
88
  @start_time = start_time
89
+ @end_time = end_time
95
90
  @total_minutes = total_minutes
91
+ @recurs_by = recurs_by
92
+ @frequency = frequency
93
+ @occurrence = occurrence
94
+ @date_recurs_by = date_recurs_by
95
+ @days = days
96
96
  @unavailable = unavailable
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_recurs_by = hash['date_recurs_by']
106
- days = hash['days']
107
- end_date = hash['end_date']
108
- end_time = hash['end_time']
109
- frequency = hash['frequency']
110
- id = hash['id']
111
- occurrence = hash['occurrence']
112
- recurs_by = hash['recurs_by']
113
- start_date = hash['start_date']
114
- start_time = hash['start_time']
115
- total_minutes = hash['total_minutes']
116
- unavailable = hash['unavailable']
117
-
118
- # Create object from extracted values
119
- EntitiesTimeWindowResponse.new(date_recurs_by,
120
- days,
121
- end_date,
122
- end_time,
123
- frequency,
124
- id,
125
- occurrence,
126
- recurs_by,
127
- start_date,
128
- start_time,
129
- total_minutes,
130
- unavailable)
131
- end
101
+ return nil unless hash
102
+
103
+ # Extract variables from the hash
104
+ id = hash['id']
105
+ start_date = hash['start_date']
106
+ end_date = hash['end_date']
107
+ start_time = hash['start_time']
108
+ end_time = hash['end_time']
109
+ total_minutes = hash['total_minutes']
110
+ recurs_by = hash['recurs_by']
111
+ frequency = hash['frequency']
112
+ occurrence = hash['occurrence']
113
+ date_recurs_by = hash['date_recurs_by']
114
+ days = hash['days']
115
+ unavailable = hash['unavailable']
116
+
117
+ # Create object from extracted values
118
+ EntitiesTimeWindowResponse.new(id,
119
+ start_date,
120
+ end_date,
121
+ start_time,
122
+ end_time,
123
+ total_minutes,
124
+ recurs_by,
125
+ frequency,
126
+ occurrence,
127
+ date_recurs_by,
128
+ days,
129
+ unavailable)
132
130
  end
133
131
  end
134
132
  end
@@ -2,151 +2,149 @@
2
2
 
3
3
  module Gonebusy
4
4
  class EntitiesUserResponse < BaseModel
5
- # id of Account Manager user for User
5
+ # id of User
6
6
  # @return [Integer]
7
- attr_accessor :account_manager_id
8
-
9
- # address of User
10
- # @return [EntitiesAddressEntity]
11
- attr_accessor :address
7
+ attr_accessor :id
12
8
 
13
- # business name for User
14
- # @return [String]
15
- attr_accessor :business_name
9
+ # id of defacto Resource for User
10
+ # @return [Integer]
11
+ attr_accessor :resource_id
16
12
 
17
- # status of user
18
- # @return [Boolean]
19
- attr_accessor :disabled
13
+ # id of Account Manager user for User
14
+ # @return [Integer]
15
+ attr_accessor :account_manager_id
20
16
 
21
17
  # email of User
22
18
  # @return [String]
23
19
  attr_accessor :email
24
20
 
25
- # external url to business
21
+ # phone number of User
26
22
  # @return [String]
27
- attr_accessor :external_url
23
+ attr_accessor :phone
28
24
 
29
25
  # first name of User
30
26
  # @return [String]
31
27
  attr_accessor :first_name
32
28
 
33
- # id of User
34
- # @return [Integer]
35
- attr_accessor :id
36
-
37
29
  # last name of User
38
30
  # @return [String]
39
31
  attr_accessor :last_name
40
32
 
33
+ # status of user
34
+ # @return [Boolean]
35
+ attr_accessor :disabled
36
+
37
+ # business name for User
38
+ # @return [String]
39
+ attr_accessor :business_name
40
+
41
+ # external url to business
42
+ # @return [String]
43
+ attr_accessor :external_url
44
+
41
45
  # permalink of User
42
46
  # @return [String]
43
47
  attr_accessor :permalink
44
48
 
45
- # phone number of User
49
+ # timezone of User,
46
50
  # @return [String]
47
- attr_accessor :phone
51
+ attr_accessor :timezone
48
52
 
49
- # id of defacto Resource for User
50
- # @return [Integer]
51
- attr_accessor :resource_id
53
+ # address of User
54
+ # @return [EntitiesAddressEntity]
55
+ attr_accessor :address
52
56
 
53
57
  # User account type
54
58
  # @return [String]
55
59
  attr_accessor :role
56
60
 
57
- # timezone of User,
58
- # @return [String]
59
- attr_accessor :timezone
60
-
61
61
  # A mapping from model property names to API property names
62
62
  def self.names
63
- if @hash.nil?
64
- @hash = {}
65
- @hash["account_manager_id"] = "account_manager_id"
66
- @hash["address"] = "address"
67
- @hash["business_name"] = "business_name"
68
- @hash["disabled"] = "disabled"
69
- @hash["email"] = "email"
70
- @hash["external_url"] = "external_url"
71
- @hash["first_name"] = "first_name"
72
- @hash["id"] = "id"
73
- @hash["last_name"] = "last_name"
74
- @hash["permalink"] = "permalink"
75
- @hash["phone"] = "phone"
76
- @hash["resource_id"] = "resource_id"
77
- @hash["role"] = "role"
78
- @hash["timezone"] = "timezone"
63
+ if @_hash.nil?
64
+ @_hash = {}
65
+ @_hash["id"] = "id"
66
+ @_hash["resource_id"] = "resource_id"
67
+ @_hash["account_manager_id"] = "account_manager_id"
68
+ @_hash["email"] = "email"
69
+ @_hash["phone"] = "phone"
70
+ @_hash["first_name"] = "first_name"
71
+ @_hash["last_name"] = "last_name"
72
+ @_hash["disabled"] = "disabled"
73
+ @_hash["business_name"] = "business_name"
74
+ @_hash["external_url"] = "external_url"
75
+ @_hash["permalink"] = "permalink"
76
+ @_hash["timezone"] = "timezone"
77
+ @_hash["address"] = "address"
78
+ @_hash["role"] = "role"
79
79
  end
80
- @hash
80
+ @_hash
81
81
  end
82
82
 
83
- def initialize(account_manager_id = nil,
84
- address = nil,
85
- business_name = nil,
86
- disabled = nil,
83
+ def initialize(id = nil,
84
+ resource_id = nil,
85
+ account_manager_id = nil,
87
86
  email = nil,
88
- external_url = nil,
87
+ phone = nil,
89
88
  first_name = nil,
90
- id = nil,
91
89
  last_name = nil,
90
+ disabled = nil,
91
+ business_name = nil,
92
+ external_url = nil,
92
93
  permalink = nil,
93
- phone = nil,
94
- resource_id = nil,
95
- role = nil,
96
- timezone = nil)
94
+ timezone = nil,
95
+ address = nil,
96
+ role = nil)
97
+ @id = id
98
+ @resource_id = resource_id
97
99
  @account_manager_id = account_manager_id
98
- @address = address
99
- @business_name = business_name
100
- @disabled = disabled
101
100
  @email = email
102
- @external_url = external_url
101
+ @phone = phone
103
102
  @first_name = first_name
104
- @id = id
105
103
  @last_name = last_name
104
+ @disabled = disabled
105
+ @business_name = business_name
106
+ @external_url = external_url
106
107
  @permalink = permalink
107
- @phone = phone
108
- @resource_id = resource_id
109
- @role = role
110
108
  @timezone = timezone
109
+ @address = address
110
+ @role = role
111
111
  end
112
112
 
113
113
  # Creates an instance of the object from a hash
114
114
  def self.from_hash(hash)
115
- if hash == nil
116
- nil
117
- else
118
- # Extract variables from the hash
119
- account_manager_id = hash['account_manager_id']
120
- address = EntitiesAddressEntity.from_hash(hash['address']) if hash['address']
121
- business_name = hash['business_name']
122
- disabled = hash['disabled']
123
- email = hash['email']
124
- external_url = hash['external_url']
125
- first_name = hash['first_name']
126
- id = hash['id']
127
- last_name = hash['last_name']
128
- permalink = hash['permalink']
129
- phone = hash['phone']
130
- resource_id = hash['resource_id']
131
- role = hash['role']
132
- timezone = hash['timezone']
133
-
134
- # Create object from extracted values
135
- EntitiesUserResponse.new(account_manager_id,
136
- address,
137
- business_name,
138
- disabled,
139
- email,
140
- external_url,
141
- first_name,
142
- id,
143
- last_name,
144
- permalink,
145
- phone,
146
- resource_id,
147
- role,
148
- timezone)
149
- end
115
+ return nil unless hash
116
+
117
+ # Extract variables from the hash
118
+ id = hash['id']
119
+ resource_id = hash['resource_id']
120
+ account_manager_id = hash['account_manager_id']
121
+ email = hash['email']
122
+ phone = hash['phone']
123
+ first_name = hash['first_name']
124
+ last_name = hash['last_name']
125
+ disabled = hash['disabled']
126
+ business_name = hash['business_name']
127
+ external_url = hash['external_url']
128
+ permalink = hash['permalink']
129
+ timezone = hash['timezone']
130
+ address = EntitiesAddressEntity.from_hash(hash['address']) if hash['address']
131
+ role = hash['role']
132
+
133
+ # Create object from extracted values
134
+ EntitiesUserResponse.new(id,
135
+ resource_id,
136
+ account_manager_id,
137
+ email,
138
+ phone,
139
+ first_name,
140
+ last_name,
141
+ disabled,
142
+ business_name,
143
+ external_url,
144
+ permalink,
145
+ timezone,
146
+ address,
147
+ role)
150
148
  end
151
149
  end
152
150
  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
- GetBookingByIdResponse.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
+ GetBookingByIdResponse.new(booking)
33
31
  end
34
32
  end
35
33
  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["bookings"] = "bookings"
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["bookings"] = "bookings"
14
14
  end
15
- @hash
15
+ @_hash
16
16
  end
17
17
 
18
18
  def initialize(bookings = nil)
@@ -21,20 +21,18 @@ 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
- # Parameter is an array, so we need to iterate through it
29
- bookings = nil
30
- if hash['bookings'] != nil
31
- bookings = Array.new
32
- hash['bookings'].each{|structure| bookings << (EntitiesBookingResponse.from_hash(structure) if structure)}
33
- end
24
+ return nil unless hash
34
25
 
35
- # Create object from extracted values
36
- GetBookingsResponse.new(bookings)
26
+ # Extract variables from the hash
27
+ # Parameter is an array, so we need to iterate through it
28
+ bookings = nil
29
+ if hash['bookings'] != nil
30
+ bookings = Array.new
31
+ hash['bookings'].each{|structure| bookings << (EntitiesBookingResponse.from_hash(structure) if structure)}
37
32
  end
33
+
34
+ # Create object from extracted values
35
+ GetBookingsResponse.new(bookings)
38
36
  end
39
37
  end
40
38
  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["categories"] = "categories"
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["categories"] = "categories"
14
14
  end
15
- @hash
15
+ @_hash
16
16
  end
17
17
 
18
18
  def initialize(categories = nil)
@@ -21,20 +21,18 @@ 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
- # Parameter is an array, so we need to iterate through it
29
- categories = nil
30
- if hash['categories'] != nil
31
- categories = Array.new
32
- hash['categories'].each{|structure| categories << (EntitiesCategoryResponse.from_hash(structure) if structure)}
33
- end
24
+ return nil unless hash
34
25
 
35
- # Create object from extracted values
36
- GetCategoriesResponse.new(categories)
26
+ # Extract variables from the hash
27
+ # Parameter is an array, so we need to iterate through it
28
+ categories = nil
29
+ if hash['categories'] != nil
30
+ categories = Array.new
31
+ hash['categories'].each{|structure| categories << (EntitiesCategoryResponse.from_hash(structure) if structure)}
37
32
  end
33
+
34
+ # Create object from extracted values
35
+ GetCategoriesResponse.new(categories)
38
36
  end
39
37
  end
40
38
  end