directus_sdk 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,65 @@
|
|
|
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 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
|
|
16
|
+
# Unit tests for DirectusSDK::PreferencesApi
|
|
17
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
|
18
|
+
# Please update as you see appropriate
|
|
19
|
+
describe 'PreferencesApi' do
|
|
20
|
+
before do
|
|
21
|
+
# run before each test
|
|
22
|
+
@instance = DirectusSDK::PreferencesApi.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
after do
|
|
26
|
+
# run after each test
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe 'test an instance of PreferencesApi' do
|
|
30
|
+
it 'should create an instance of PreferencesApi' do
|
|
31
|
+
expect(@instance).to be_instance_of(DirectusSDK::PreferencesApi)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# unit tests for get_preferences
|
|
36
|
+
# Returns table preferences
|
|
37
|
+
#
|
|
38
|
+
# @param table_id ID of table to return rows from
|
|
39
|
+
# @param [Hash] opts the optional parameters
|
|
40
|
+
# @return [GetPreferences]
|
|
41
|
+
describe 'get_preferences test' do
|
|
42
|
+
it "should work" do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# unit tests for update_preferences
|
|
48
|
+
# Update table preferences
|
|
49
|
+
#
|
|
50
|
+
# @param table_id ID of table to return rows from
|
|
51
|
+
# @param [Hash] opts the optional parameters
|
|
52
|
+
# @option opts [String] :id Preference's Unique Identification number
|
|
53
|
+
# @option opts [String] :table_name Name of table to add
|
|
54
|
+
# @option opts [String] :columns_visible List of visible columns, separated by commas
|
|
55
|
+
# @option opts [Integer] :sort The sort order of the column used to override the column order in the schema
|
|
56
|
+
# @option opts [String] :sort_order Sort Order (ASC=Ascending or DESC=Descending)
|
|
57
|
+
# @option opts [String] :status List of status values. separated by comma
|
|
58
|
+
# @return [nil]
|
|
59
|
+
describe 'update_preferences test' do
|
|
60
|
+
it "should work" do
|
|
61
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
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 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
|
|
16
|
+
# Unit tests for DirectusSDK::SettingsApi
|
|
17
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
|
18
|
+
# Please update as you see appropriate
|
|
19
|
+
describe 'SettingsApi' do
|
|
20
|
+
before do
|
|
21
|
+
# run before each test
|
|
22
|
+
@instance = DirectusSDK::SettingsApi.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
after do
|
|
26
|
+
# run after each test
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe 'test an instance of SettingsApi' do
|
|
30
|
+
it 'should create an instance of SettingsApi' do
|
|
31
|
+
expect(@instance).to be_instance_of(DirectusSDK::SettingsApi)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# unit tests for get_settings
|
|
36
|
+
# Returns settings
|
|
37
|
+
#
|
|
38
|
+
# @param [Hash] opts the optional parameters
|
|
39
|
+
# @return [GetSettings]
|
|
40
|
+
describe 'get_settings test' do
|
|
41
|
+
it "should work" do
|
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# unit tests for get_settings_for
|
|
47
|
+
# Returns settings for collection
|
|
48
|
+
#
|
|
49
|
+
# @param collection_name Name of collection to return settings for
|
|
50
|
+
# @param [Hash] opts the optional parameters
|
|
51
|
+
# @return [GetSettingsFor]
|
|
52
|
+
describe 'get_settings_for test' do
|
|
53
|
+
it "should work" do
|
|
54
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# unit tests for update_settings
|
|
59
|
+
# Update settings
|
|
60
|
+
#
|
|
61
|
+
# @param collection_name Name of collection to return settings for
|
|
62
|
+
# @param custom_data Data based on your specific schema eg: active=1&title=LoremIpsum
|
|
63
|
+
# @param [Hash] opts the optional parameters
|
|
64
|
+
# @return [nil]
|
|
65
|
+
describe 'update_settings test' do
|
|
66
|
+
it "should work" do
|
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
@@ -0,0 +1,236 @@
|
|
|
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 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
|
|
16
|
+
# Unit tests for DirectusSDK::TablesApi
|
|
17
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
|
18
|
+
# Please update as you see appropriate
|
|
19
|
+
describe 'TablesApi' do
|
|
20
|
+
before do
|
|
21
|
+
# run before each test
|
|
22
|
+
@instance = DirectusSDK::TablesApi.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
after do
|
|
26
|
+
# run after each test
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe 'test an instance of TablesApi' do
|
|
30
|
+
it 'should create an instance of TablesApi' do
|
|
31
|
+
expect(@instance).to be_instance_of(DirectusSDK::TablesApi)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# unit tests for add_column
|
|
36
|
+
# Create a column in a given table
|
|
37
|
+
#
|
|
38
|
+
# @param table_id ID of table to return rows from
|
|
39
|
+
# @param [Hash] opts the optional parameters
|
|
40
|
+
# @option opts [String] :table_name Name of table to add
|
|
41
|
+
# @option opts [String] :column_name The unique name of the column to create
|
|
42
|
+
# @option opts [String] :type The datatype of the column, eg: INT
|
|
43
|
+
# @option opts [String] :ui The Directus Interface to use for this column
|
|
44
|
+
# @option opts [BOOLEAN] :hidden_input Whether the column will be hidden (globally) on the Edit Item page
|
|
45
|
+
# @option opts [BOOLEAN] :hidden_list Whether the column will be hidden (globally) on the Item Listing page
|
|
46
|
+
# @option opts [BOOLEAN] :required Whether the column is required. If required, the interface's validation function will be triggered
|
|
47
|
+
# @option opts [Integer] :sort The sort order of the column used to override the column order in the schema
|
|
48
|
+
# @option opts [String] :comment A helpful note to users for this column
|
|
49
|
+
# @option opts [String] :relationship_type The column's relationship type (only used when storing relational data) eg: ONETOMANY, MANYTOMANY or MANYTOONE
|
|
50
|
+
# @option opts [String] :related_table The table name this column is related to (only used when storing relational data)
|
|
51
|
+
# @option opts [String] :junction_table The pivot/junction table that joins the column's table with the related table (only used when storing relational data)
|
|
52
|
+
# @option opts [String] :junction_key_left The column name in junction that is related to the column's table (only used when storing relational data)
|
|
53
|
+
# @option opts [String] :junction_key_right The column name in junction that is related to the related table (only used when storing relational data)
|
|
54
|
+
# @return [nil]
|
|
55
|
+
describe 'add_column test' do
|
|
56
|
+
it "should work" do
|
|
57
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# unit tests for add_row
|
|
62
|
+
# Add a new row
|
|
63
|
+
#
|
|
64
|
+
# @param table_id ID of table to return rows from
|
|
65
|
+
# @param custom_data Data based on your specific schema eg: active=1&title=LoremIpsum
|
|
66
|
+
# @param [Hash] opts the optional parameters
|
|
67
|
+
# @return [nil]
|
|
68
|
+
describe 'add_row test' do
|
|
69
|
+
it "should work" do
|
|
70
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# unit tests for add_table
|
|
75
|
+
# Add a new table
|
|
76
|
+
#
|
|
77
|
+
# @param [Hash] opts the optional parameters
|
|
78
|
+
# @option opts [String] :name Name of table to add
|
|
79
|
+
# @return [nil]
|
|
80
|
+
describe 'add_table test' do
|
|
81
|
+
it "should work" do
|
|
82
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# unit tests for delete_column
|
|
87
|
+
# Delete row
|
|
88
|
+
#
|
|
89
|
+
# @param table_id ID of table to return rows from
|
|
90
|
+
# @param column_name Name of column to return
|
|
91
|
+
# @param [Hash] opts the optional parameters
|
|
92
|
+
# @return [nil]
|
|
93
|
+
describe 'delete_column test' do
|
|
94
|
+
it "should work" do
|
|
95
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# unit tests for delete_row
|
|
100
|
+
# Delete row
|
|
101
|
+
#
|
|
102
|
+
# @param table_id ID of table to return rows from
|
|
103
|
+
# @param row_id ID of row to return from rows
|
|
104
|
+
# @param [Hash] opts the optional parameters
|
|
105
|
+
# @return [nil]
|
|
106
|
+
describe 'delete_row test' do
|
|
107
|
+
it "should work" do
|
|
108
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# unit tests for delete_table
|
|
113
|
+
# Delete Table
|
|
114
|
+
#
|
|
115
|
+
# @param table_id ID of table to return rows from
|
|
116
|
+
# @param [Hash] opts the optional parameters
|
|
117
|
+
# @return [nil]
|
|
118
|
+
describe 'delete_table test' do
|
|
119
|
+
it "should work" do
|
|
120
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# unit tests for get_table
|
|
125
|
+
# Returns specific table
|
|
126
|
+
#
|
|
127
|
+
# @param table_id ID of table to return rows from
|
|
128
|
+
# @param [Hash] opts the optional parameters
|
|
129
|
+
# @return [GetTable]
|
|
130
|
+
describe 'get_table test' do
|
|
131
|
+
it "should work" do
|
|
132
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# unit tests for get_table_column
|
|
137
|
+
# Returns specific table column
|
|
138
|
+
#
|
|
139
|
+
# @param table_id ID of table to return rows from
|
|
140
|
+
# @param column_name Name of column to return
|
|
141
|
+
# @param [Hash] opts the optional parameters
|
|
142
|
+
# @return [GetTableColumn]
|
|
143
|
+
describe 'get_table_column test' do
|
|
144
|
+
it "should work" do
|
|
145
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# unit tests for get_table_columns
|
|
150
|
+
# Returns table columns
|
|
151
|
+
#
|
|
152
|
+
# @param table_id ID of table to return rows from
|
|
153
|
+
# @param [Hash] opts the optional parameters
|
|
154
|
+
# @return [GetTableColumns]
|
|
155
|
+
describe 'get_table_columns test' do
|
|
156
|
+
it "should work" do
|
|
157
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# unit tests for get_table_row
|
|
162
|
+
# Returns specific table row
|
|
163
|
+
#
|
|
164
|
+
# @param table_id ID of table to return rows from
|
|
165
|
+
# @param row_id ID of row to return from rows
|
|
166
|
+
# @param [Hash] opts the optional parameters
|
|
167
|
+
# @return [GetTableRow]
|
|
168
|
+
describe 'get_table_row test' do
|
|
169
|
+
it "should work" do
|
|
170
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# unit tests for get_table_rows
|
|
175
|
+
# Returns table rows
|
|
176
|
+
#
|
|
177
|
+
# @param table_id ID of table to return rows from
|
|
178
|
+
# @param [Hash] opts the optional parameters
|
|
179
|
+
# @return [GetTableRows]
|
|
180
|
+
describe 'get_table_rows test' do
|
|
181
|
+
it "should work" do
|
|
182
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# unit tests for get_tables
|
|
187
|
+
# Returns tables
|
|
188
|
+
#
|
|
189
|
+
# @param [Hash] opts the optional parameters
|
|
190
|
+
# @return [GetTables]
|
|
191
|
+
describe 'get_tables test' do
|
|
192
|
+
it "should work" do
|
|
193
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# unit tests for update_column
|
|
198
|
+
# Update column
|
|
199
|
+
#
|
|
200
|
+
# @param table_id ID of table to return rows from
|
|
201
|
+
# @param column_name Name of column to return
|
|
202
|
+
# @param [Hash] opts the optional parameters
|
|
203
|
+
# @option opts [String] :data_type The datatype of the column, eg: INT
|
|
204
|
+
# @option opts [String] :ui The Directus Interface to use for this column
|
|
205
|
+
# @option opts [BOOLEAN] :hidden_input Whether the column will be hidden (globally) on the Edit Item page
|
|
206
|
+
# @option opts [BOOLEAN] :hidden_list Whether the column will be hidden (globally) on the Item Listing page
|
|
207
|
+
# @option opts [BOOLEAN] :required Whether the column is required. If required, the interface's validation function will be triggered
|
|
208
|
+
# @option opts [Integer] :sort The sort order of the column used to override the column order in the schema
|
|
209
|
+
# @option opts [String] :comment A helpful note to users for this column
|
|
210
|
+
# @option opts [String] :relationship_type The column's relationship type (only used when storing relational data) eg: ONETOMANY, MANYTOMANY or MANYTOONE
|
|
211
|
+
# @option opts [String] :related_table The table name this column is related to (only used when storing relational data)
|
|
212
|
+
# @option opts [String] :junction_table The pivot/junction table that joins the column's table with the related table (only used when storing relational data)
|
|
213
|
+
# @option opts [String] :junction_key_left The column name in junction that is related to the column's table (only used when storing relational data)
|
|
214
|
+
# @option opts [String] :junction_key_right The column name in junction that is related to the related table (only used when storing relational data)
|
|
215
|
+
# @return [nil]
|
|
216
|
+
describe 'update_column test' do
|
|
217
|
+
it "should work" do
|
|
218
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# unit tests for update_row
|
|
223
|
+
# Update row
|
|
224
|
+
#
|
|
225
|
+
# @param table_id ID of table to return rows from
|
|
226
|
+
# @param row_id ID of row to return from rows
|
|
227
|
+
# @param custom_data Data based on your specific schema eg: active=1&title=LoremIpsum
|
|
228
|
+
# @param [Hash] opts the optional parameters
|
|
229
|
+
# @return [nil]
|
|
230
|
+
describe 'update_row test' do
|
|
231
|
+
it "should work" do
|
|
232
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
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 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
|
|
16
|
+
# Unit tests for DirectusSDK::UtilsApi
|
|
17
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
|
18
|
+
# Please update as you see appropriate
|
|
19
|
+
describe 'UtilsApi' do
|
|
20
|
+
before do
|
|
21
|
+
# run before each test
|
|
22
|
+
@instance = DirectusSDK::UtilsApi.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
after do
|
|
26
|
+
# run after each test
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe 'test an instance of UtilsApi' do
|
|
30
|
+
it 'should create an instance of UtilsApi' do
|
|
31
|
+
expect(@instance).to be_instance_of(DirectusSDK::UtilsApi)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# unit tests for get_hash
|
|
36
|
+
# Get a hashed value
|
|
37
|
+
#
|
|
38
|
+
# @param [Hash] opts the optional parameters
|
|
39
|
+
# @option opts [String] :string The string to be hashed
|
|
40
|
+
# @option opts [String] :hasher The hasher used to hash the given string
|
|
41
|
+
# @option opts [String] :options The hasher options
|
|
42
|
+
# @return [nil]
|
|
43
|
+
describe 'get_hash test' do
|
|
44
|
+
it "should work" do
|
|
45
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# unit tests for get_random
|
|
50
|
+
# Returns random alphanumeric string
|
|
51
|
+
#
|
|
52
|
+
# @param [Hash] opts the optional parameters
|
|
53
|
+
# @option opts [String] :length Integer(String) for length of random string
|
|
54
|
+
# @return [nil]
|
|
55
|
+
describe 'get_random test' do
|
|
56
|
+
it "should work" do
|
|
57
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
@@ -0,0 +1,226 @@
|
|
|
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 'spec_helper'
|
|
14
|
+
|
|
15
|
+
describe DirectusSDK::ApiClient do
|
|
16
|
+
context 'initialization' do
|
|
17
|
+
context 'URL stuff' do
|
|
18
|
+
context 'host' do
|
|
19
|
+
it 'removes http from host' do
|
|
20
|
+
DirectusSDK.configure { |c| c.host = 'http://example.com' }
|
|
21
|
+
expect(DirectusSDK::Configuration.default.host).to eq('example.com')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'removes https from host' do
|
|
25
|
+
DirectusSDK.configure { |c| c.host = 'https://wookiee.com' }
|
|
26
|
+
expect(DirectusSDK::ApiClient.default.config.host).to eq('wookiee.com')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'removes trailing path from host' do
|
|
30
|
+
DirectusSDK.configure { |c| c.host = 'hobo.com/v4' }
|
|
31
|
+
expect(DirectusSDK::Configuration.default.host).to eq('hobo.com')
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'base_path' do
|
|
36
|
+
it "prepends a slash to base_path" do
|
|
37
|
+
DirectusSDK.configure { |c| c.base_path = 'v4/dog' }
|
|
38
|
+
expect(DirectusSDK::Configuration.default.base_path).to eq('/v4/dog')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
|
42
|
+
DirectusSDK.configure { |c| c.base_path = '/v4/dog' }
|
|
43
|
+
expect(DirectusSDK::Configuration.default.base_path).to eq('/v4/dog')
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "ends up as a blank string if nil" do
|
|
47
|
+
DirectusSDK.configure { |c| c.base_path = nil }
|
|
48
|
+
expect(DirectusSDK::Configuration.default.base_path).to eq('')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe "params_encoding in #build_request" do
|
|
55
|
+
let(:config) { DirectusSDK::Configuration.new }
|
|
56
|
+
let(:api_client) { DirectusSDK::ApiClient.new(config) }
|
|
57
|
+
|
|
58
|
+
it "defaults to nil" do
|
|
59
|
+
expect(DirectusSDK::Configuration.default.params_encoding).to eq(nil)
|
|
60
|
+
expect(config.params_encoding).to eq(nil)
|
|
61
|
+
|
|
62
|
+
request = api_client.build_request(:get, '/test')
|
|
63
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "can be customized" do
|
|
67
|
+
config.params_encoding = :multi
|
|
68
|
+
request = api_client.build_request(:get, '/test')
|
|
69
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe "timeout in #build_request" do
|
|
74
|
+
let(:config) { DirectusSDK::Configuration.new }
|
|
75
|
+
let(:api_client) { DirectusSDK::ApiClient.new(config) }
|
|
76
|
+
|
|
77
|
+
it "defaults to 0" do
|
|
78
|
+
expect(DirectusSDK::Configuration.default.timeout).to eq(0)
|
|
79
|
+
expect(config.timeout).to eq(0)
|
|
80
|
+
|
|
81
|
+
request = api_client.build_request(:get, '/test')
|
|
82
|
+
expect(request.options[:timeout]).to eq(0)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "can be customized" do
|
|
86
|
+
config.timeout = 100
|
|
87
|
+
request = api_client.build_request(:get, '/test')
|
|
88
|
+
expect(request.options[:timeout]).to eq(100)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe "#deserialize" do
|
|
93
|
+
it "handles Array<Integer>" do
|
|
94
|
+
api_client = DirectusSDK::ApiClient.new
|
|
95
|
+
headers = {'Content-Type' => 'application/json'}
|
|
96
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
|
97
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
|
98
|
+
expect(data).to be_instance_of(Array)
|
|
99
|
+
expect(data).to eq([12, 34])
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "handles Array<Array<Integer>>" do
|
|
103
|
+
api_client = DirectusSDK::ApiClient.new
|
|
104
|
+
headers = {'Content-Type' => 'application/json'}
|
|
105
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
|
106
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
|
107
|
+
expect(data).to be_instance_of(Array)
|
|
108
|
+
expect(data).to eq([[12, 34], [56]])
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "handles Hash<String, String>" do
|
|
112
|
+
api_client = DirectusSDK::ApiClient.new
|
|
113
|
+
headers = {'Content-Type' => 'application/json'}
|
|
114
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
|
115
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
|
116
|
+
expect(data).to be_instance_of(Hash)
|
|
117
|
+
expect(data).to eq({:message => 'Hello'})
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
describe "#object_to_hash" do
|
|
122
|
+
it "ignores nils and includes empty arrays" do
|
|
123
|
+
# uncomment below to test object_to_hash for model
|
|
124
|
+
#api_client = DirectusSDK::ApiClient.new
|
|
125
|
+
#_model = DirectusSDK::ModelName.new
|
|
126
|
+
# update the model attribute below
|
|
127
|
+
#_model.id = 1
|
|
128
|
+
# update the expected value (hash) below
|
|
129
|
+
#expected = {id: 1, name: '', tags: []}
|
|
130
|
+
#expect(api_client.object_to_hash(_model)).to eq(expected)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
describe "#build_collection_param" do
|
|
135
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
|
136
|
+
let(:api_client) { DirectusSDK::ApiClient.new }
|
|
137
|
+
|
|
138
|
+
it "works for csv" do
|
|
139
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
it "works for ssv" do
|
|
143
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
it "works for tsv" do
|
|
147
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it "works for pipes" do
|
|
151
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it "works for multi" do
|
|
155
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it "fails for invalid collection format" do
|
|
159
|
+
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
describe "#json_mime?" do
|
|
164
|
+
let(:api_client) { DirectusSDK::ApiClient.new }
|
|
165
|
+
|
|
166
|
+
it "works" do
|
|
167
|
+
expect(api_client.json_mime?(nil)).to eq false
|
|
168
|
+
expect(api_client.json_mime?('')).to eq false
|
|
169
|
+
|
|
170
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
|
171
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
|
172
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
|
173
|
+
|
|
174
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
|
175
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
|
176
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
describe "#select_header_accept" do
|
|
181
|
+
let(:api_client) { DirectusSDK::ApiClient.new }
|
|
182
|
+
|
|
183
|
+
it "works" do
|
|
184
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
|
185
|
+
expect(api_client.select_header_accept([])).to be_nil
|
|
186
|
+
|
|
187
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
|
188
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
|
189
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
|
190
|
+
|
|
191
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
|
192
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
describe "#select_header_content_type" do
|
|
197
|
+
let(:api_client) { DirectusSDK::ApiClient.new }
|
|
198
|
+
|
|
199
|
+
it "works" do
|
|
200
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
|
201
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
|
202
|
+
|
|
203
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
|
204
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
|
205
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
|
206
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
|
207
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
describe "#sanitize_filename" do
|
|
212
|
+
let(:api_client) { DirectusSDK::ApiClient.new }
|
|
213
|
+
|
|
214
|
+
it "works" do
|
|
215
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
|
216
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
|
217
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
|
218
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
|
219
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
|
220
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
|
221
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
|
222
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
|
223
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|