quandoo 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (238) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +197 -0
  4. data/Rakefile +8 -0
  5. data/config.json +8 -0
  6. data/docs/AgentTracking.md +8 -0
  7. data/docs/AreaDto.md +10 -0
  8. data/docs/AvailabilitiesApi.md +132 -0
  9. data/docs/ChainDto.md +9 -0
  10. data/docs/ChangedReviewDto.md +10 -0
  11. data/docs/CoordinatesDto.md +9 -0
  12. data/docs/CreateReviewDto.md +10 -0
  13. data/docs/CreatedMasterCustomer.md +8 -0
  14. data/docs/CreatedReservation.md +11 -0
  15. data/docs/CreatedReservationData.md +10 -0
  16. data/docs/CreatedReservationEnquiry.md +8 -0
  17. data/docs/CreatedReservationEnquiryData.md +10 -0
  18. data/docs/CustomerDataList.md +10 -0
  19. data/docs/CustomerDto.md +10 -0
  20. data/docs/CustomerResponse.md +17 -0
  21. data/docs/CustomerReviewData.md +11 -0
  22. data/docs/CustomerStatisticsData.md +10 -0
  23. data/docs/CustomersApi.md +183 -0
  24. data/docs/DealData.md +10 -0
  25. data/docs/DocumentDto.md +11 -0
  26. data/docs/ErrorResponse.md +9 -0
  27. data/docs/GetReservationEnquiryData.md +14 -0
  28. data/docs/GetReviewDto.md +14 -0
  29. data/docs/GetReviewsDto.md +11 -0
  30. data/docs/ImageDto.md +8 -0
  31. data/docs/LinkRelationDto.md +10 -0
  32. data/docs/LocationDto.md +9 -0
  33. data/docs/MarketingSettingDto.md +9 -0
  34. data/docs/MenusApi.md +300 -0
  35. data/docs/MerchantAddressDto.md +12 -0
  36. data/docs/MerchantAvailabilityDaysDto.md +9 -0
  37. data/docs/MerchantAvailabilityDto.md +11 -0
  38. data/docs/MerchantAvailabilityDtoList.md +10 -0
  39. data/docs/MerchantCustomer.md +15 -0
  40. data/docs/MerchantCustomerData.md +21 -0
  41. data/docs/MerchantDetailsDto.md +24 -0
  42. data/docs/MerchantDetailsDtoList.md +11 -0
  43. data/docs/MerchantMenuCategoryDto.md +10 -0
  44. data/docs/MerchantMenuDto.md +13 -0
  45. data/docs/MerchantMenuItemDto.md +11 -0
  46. data/docs/MerchantMenusDto.md +8 -0
  47. data/docs/MerchantReservation.md +18 -0
  48. data/docs/MerchantReservationData.md +10 -0
  49. data/docs/MerchantReservationEnquiry.md +13 -0
  50. data/docs/MerchantReservationEnquiryData.md +10 -0
  51. data/docs/MerchantReservationSettingsDto.md +18 -0
  52. data/docs/MerchantSubscription.md +8 -0
  53. data/docs/MerchantVaultSettingsDto.md +11 -0
  54. data/docs/MerchantWithRecommendationsDto.md +10 -0
  55. data/docs/MerchantsApi.md +334 -0
  56. data/docs/OpeningTimesDto.md +8 -0
  57. data/docs/ReservationData.md +18 -0
  58. data/docs/ReservationDataList.md +8 -0
  59. data/docs/ReservationDetails.md +11 -0
  60. data/docs/ReservationEnquiriesApi.md +230 -0
  61. data/docs/ReservationEnquiryMessageData.md +10 -0
  62. data/docs/ReservationEnquiryMessageList.md +8 -0
  63. data/docs/ReservationMenuData.md +8 -0
  64. data/docs/ReservationMenuItemData.md +12 -0
  65. data/docs/ReservationSettingsApi.md +56 -0
  66. data/docs/ReservationsApi.md +168 -0
  67. data/docs/RestCookie.md +9 -0
  68. data/docs/ReviewDto.md +12 -0
  69. data/docs/ReviewDtoList.md +11 -0
  70. data/docs/ReviewsApi.md +235 -0
  71. data/docs/StandardOpeningTimesDto.md +7 -0
  72. data/docs/StatusApi.md +90 -0
  73. data/docs/TagGroupDto.md +9 -0
  74. data/docs/Tracking.md +9 -0
  75. data/docs/TranslatedTagDto.md +9 -0
  76. data/docs/UpdateReservationData.md +8 -0
  77. data/docs/UpdateReservationEnquiryData.md +8 -0
  78. data/docs/UpdateReviewDto.md +10 -0
  79. data/docs/ValidationsApi.md +59 -0
  80. data/git_push.sh +55 -0
  81. data/lib/quandoo.rb +113 -0
  82. data/lib/quandoo/api/availabilities_api.rb +171 -0
  83. data/lib/quandoo/api/customers_api.rb +185 -0
  84. data/lib/quandoo/api/menus_api.rb +301 -0
  85. data/lib/quandoo/api/merchants_api.rb +357 -0
  86. data/lib/quandoo/api/reservation_enquiries_api.rb +232 -0
  87. data/lib/quandoo/api/reservation_settings_api.rb +73 -0
  88. data/lib/quandoo/api/reservations_api.rb +178 -0
  89. data/lib/quandoo/api/reviews_api.rb +241 -0
  90. data/lib/quandoo/api/status_api.rb +111 -0
  91. data/lib/quandoo/api/validations_api.rb +76 -0
  92. data/lib/quandoo/api_client.rb +389 -0
  93. data/lib/quandoo/api_error.rb +38 -0
  94. data/lib/quandoo/configuration.rb +216 -0
  95. data/lib/quandoo/models/agent_tracking.rb +189 -0
  96. data/lib/quandoo/models/area_dto.rb +204 -0
  97. data/lib/quandoo/models/chain_dto.rb +192 -0
  98. data/lib/quandoo/models/changed_review_dto.rb +250 -0
  99. data/lib/quandoo/models/coordinates_dto.rb +192 -0
  100. data/lib/quandoo/models/create_review_dto.rb +214 -0
  101. data/lib/quandoo/models/created_master_customer.rb +189 -0
  102. data/lib/quandoo/models/created_reservation.rb +229 -0
  103. data/lib/quandoo/models/created_reservation_data.rb +221 -0
  104. data/lib/quandoo/models/created_reservation_enquiry.rb +189 -0
  105. data/lib/quandoo/models/created_reservation_enquiry_data.rb +221 -0
  106. data/lib/quandoo/models/customer_data_list.rb +203 -0
  107. data/lib/quandoo/models/customer_dto.rb +201 -0
  108. data/lib/quandoo/models/customer_response.rb +362 -0
  109. data/lib/quandoo/models/customer_review_data.rb +214 -0
  110. data/lib/quandoo/models/customer_statistics_data.rb +219 -0
  111. data/lib/quandoo/models/deal_data.rb +253 -0
  112. data/lib/quandoo/models/document_dto.rb +210 -0
  113. data/lib/quandoo/models/error_response.rb +226 -0
  114. data/lib/quandoo/models/get_reservation_enquiry_data.rb +249 -0
  115. data/lib/quandoo/models/get_review_dto.rb +288 -0
  116. data/lib/quandoo/models/get_reviews_dto.rb +216 -0
  117. data/lib/quandoo/models/image_dto.rb +183 -0
  118. data/lib/quandoo/models/link_relation_dto.rb +235 -0
  119. data/lib/quandoo/models/location_dto.rb +192 -0
  120. data/lib/quandoo/models/marketing_setting_dto.rb +238 -0
  121. data/lib/quandoo/models/merchant_address_dto.rb +219 -0
  122. data/lib/quandoo/models/merchant_availability_days_dto.rb +198 -0
  123. data/lib/quandoo/models/merchant_availability_dto.rb +226 -0
  124. data/lib/quandoo/models/merchant_availability_dto_list.rb +215 -0
  125. data/lib/quandoo/models/merchant_customer.rb +271 -0
  126. data/lib/quandoo/models/merchant_customer_data.rb +390 -0
  127. data/lib/quandoo/models/merchant_details_dto.rb +402 -0
  128. data/lib/quandoo/models/merchant_details_dto_list.rb +218 -0
  129. data/lib/quandoo/models/merchant_menu_category_dto.rb +216 -0
  130. data/lib/quandoo/models/merchant_menu_dto.rb +251 -0
  131. data/lib/quandoo/models/merchant_menu_item_dto.rb +224 -0
  132. data/lib/quandoo/models/merchant_menus_dto.rb +185 -0
  133. data/lib/quandoo/models/merchant_reservation.rb +301 -0
  134. data/lib/quandoo/models/merchant_reservation_data.rb +219 -0
  135. data/lib/quandoo/models/merchant_reservation_enquiry.rb +311 -0
  136. data/lib/quandoo/models/merchant_reservation_enquiry_data.rb +219 -0
  137. data/lib/quandoo/models/merchant_reservation_settings_dto.rb +290 -0
  138. data/lib/quandoo/models/merchant_subscription.rb +217 -0
  139. data/lib/quandoo/models/merchant_vault_settings_dto.rb +231 -0
  140. data/lib/quandoo/models/merchant_with_recommendations_dto.rb +248 -0
  141. data/lib/quandoo/models/opening_times_dto.rb +189 -0
  142. data/lib/quandoo/models/reservation_data.rb +331 -0
  143. data/lib/quandoo/models/reservation_data_list.rb +185 -0
  144. data/lib/quandoo/models/reservation_details.rb +229 -0
  145. data/lib/quandoo/models/reservation_enquiry_message_data.rb +241 -0
  146. data/lib/quandoo/models/reservation_enquiry_message_list.rb +185 -0
  147. data/lib/quandoo/models/reservation_menu_data.rb +190 -0
  148. data/lib/quandoo/models/reservation_menu_item_data.rb +219 -0
  149. data/lib/quandoo/models/rest_cookie.rb +194 -0
  150. data/lib/quandoo/models/review_dto.rb +238 -0
  151. data/lib/quandoo/models/review_dto_list.rb +218 -0
  152. data/lib/quandoo/models/standard_opening_times_dto.rb +174 -0
  153. data/lib/quandoo/models/tag_group_dto.rb +228 -0
  154. data/lib/quandoo/models/tracking.rb +199 -0
  155. data/lib/quandoo/models/translated_tag_dto.rb +192 -0
  156. data/lib/quandoo/models/update_reservation_data.rb +189 -0
  157. data/lib/quandoo/models/update_reservation_enquiry_data.rb +184 -0
  158. data/lib/quandoo/models/update_review_dto.rb +209 -0
  159. data/lib/quandoo/version.rb +15 -0
  160. data/quandoo.gemspec +45 -0
  161. data/spec/api/availabilities_api_spec.rb +69 -0
  162. data/spec/api/customers_api_spec.rb +75 -0
  163. data/spec/api/menus_api_spec.rb +100 -0
  164. data/spec/api/merchants_api_spec.rb +119 -0
  165. data/spec/api/reservation_enquiries_api_spec.rb +84 -0
  166. data/spec/api/reservation_settings_api_spec.rb +47 -0
  167. data/spec/api/reservations_api_spec.rb +72 -0
  168. data/spec/api/reviews_api_spec.rb +86 -0
  169. data/spec/api/status_api_spec.rb +57 -0
  170. data/spec/api/validations_api_spec.rb +48 -0
  171. data/spec/api_client_spec.rb +226 -0
  172. data/spec/configuration_spec.rb +42 -0
  173. data/spec/models/agent_tracking_spec.rb +41 -0
  174. data/spec/models/area_dto_spec.rb +53 -0
  175. data/spec/models/chain_dto_spec.rb +47 -0
  176. data/spec/models/changed_review_dto_spec.rb +57 -0
  177. data/spec/models/coordinates_dto_spec.rb +47 -0
  178. data/spec/models/create_review_dto_spec.rb +53 -0
  179. data/spec/models/created_master_customer_spec.rb +41 -0
  180. data/spec/models/created_reservation_data_spec.rb +53 -0
  181. data/spec/models/created_reservation_enquiry_data_spec.rb +53 -0
  182. data/spec/models/created_reservation_enquiry_spec.rb +41 -0
  183. data/spec/models/created_reservation_spec.rb +59 -0
  184. data/spec/models/customer_data_list_spec.rb +53 -0
  185. data/spec/models/customer_dto_spec.rb +53 -0
  186. data/spec/models/customer_response_spec.rb +99 -0
  187. data/spec/models/customer_review_data_spec.rb +59 -0
  188. data/spec/models/customer_statistics_data_spec.rb +53 -0
  189. data/spec/models/deal_data_spec.rb +57 -0
  190. data/spec/models/document_dto_spec.rb +59 -0
  191. data/spec/models/error_response_spec.rb +51 -0
  192. data/spec/models/get_reservation_enquiry_data_spec.rb +77 -0
  193. data/spec/models/get_review_dto_spec.rb +81 -0
  194. data/spec/models/get_reviews_dto_spec.rb +59 -0
  195. data/spec/models/image_dto_spec.rb +41 -0
  196. data/spec/models/link_relation_dto_spec.rb +57 -0
  197. data/spec/models/location_dto_spec.rb +47 -0
  198. data/spec/models/marketing_setting_dto_spec.rb +55 -0
  199. data/spec/models/merchant_address_dto_spec.rb +65 -0
  200. data/spec/models/merchant_availability_days_dto_spec.rb +47 -0
  201. data/spec/models/merchant_availability_dto_list_spec.rb +53 -0
  202. data/spec/models/merchant_availability_dto_spec.rb +59 -0
  203. data/spec/models/merchant_customer_data_spec.rb +119 -0
  204. data/spec/models/merchant_customer_spec.rb +83 -0
  205. data/spec/models/merchant_details_dto_list_spec.rb +59 -0
  206. data/spec/models/merchant_details_dto_spec.rb +137 -0
  207. data/spec/models/merchant_menu_category_dto_spec.rb +53 -0
  208. data/spec/models/merchant_menu_dto_spec.rb +71 -0
  209. data/spec/models/merchant_menu_item_dto_spec.rb +59 -0
  210. data/spec/models/merchant_menus_dto_spec.rb +41 -0
  211. data/spec/models/merchant_reservation_data_spec.rb +53 -0
  212. data/spec/models/merchant_reservation_enquiry_data_spec.rb +53 -0
  213. data/spec/models/merchant_reservation_enquiry_spec.rb +71 -0
  214. data/spec/models/merchant_reservation_settings_dto_spec.rb +101 -0
  215. data/spec/models/merchant_reservation_spec.rb +101 -0
  216. data/spec/models/merchant_subscription_spec.rb +45 -0
  217. data/spec/models/merchant_vault_settings_dto_spec.rb +59 -0
  218. data/spec/models/merchant_with_recommendations_dto_spec.rb +57 -0
  219. data/spec/models/opening_times_dto_spec.rb +41 -0
  220. data/spec/models/reservation_data_list_spec.rb +41 -0
  221. data/spec/models/reservation_data_spec.rb +101 -0
  222. data/spec/models/reservation_details_spec.rb +59 -0
  223. data/spec/models/reservation_enquiry_message_data_spec.rb +57 -0
  224. data/spec/models/reservation_enquiry_message_list_spec.rb +41 -0
  225. data/spec/models/reservation_menu_data_spec.rb +41 -0
  226. data/spec/models/reservation_menu_item_data_spec.rb +65 -0
  227. data/spec/models/rest_cookie_spec.rb +47 -0
  228. data/spec/models/review_dto_list_spec.rb +59 -0
  229. data/spec/models/review_dto_spec.rb +65 -0
  230. data/spec/models/standard_opening_times_dto_spec.rb +35 -0
  231. data/spec/models/tag_group_dto_spec.rb +51 -0
  232. data/spec/models/tracking_spec.rb +47 -0
  233. data/spec/models/translated_tag_dto_spec.rb +47 -0
  234. data/spec/models/update_reservation_data_spec.rb +41 -0
  235. data/spec/models/update_reservation_enquiry_data_spec.rb +41 -0
  236. data/spec/models/update_review_dto_spec.rb +53 -0
  237. data/spec/spec_helper.rb +111 -0
  238. metadata +538 -0
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #Quandoo API Documentation
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Quandoo
16
+ class CreatedReservationData
17
+ # The object holding the reservation data.
18
+ attr_accessor :reservation
19
+
20
+ # The object holding the customer data.
21
+ attr_accessor :customer
22
+
23
+ # Related links to follow
24
+ attr_accessor :links
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'reservation' => :'reservation',
30
+ :'customer' => :'customer',
31
+ :'links' => :'links'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'reservation' => :'CreatedReservation',
39
+ :'customer' => :'CreatedMasterCustomer',
40
+ :'links' => :'Array<LinkRelationDto>'
41
+ }
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ return unless attributes.is_a?(Hash)
48
+
49
+ # convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
51
+
52
+ if attributes.has_key?(:'reservation')
53
+ self.reservation = attributes[:'reservation']
54
+ end
55
+
56
+ if attributes.has_key?(:'customer')
57
+ self.customer = attributes[:'customer']
58
+ end
59
+
60
+ if attributes.has_key?(:'links')
61
+ if (value = attributes[:'links']).is_a?(Array)
62
+ self.links = value
63
+ end
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ if @reservation.nil?
72
+ invalid_properties.push('invalid value for "reservation", reservation cannot be nil.')
73
+ end
74
+
75
+ if @customer.nil?
76
+ invalid_properties.push('invalid value for "customer", customer cannot be nil.')
77
+ end
78
+
79
+ if @links.nil?
80
+ invalid_properties.push('invalid value for "links", links cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return false if @reservation.nil?
90
+ return false if @customer.nil?
91
+ return false if @links.nil?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ reservation == o.reservation &&
101
+ customer == o.customer &&
102
+ links == o.links
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Fixnum] Hash code
113
+ def hash
114
+ [reservation, customer, links].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ self.class.swagger_types.each_pair do |key, type|
123
+ if type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :DateTime
144
+ DateTime.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :BOOLEAN
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ temp_model = Quandoo.const_get(type).new
175
+ temp_model.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ next if value.nil?
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end
@@ -0,0 +1,189 @@
1
+ =begin
2
+ #Quandoo API Documentation
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Quandoo
16
+ class CreatedReservationEnquiry
17
+ # The identifier of the reservation enquiry for the calling agent (Agent-dependent field)
18
+ attr_accessor :id
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'id' => :'id'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ :'id' => :'String'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
41
+
42
+ if attributes.has_key?(:'id')
43
+ self.id = attributes[:'id']
44
+ end
45
+ end
46
+
47
+ # Show invalid properties with the reasons. Usually used together with valid?
48
+ # @return Array for valid properties with the reasons
49
+ def list_invalid_properties
50
+ invalid_properties = Array.new
51
+ if @id.nil?
52
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
53
+ end
54
+
55
+ invalid_properties
56
+ end
57
+
58
+ # Check to see if the all the properties in the model are valid
59
+ # @return true if the model is valid
60
+ def valid?
61
+ return false if @id.nil?
62
+ true
63
+ end
64
+
65
+ # Checks equality by comparing each attribute.
66
+ # @param [Object] Object to be compared
67
+ def ==(o)
68
+ return true if self.equal?(o)
69
+ self.class == o.class &&
70
+ id == o.id
71
+ end
72
+
73
+ # @see the `==` method
74
+ # @param [Object] Object to be compared
75
+ def eql?(o)
76
+ self == o
77
+ end
78
+
79
+ # Calculates hash code according to all attributes.
80
+ # @return [Fixnum] Hash code
81
+ def hash
82
+ [id].hash
83
+ end
84
+
85
+ # Builds the object from hash
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ # @return [Object] Returns the model itself
88
+ def build_from_hash(attributes)
89
+ return nil unless attributes.is_a?(Hash)
90
+ self.class.swagger_types.each_pair do |key, type|
91
+ if type =~ /\AArray<(.*)>/i
92
+ # check to ensure the input is an array given that the the attribute
93
+ # is documented as an array but the input is not
94
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
95
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
96
+ end
97
+ elsif !attributes[self.class.attribute_map[key]].nil?
98
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
99
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
100
+ end
101
+
102
+ self
103
+ end
104
+
105
+ # Deserializes the data based on type
106
+ # @param string type Data type
107
+ # @param string value Value to be deserialized
108
+ # @return [Object] Deserialized data
109
+ def _deserialize(type, value)
110
+ case type.to_sym
111
+ when :DateTime
112
+ DateTime.parse(value)
113
+ when :Date
114
+ Date.parse(value)
115
+ when :String
116
+ value.to_s
117
+ when :Integer
118
+ value.to_i
119
+ when :Float
120
+ value.to_f
121
+ when :BOOLEAN
122
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
123
+ true
124
+ else
125
+ false
126
+ end
127
+ when :Object
128
+ # generic object (usually a Hash), return directly
129
+ value
130
+ when /\AArray<(?<inner_type>.+)>\z/
131
+ inner_type = Regexp.last_match[:inner_type]
132
+ value.map { |v| _deserialize(inner_type, v) }
133
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
134
+ k_type = Regexp.last_match[:k_type]
135
+ v_type = Regexp.last_match[:v_type]
136
+ {}.tap do |hash|
137
+ value.each do |k, v|
138
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
139
+ end
140
+ end
141
+ else # model
142
+ temp_model = Quandoo.const_get(type).new
143
+ temp_model.build_from_hash(value)
144
+ end
145
+ end
146
+
147
+ # Returns the string representation of the object
148
+ # @return [String] String presentation of the object
149
+ def to_s
150
+ to_hash.to_s
151
+ end
152
+
153
+ # to_body is an alias to to_hash (backward compatibility)
154
+ # @return [Hash] Returns the object in the form of hash
155
+ def to_body
156
+ to_hash
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ self.class.attribute_map.each_pair do |attr, param|
164
+ value = self.send(attr)
165
+ next if value.nil?
166
+ hash[param] = _to_hash(value)
167
+ end
168
+ hash
169
+ end
170
+
171
+ # Outputs non-array value in the form of hash
172
+ # For object, use to_hash. Otherwise, just return the value
173
+ # @param [Object] value Any valid value
174
+ # @return [Hash] Returns the value in the form of hash
175
+ def _to_hash(value)
176
+ if value.is_a?(Array)
177
+ value.compact.map { |v| _to_hash(v) }
178
+ elsif value.is_a?(Hash)
179
+ {}.tap do |hash|
180
+ value.each { |k, v| hash[k] = _to_hash(v) }
181
+ end
182
+ elsif value.respond_to? :to_hash
183
+ value.to_hash
184
+ else
185
+ value
186
+ end
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #Quandoo API Documentation
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Quandoo
16
+ class CreatedReservationEnquiryData
17
+ # The object holding the reservation enquiry data.
18
+ attr_accessor :reservation_enquiry
19
+
20
+ # The object holding the customer data.
21
+ attr_accessor :customer
22
+
23
+ # Related links to follow
24
+ attr_accessor :links
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'reservation_enquiry' => :'reservationEnquiry',
30
+ :'customer' => :'customer',
31
+ :'links' => :'links'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'reservation_enquiry' => :'CreatedReservationEnquiry',
39
+ :'customer' => :'CreatedMasterCustomer',
40
+ :'links' => :'Array<LinkRelationDto>'
41
+ }
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ return unless attributes.is_a?(Hash)
48
+
49
+ # convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
51
+
52
+ if attributes.has_key?(:'reservationEnquiry')
53
+ self.reservation_enquiry = attributes[:'reservationEnquiry']
54
+ end
55
+
56
+ if attributes.has_key?(:'customer')
57
+ self.customer = attributes[:'customer']
58
+ end
59
+
60
+ if attributes.has_key?(:'links')
61
+ if (value = attributes[:'links']).is_a?(Array)
62
+ self.links = value
63
+ end
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ if @reservation_enquiry.nil?
72
+ invalid_properties.push('invalid value for "reservation_enquiry", reservation_enquiry cannot be nil.')
73
+ end
74
+
75
+ if @customer.nil?
76
+ invalid_properties.push('invalid value for "customer", customer cannot be nil.')
77
+ end
78
+
79
+ if @links.nil?
80
+ invalid_properties.push('invalid value for "links", links cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return false if @reservation_enquiry.nil?
90
+ return false if @customer.nil?
91
+ return false if @links.nil?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ reservation_enquiry == o.reservation_enquiry &&
101
+ customer == o.customer &&
102
+ links == o.links
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Fixnum] Hash code
113
+ def hash
114
+ [reservation_enquiry, customer, links].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ self.class.swagger_types.each_pair do |key, type|
123
+ if type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :DateTime
144
+ DateTime.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :BOOLEAN
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ temp_model = Quandoo.const_get(type).new
175
+ temp_model.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ next if value.nil?
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end