directus_sdk 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +185 -0
  4. data/Rakefile +8 -0
  5. data/directus_sdk.gemspec +46 -0
  6. data/docs/ActivityApi.md +59 -0
  7. data/docs/BookmarksApi.md +290 -0
  8. data/docs/FilesApi.md +277 -0
  9. data/docs/GetActivity.md +9 -0
  10. data/docs/GetActivityData.md +16 -0
  11. data/docs/GetActivityMeta.md +10 -0
  12. data/docs/GetBookmark.md +9 -0
  13. data/docs/GetBookmarks.md +9 -0
  14. data/docs/GetBookmarksData.md +14 -0
  15. data/docs/GetBookmarksMeta.md +14 -0
  16. data/docs/GetFile.md +9 -0
  17. data/docs/GetFiles.md +9 -0
  18. data/docs/GetFilesData.md +24 -0
  19. data/docs/GetGroup.md +9 -0
  20. data/docs/GetGroups.md +9 -0
  21. data/docs/GetGroupsData.md +9 -0
  22. data/docs/GetGroupsDataData.md +16 -0
  23. data/docs/GetGroupsDataMeta.md +11 -0
  24. data/docs/GetMessage.md +9 -0
  25. data/docs/GetMessages.md +9 -0
  26. data/docs/GetMessagesData.md +18 -0
  27. data/docs/GetMessagesMeta.md +13 -0
  28. data/docs/GetMessagesResponses.md +8 -0
  29. data/docs/GetPreferences.md +9 -0
  30. data/docs/GetPreferencesData.md +16 -0
  31. data/docs/GetPrivileges.md +9 -0
  32. data/docs/GetPrivilegesData.md +19 -0
  33. data/docs/GetPrivilegesForTable.md +9 -0
  34. data/docs/GetSettings.md +9 -0
  35. data/docs/GetSettingsData.md +9 -0
  36. data/docs/GetSettingsDataFiles.md +13 -0
  37. data/docs/GetSettingsDataGlobal.md +13 -0
  38. data/docs/GetSettingsFor.md +9 -0
  39. data/docs/GetSettingsForMeta.md +10 -0
  40. data/docs/GetTable.md +9 -0
  41. data/docs/GetTableColumn.md +9 -0
  42. data/docs/GetTableColumnData.md +23 -0
  43. data/docs/GetTableColumns.md +9 -0
  44. data/docs/GetTableColumnsData.md +27 -0
  45. data/docs/GetTableData.md +29 -0
  46. data/docs/GetTableRow.md +9 -0
  47. data/docs/GetTableRows.md +9 -0
  48. data/docs/GetTableRowsData.md +9 -0
  49. data/docs/GetTableRowsMeta.md +14 -0
  50. data/docs/GetTables.md +9 -0
  51. data/docs/GetTablesData.md +8 -0
  52. data/docs/GetTablesMeta.md +9 -0
  53. data/docs/GroupsApi.md +455 -0
  54. data/docs/MessagesApi.md +116 -0
  55. data/docs/PreferencesApi.md +135 -0
  56. data/docs/SettingsApi.md +175 -0
  57. data/docs/TablesApi.md +873 -0
  58. data/docs/UtilsApi.md +126 -0
  59. data/git_push.sh +55 -0
  60. data/lib/directus_sdk.rb +92 -0
  61. data/lib/directus_sdk/api/activity_api.rb +70 -0
  62. data/lib/directus_sdk/api/bookmarks_api.rb +288 -0
  63. data/lib/directus_sdk/api/files_api.rb +297 -0
  64. data/lib/directus_sdk/api/groups_api.rb +469 -0
  65. data/lib/directus_sdk/api/messages_api.rb +123 -0
  66. data/lib/directus_sdk/api/preferences_api.rb +151 -0
  67. data/lib/directus_sdk/api/settings_api.rb +183 -0
  68. data/lib/directus_sdk/api/tables_api.rb +890 -0
  69. data/lib/directus_sdk/api/utils_api.rb +134 -0
  70. data/lib/directus_sdk/api_client.rb +389 -0
  71. data/lib/directus_sdk/api_error.rb +38 -0
  72. data/lib/directus_sdk/configuration.rb +209 -0
  73. data/lib/directus_sdk/models/get_activity.rb +199 -0
  74. data/lib/directus_sdk/models/get_activity_data.rb +260 -0
  75. data/lib/directus_sdk/models/get_activity_meta.rb +206 -0
  76. data/lib/directus_sdk/models/get_bookmark.rb +197 -0
  77. data/lib/directus_sdk/models/get_bookmarks.rb +199 -0
  78. data/lib/directus_sdk/models/get_bookmarks_data.rb +242 -0
  79. data/lib/directus_sdk/models/get_bookmarks_meta.rb +252 -0
  80. data/lib/directus_sdk/models/get_file.rb +197 -0
  81. data/lib/directus_sdk/models/get_files.rb +199 -0
  82. data/lib/directus_sdk/models/get_files_data.rb +332 -0
  83. data/lib/directus_sdk/models/get_group.rb +197 -0
  84. data/lib/directus_sdk/models/get_groups.rb +197 -0
  85. data/lib/directus_sdk/models/get_groups_data.rb +199 -0
  86. data/lib/directus_sdk/models/get_groups_data_data.rb +260 -0
  87. data/lib/directus_sdk/models/get_groups_data_meta.rb +215 -0
  88. data/lib/directus_sdk/models/get_message.rb +197 -0
  89. data/lib/directus_sdk/models/get_messages.rb +199 -0
  90. data/lib/directus_sdk/models/get_messages_data.rb +278 -0
  91. data/lib/directus_sdk/models/get_messages_meta.rb +233 -0
  92. data/lib/directus_sdk/models/get_messages_responses.rb +190 -0
  93. data/lib/directus_sdk/models/get_preferences.rb +197 -0
  94. data/lib/directus_sdk/models/get_preferences_data.rb +260 -0
  95. data/lib/directus_sdk/models/get_privileges.rb +199 -0
  96. data/lib/directus_sdk/models/get_privileges_data.rb +287 -0
  97. data/lib/directus_sdk/models/get_privileges_for_table.rb +197 -0
  98. data/lib/directus_sdk/models/get_settings.rb +197 -0
  99. data/lib/directus_sdk/models/get_settings_data.rb +197 -0
  100. data/lib/directus_sdk/models/get_settings_data_files.rb +233 -0
  101. data/lib/directus_sdk/models/get_settings_data_global.rb +233 -0
  102. data/lib/directus_sdk/models/get_settings_for.rb +197 -0
  103. data/lib/directus_sdk/models/get_settings_for_meta.rb +206 -0
  104. data/lib/directus_sdk/models/get_table.rb +197 -0
  105. data/lib/directus_sdk/models/get_table_column.rb +197 -0
  106. data/lib/directus_sdk/models/get_table_column_data.rb +325 -0
  107. data/lib/directus_sdk/models/get_table_columns.rb +199 -0
  108. data/lib/directus_sdk/models/get_table_columns_data.rb +363 -0
  109. data/lib/directus_sdk/models/get_table_data.rb +379 -0
  110. data/lib/directus_sdk/models/get_table_row.rb +197 -0
  111. data/lib/directus_sdk/models/get_table_rows.rb +199 -0
  112. data/lib/directus_sdk/models/get_table_rows_data.rb +197 -0
  113. data/lib/directus_sdk/models/get_table_rows_meta.rb +242 -0
  114. data/lib/directus_sdk/models/get_tables.rb +199 -0
  115. data/lib/directus_sdk/models/get_tables_data.rb +188 -0
  116. data/lib/directus_sdk/models/get_tables_meta.rb +197 -0
  117. data/lib/directus_sdk/version.rb +15 -0
  118. data/spec/api/activity_api_spec.rb +46 -0
  119. data/spec/api/bookmarks_api_spec.rb +98 -0
  120. data/spec/api/files_api_spec.rb +105 -0
  121. data/spec/api/groups_api_spec.rb +143 -0
  122. data/spec/api/messages_api_spec.rb +58 -0
  123. data/spec/api/preferences_api_spec.rb +65 -0
  124. data/spec/api/settings_api_spec.rb +71 -0
  125. data/spec/api/tables_api_spec.rb +236 -0
  126. data/spec/api/utils_api_spec.rb +61 -0
  127. data/spec/api_client_spec.rb +226 -0
  128. data/spec/configuration_spec.rb +42 -0
  129. data/spec/models/get_activity_data_spec.rb +90 -0
  130. data/spec/models/get_activity_meta_spec.rb +54 -0
  131. data/spec/models/get_activity_spec.rb +48 -0
  132. data/spec/models/get_bookmark_spec.rb +48 -0
  133. data/spec/models/get_bookmarks_data_spec.rb +78 -0
  134. data/spec/models/get_bookmarks_meta_spec.rb +78 -0
  135. data/spec/models/get_bookmarks_spec.rb +48 -0
  136. data/spec/models/get_file_spec.rb +48 -0
  137. data/spec/models/get_files_data_spec.rb +138 -0
  138. data/spec/models/get_files_spec.rb +48 -0
  139. data/spec/models/get_group_spec.rb +48 -0
  140. data/spec/models/get_groups_data_data_spec.rb +90 -0
  141. data/spec/models/get_groups_data_meta_spec.rb +60 -0
  142. data/spec/models/get_groups_data_spec.rb +48 -0
  143. data/spec/models/get_groups_spec.rb +48 -0
  144. data/spec/models/get_message_spec.rb +48 -0
  145. data/spec/models/get_messages_data_spec.rb +102 -0
  146. data/spec/models/get_messages_meta_spec.rb +72 -0
  147. data/spec/models/get_messages_responses_spec.rb +42 -0
  148. data/spec/models/get_messages_spec.rb +48 -0
  149. data/spec/models/get_preferences_data_spec.rb +90 -0
  150. data/spec/models/get_preferences_spec.rb +48 -0
  151. data/spec/models/get_privileges_data_spec.rb +108 -0
  152. data/spec/models/get_privileges_for_table_spec.rb +48 -0
  153. data/spec/models/get_privileges_spec.rb +48 -0
  154. data/spec/models/get_settings_data_files_spec.rb +72 -0
  155. data/spec/models/get_settings_data_global_spec.rb +72 -0
  156. data/spec/models/get_settings_data_spec.rb +48 -0
  157. data/spec/models/get_settings_for_meta_spec.rb +54 -0
  158. data/spec/models/get_settings_for_spec.rb +48 -0
  159. data/spec/models/get_settings_spec.rb +48 -0
  160. data/spec/models/get_table_column_data_spec.rb +132 -0
  161. data/spec/models/get_table_column_spec.rb +48 -0
  162. data/spec/models/get_table_columns_data_spec.rb +156 -0
  163. data/spec/models/get_table_columns_spec.rb +48 -0
  164. data/spec/models/get_table_data_spec.rb +168 -0
  165. data/spec/models/get_table_row_spec.rb +48 -0
  166. data/spec/models/get_table_rows_data_spec.rb +48 -0
  167. data/spec/models/get_table_rows_meta_spec.rb +78 -0
  168. data/spec/models/get_table_rows_spec.rb +48 -0
  169. data/spec/models/get_table_spec.rb +48 -0
  170. data/spec/models/get_tables_data_spec.rb +42 -0
  171. data/spec/models/get_tables_meta_spec.rb +48 -0
  172. data/spec/models/get_tables_spec.rb +48 -0
  173. data/spec/spec_helper.rb +111 -0
  174. metadata +451 -0
