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