@@ -0,0 +1,379 @@
1
+ =begin
2
+ #directus.io
3
+
4
+ #API for directus.io
5
+
6
+ OpenAPI spec version: 1.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DirectusSDK
16
+
17
+ class GetTableData
18
+ attr_accessor :name
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :table_name
23
+
24
+ attr_accessor :columns
25
+
26
+ attr_accessor :preferences
27
+
28
+ attr_accessor :primary_column
29
+
30
+ attr_accessor :schema
31
+
32
+ attr_accessor :hidden
33
+
34
+ attr_accessor :single
35
+
36
+ attr_accessor :default_status
37
+
38
+ attr_accessor :user_create_column
39
+
40
+ attr_accessor :user_update_column
41
+
42
+ attr_accessor :date_create_column
43
+
44
+ attr_accessor :date_update_column
45
+
46
+ attr_accessor :created_at
47
+
48
+ attr_accessor :date_created
49
+
50
+ attr_accessor :comment
51
+
52
+ attr_accessor :row_count
53
+
54
+ attr_accessor :footer
55
+
56
+ attr_accessor :list_view
57
+
58
+ attr_accessor :column_groupings
59
+
60
+ attr_accessor :filter_column_blacklist
61
+
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'name' => :'name',
67
+ :'id' => :'id',
68
+ :'table_name' => :'table_name',
69
+ :'columns' => :'columns',
70
+ :'preferences' => :'preferences',
71
+ :'primary_column' => :'primary_column',
72
+ :'schema' => :'schema',
73
+ :'hidden' => :'hidden',
74
+ :'single' => :'single',
75
+ :'default_status' => :'default_status',
76
+ :'user_create_column' => :'user_create_column',
77
+ :'user_update_column' => :'user_update_column',
78
+ :'date_create_column' => :'date_create_column',
79
+ :'date_update_column' => :'date_update_column',
80
+ :'created_at' => :'created_at',
81
+ :'date_created' => :'date_created',
82
+ :'comment' => :'comment',
83
+ :'row_count' => :'row_count',
84
+ :'footer' => :'footer',
85
+ :'list_view' => :'list_view',
86
+ :'column_groupings' => :'column_groupings',
87
+ :'filter_column_blacklist' => :'filter_column_blacklist'
88
+ }
89
+ end
90
+
91
+ # Attribute type mapping.
92
+ def self.swagger_types
93
+ {
94
+ :'name' => :'String',
95
+ :'id' => :'String',
96
+ :'table_name' => :'String',
97
+ :'columns' => :'Array<Object>',
98
+ :'preferences' => :'Object',
99
+ :'primary_column' => :'String',
100
+ :'schema' => :'String',
101
+ :'hidden' => :'BOOLEAN',
102
+ :'single' => :'BOOLEAN',
103
+ :'default_status' => :'String',
104
+ :'user_create_column' => :'String',
105
+ :'user_update_column' => :'String',
106
+ :'date_create_column' => :'String',
107
+ :'date_update_column' => :'String',
108
+ :'created_at' => :'String',
109
+ :'date_created' => :'String',
110
+ :'comment' => :'String',
111
+ :'row_count' => :'Integer',
112
+ :'footer' => :'BOOLEAN',
113
+ :'list_view' => :'String',
114
+ :'column_groupings' => :'String',
115
+ :'filter_column_blacklist' => :'String'
116
+ }
117
+ end
118
+
119
+ # Initializes the object
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ def initialize(attributes = {})
122
+ return unless attributes.is_a?(Hash)
123
+
124
+ # convert string to symbol for hash key
125
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
126
+
127
+ if attributes.has_key?(:'name')
128
+ self.name = attributes[:'name']
129
+ end
130
+
131
+ if attributes.has_key?(:'id')
132
+ self.id = attributes[:'id']
133
+ end
134
+
135
+ if attributes.has_key?(:'table_name')
136
+ self.table_name = attributes[:'table_name']
137
+ end
138
+
139
+ if attributes.has_key?(:'columns')
140
+ if (value = attributes[:'columns']).is_a?(Array)
141
+ self.columns = value
142
+ end
143
+ end
144
+
145
+ if attributes.has_key?(:'preferences')
146
+ self.preferences = attributes[:'preferences']
147
+ end
148
+
149
+ if attributes.has_key?(:'primary_column')
150
+ self.primary_column = attributes[:'primary_column']
151
+ end
152
+
153
+ if attributes.has_key?(:'schema')
154
+ self.schema = attributes[:'schema']
155
+ end
156
+
157
+ if attributes.has_key?(:'hidden')
158
+ self.hidden = attributes[:'hidden']
159
+ end
160
+
161
+ if attributes.has_key?(:'single')
162
+ self.single = attributes[:'single']
163
+ end
164
+
165
+ if attributes.has_key?(:'default_status')
166
+ self.default_status = attributes[:'default_status']
167
+ end
168
+
169
+ if attributes.has_key?(:'user_create_column')
170
+ self.user_create_column = attributes[:'user_create_column']
171
+ end
172
+
173
+ if attributes.has_key?(:'user_update_column')
174
+ self.user_update_column = attributes[:'user_update_column']
175
+ end
176
+
177
+ if attributes.has_key?(:'date_create_column')
178
+ self.date_create_column = attributes[:'date_create_column']
179
+ end
180
+
181
+ if attributes.has_key?(:'date_update_column')
182
+ self.date_update_column = attributes[:'date_update_column']
183
+ end
184
+
185
+ if attributes.has_key?(:'created_at')
186
+ self.created_at = attributes[:'created_at']
187
+ end
188
+
189
+ if attributes.has_key?(:'date_created')
190
+ self.date_created = attributes[:'date_created']
191
+ end
192
+
193
+ if attributes.has_key?(:'comment')
194
+ self.comment = attributes[:'comment']
195
+ end
196
+
197
+ if attributes.has_key?(:'row_count')
198
+ self.row_count = attributes[:'row_count']
199
+ end
200
+
201
+ if attributes.has_key?(:'footer')
202
+ self.footer = attributes[:'footer']
203
+ end
204
+
205
+ if attributes.has_key?(:'list_view')
206
+ self.list_view = attributes[:'list_view']
207
+ end
208
+
209
+ if attributes.has_key?(:'column_groupings')
210
+ self.column_groupings = attributes[:'column_groupings']
211
+ end
212
+
213
+ if attributes.has_key?(:'filter_column_blacklist')
214
+ self.filter_column_blacklist = attributes[:'filter_column_blacklist']
215
+ end
216
+
217
+ end
218
+
219
+ # Show invalid properties with the reasons. Usually used together with valid?
220
+ # @return Array for valid properies with the reasons
221
+ def list_invalid_properties
222
+ invalid_properties = Array.new
223
+ return invalid_properties
224
+ end
225
+
226
+ # Check to see if the all the properties in the model are valid
227
+ # @return true if the model is valid
228
+ def valid?
229
+ return true
230
+ end
231
+
232
+ # Checks equality by comparing each attribute.
233
+ # @param [Object] Object to be compared
234
+ def ==(o)
235
+ return true if self.equal?(o)
236
+ self.class == o.class &&
237
+ name == o.name &&
238
+ id == o.id &&
239
+ table_name == o.table_name &&
240
+ columns == o.columns &&
241
+ preferences == o.preferences &&
242
+ primary_column == o.primary_column &&
243
+ schema == o.schema &&
244
+ hidden == o.hidden &&
245
+ single == o.single &&
246
+ default_status == o.default_status &&
247
+ user_create_column == o.user_create_column &&
248
+ user_update_column == o.user_update_column &&
249
+ date_create_column == o.date_create_column &&
250
+ date_update_column == o.date_update_column &&
251
+ created_at == o.created_at &&
252
+ date_created == o.date_created &&
253
+ comment == o.comment &&
254
+ row_count == o.row_count &&
255
+ footer == o.footer &&
256
+ list_view == o.list_view &&
257
+ column_groupings == o.column_groupings &&
258
+ filter_column_blacklist == o.filter_column_blacklist
259
+ end
260
+
261
+ # @see the `==` method
262
+ # @param [Object] Object to be compared
263
+ def eql?(o)
264
+ self == o
265
+ end
266
+
267
+ # Calculates hash code according to all attributes.
268
+ # @return [Fixnum] Hash code
269
+ def hash
270
+ [name, id, table_name, columns, preferences, primary_column, schema, hidden, single, default_status, user_create_column, user_update_column, date_create_column, date_update_column, created_at, date_created, comment, row_count, footer, list_view, column_groupings, filter_column_blacklist].hash
271
+ end
272
+
273
+ # Builds the object from hash
274
+ # @param [Hash] attributes Model attributes in the form of hash
275
+ # @return [Object] Returns the model itself
276
+ def build_from_hash(attributes)
277
+ return nil unless attributes.is_a?(Hash)
278
+ self.class.swagger_types.each_pair do |key, type|
279
+ if type =~ /\AArray<(.*)>/i
280
+ # check to ensure the input is an array given that the the attribute
281
+ # is documented as an array but the input is not
282
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
283
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
284
+ end
285
+ elsif !attributes[self.class.attribute_map[key]].nil?
286
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
287
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
288
+ end
289
+
290
+ self
291
+ end
292
+
293
+ # Deserializes the data based on type
294
+ # @param string type Data type
295
+ # @param string value Value to be deserialized
296
+ # @return [Object] Deserialized data
297
+ def _deserialize(type, value)
298
+ case type.to_sym
299
+ when :DateTime
300
+ DateTime.parse(value)
301
+ when :Date
302
+ Date.parse(value)
303
+ when :String
304
+ value.to_s
305
+ when :Integer
306
+ value.to_i
307
+ when :Float
308
+ value.to_f
309
+ when :BOOLEAN
310
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
311
+ true
312
+ else
313
+ false
314
+ end
315
+ when :Object
316
+ # generic object (usually a Hash), return directly
317
+ value
318
+ when /\AArray<(?<inner_type>.+)>\z/
319
+ inner_type = Regexp.last_match[:inner_type]
320
+ value.map { |v| _deserialize(inner_type, v) }
321
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
322
+ k_type = Regexp.last_match[:k_type]
323
+ v_type = Regexp.last_match[:v_type]
324
+ {}.tap do |hash|
325
+ value.each do |k, v|
326
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
327
+ end
328
+ end
329
+ else # model
330
+ temp_model = DirectusSDK.const_get(type).new
331
+ temp_model.build_from_hash(value)
332
+ end
333
+ end
334
+
335
+ # Returns the string representation of the object
336
+ # @return [String] String presentation of the object
337
+ def to_s
338
+ to_hash.to_s
339
+ end
340
+
341
+ # to_body is an alias to to_hash (backward compatibility)
342
+ # @return [Hash] Returns the object in the form of hash
343
+ def to_body
344
+ to_hash
345
+ end
346
+
347
+ # Returns the object in the form of hash
348
+ # @return [Hash] Returns the object in the form of hash
349
+ def to_hash
350
+ hash = {}
351
+ self.class.attribute_map.each_pair do |attr, param|
352
+ value = self.send(attr)
353
+ next if value.nil?
354
+ hash[param] = _to_hash(value)
355
+ end
356
+ hash
357
+ end
358
+
359
+ # Outputs non-array value in the form of hash
360
+ # For object, use to_hash. Otherwise, just return the value
361
+ # @param [Object] value Any valid value
362
+ # @return [Hash] Returns the value in the form of hash
363
+ def _to_hash(value)
364
+ if value.is_a?(Array)
365
+ value.compact.map{ |v| _to_hash(v) }
366
+ elsif value.is_a?(Hash)
367
+ {}.tap do |hash|
368
+ value.each { |k, v| hash[k] = _to_hash(v) }
369
+ end
370
+ elsif value.respond_to? :to_hash
371
+ value.to_hash
372
+ else
373
+ value
374
+ end
375
+ end
376
+
377
+ end
378
+
379
+ end
@@ -0,0 +1,197 @@
1
+ =begin
2
+ #directus.io
3
+
4
+ #API for directus.io
5
+
6
+ OpenAPI spec version: 1.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DirectusSDK
16
+
17
+ class GetTableRow
18
+ attr_accessor :meta
19
+
20
+ attr_accessor :data
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'meta' => :'meta',
27
+ :'data' => :'data'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'meta' => :'GetTablesMeta',
35
+ :'data' => :'GetTableRowsData'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
46
+
47
+ if attributes.has_key?(:'meta')
48
+ self.meta = attributes[:'meta']
49
+ end
50
+
51
+ if attributes.has_key?(:'data')
52
+ self.data = attributes[:'data']
53
+ end
54
+
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properies with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ return invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ return true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ meta == o.meta &&
76
+ data == o.data
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [meta, data].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = DirectusSDK.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map{ |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+
197
+ end