=begin #HubDB endpoints #HubDB is a relational data store that presents data as rows, columns, and cells in a table, much like a spreadsheet. HubDB tables can be added or modified [in the HubSpot CMS](https://knowledge.hubspot.com/cos-general/how-to-edit-hubdb-tables), but you can also use the API endpoints documented here. For more information on HubDB tables and using their data on a HubSpot site, see the [CMS developers site](https://designers.hubspot.com/docs/tools/hubdb). You can also see the [documentation for dynamic pages](https://designers.hubspot.com/docs/tutorials/how-to-build-dynamic-pages-with-hubdb) for more details about the `useForPages` field. HubDB tables support `draft` and `live` versions and you can publish and unpublish the live version. This allows you to update data in the table, either for testing or to allow for a manual approval process, without affecting any live pages using the existing data. Draft data can be reviewed, pushed to live version, and published by a user working in HubSpot or published via the API. Draft data can also be discarded, allowing users to go back to the live version of the data without disrupting it. If a table is set to be `allowed for public access`, you can access the published version of the table and rows without any authentication. The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'spec_helper' require 'json' # Unit tests for Hubspot::Cms::Hubdb::TablesApi # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe 'TablesApi' do before do # run before each test @api_instance = Hubspot::Cms::Hubdb::TablesApi.new end after do # run after each test end describe 'test an instance of TablesApi' do it 'should create an instance of TablesApi' do expect(@api_instance).to be_instance_of(Hubspot::Cms::Hubdb::TablesApi) end end # unit tests for archive_table # Archive a table # Archive (soft delete) an existing HubDB table. This archives both the live and draft versions. # @param table_id_or_name The ID or name of the table to archive. # @param [Hash] opts the optional parameters # @return [nil] describe 'archive_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for clone_draft_table # Clone a table # Clone an existing HubDB table. The `newName` and `newLabel` of the new table can be sent as JSON in the `body` parameter. This will create the cloned table as a `draft`. # @param table_id_or_name The ID or name of the table to clone. # @param hub_db_table_clone_request JSON object with the properties newName and newLabel. You can set copyRows to false to clone the table with copying rows and default is true. # @param [Hash] opts the optional parameters # @return [HubDbTableV3] describe 'clone_draft_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for create_table # Create a new table # Creates a new draft HubDB table given a JSON schema. The table name and label should be unique for each account. # @param hub_db_table_v3_input The JSON schema for the table being created. # @param [Hash] opts the optional parameters # @return [HubDbTableV3] describe 'create_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for export_draft_table # Export a draft table # Exports the `draft` version of a table to CSV / EXCEL format. # @param table_id_or_name The ID or name of the table to export. # @param [Hash] opts the optional parameters # @option opts [String] :format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. # @return [File] describe 'export_draft_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for export_table # Export a published version of a table # Exports the `live` version of a table to CSV / EXCEL format. # @param table_id_or_name The ID or name of the table to export. # @param [Hash] opts the optional parameters # @option opts [String] :format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. # @return [File] describe 'export_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for get_all_draft_tables # Return all draft tables # Returns the details for each draft table defined in the specified account, including column definitions. # @param [Hash] opts the optional parameters # @option opts [DateTime] :updated_after Only return tables last updated after the specified time. # @option opts [DateTime] :updated_before Only return tables last updated before the specified time. # @option opts [Array] :sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. # @option opts [DateTime] :created_at Only return tables created at exactly the specified time. # @option opts [DateTime] :created_after Only return tables created after the specified time. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. # @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to `false`. # @option opts [DateTime] :created_before Only return tables created before the specified time. # @option opts [DateTime] :updated_at Only return tables last updated at exactly the specified time. # @option opts [Integer] :limit The maximum number of results to return. Default is 1000. # @return [CollectionResponseWithTotalHubDbTableV3ForwardPaging] describe 'get_all_draft_tables test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for get_all_tables # Get all live tables # Returns the details for the `live` version of each table defined in an account, including column definitions. # @param [Hash] opts the optional parameters # @option opts [DateTime] :updated_after Only return tables last updated after the specified time. # @option opts [DateTime] :updated_before Only return tables last updated before the specified time. # @option opts [Array] :sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. # @option opts [DateTime] :created_at Only return tables created at exactly the specified time. # @option opts [DateTime] :created_after Only return tables created after the specified time. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. # @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to `false`. # @option opts [DateTime] :created_before Only return tables created before the specified time. # @option opts [DateTime] :updated_at Only return tables last updated at exactly the specified time. # @option opts [Integer] :limit The maximum number of results to return. Default is 1000. # @return [CollectionResponseWithTotalHubDbTableV3ForwardPaging] describe 'get_all_tables test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for get_draft_table_details_by_id # Get details for a draft table # Get the details for the `draft` version of a specific HubDB table. This will include the definitions for the columns in the table and the number of rows in the table. # @param table_id_or_name The ID or name of the table to return. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Set this to `true` to return an archived table. Defaults to `false`. # @option opts [Boolean] :include_foreign_ids Set this to `true` to populate foreign ID values in the result. # @return [HubDbTableV3] describe 'get_draft_table_details_by_id test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for get_table_details # Get details for a live table # Returns the details for the `live` version of the specified table. This will include the definitions for the columns in the table and the number of rows in the table. **Note:** This endpoint can be accessed without any authentication if the table is set to be allowed for public access. # @param table_id_or_name The ID or name of the table to return. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Set this to `true` to return details for an archived table. Defaults to `false`. # @option opts [Boolean] :include_foreign_ids Set this to `true` to populate foreign ID values in the result. # @return [HubDbTableV3] describe 'get_table_details test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for import_draft_table # Import data into draft table # Import the contents of a CSV file into an existing HubDB table. The data will always be imported into the `draft` version of the table. Use `/push-live` endpoint to push these changes to `live` version. This endpoint takes a multi-part POST request. The first part will be a set of JSON-formatted options for the import and you can specify this with the name as `config`. The second part will be the CSV file you want to import and you can specify this with the name as `file`. Refer the overview section to check the details and format of the JSON-formatted options for the import. # @param table_id_or_name The ID of the destination table where data will be imported. # @param [Hash] opts the optional parameters # @option opts [File] :file The source CSV file to be imported. # @option opts [String] :config Configuration for the import in JSON format as described above. # @return [ImportResult] describe 'import_draft_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for publish_draft_table # Publish a table from draft # Copies the data from draft to live version of the table and also publishes the live version. This will immediately push the data to the `live` version of the table and publishes the live version, meaning any website pages using data from the table will be updated. # @param table_id_or_name The ID or name of the table to publish. # @param [Hash] opts the optional parameters # @option opts [Boolean] :include_foreign_ids Set this to `true` to populate foreign ID values in the response. # @return [HubDbTableV3] describe 'publish_draft_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for reset_draft_table # Reset a draft table # Replaces the data in the `draft` version of the table with values from the `live` version. Any unpublished changes in the `draft` will be lost after this call is made. # @param table_id_or_name The ID or name of the table to reset. # @param [Hash] opts the optional parameters # @option opts [Boolean] :include_foreign_ids Set this to `true` to populate foreign ID values in the response. # @return [HubDbTableV3] describe 'reset_draft_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for update_draft_table # Update an existing table # Update an existing HubDB table. You can use this endpoint to add or remove columns to the table. Tables updated using the endpoint will only modify the `draft` verion of the table. Use `push-live` endpoint to push all the changes to the `live` version. **Note:** You need to include all the columns in the input when you are adding/removing/updating a column. If you do not include an already existing column in the request, it will be deleted. # @param table_id_or_name The ID or name of the table to update. # @param hub_db_table_v3_input The JSON schema for the table being updated. # @param [Hash] opts the optional parameters # @option opts [Boolean] :include_foreign_ids Set this to `true` to populate foreign ID values in the result. # @return [HubDbTableV3] describe 'update_draft_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for update_table # Publish or unpublish a live version of a table or restore an archived table # Use this endpoint to perform one of the following <ul><li> Publish a live version of a table (without copying table data from draft) </li><li>Un-publish a live version of a table (Leaving the data in the live version)</li><li>Restore an archived table</li></ul> To publish a table, send `published` property in the JSON object with the value `true`. To unpublish a table, send `published` property in the JSON object with the value `false`. To restore an archived table, send `archived` property in the JSON object with the value `false` along with the query parameter `archived=true`. When restoring an archived table, if an active table already exists with the same `name` or `label`, you will need to change the name of the archived table when restoring it using the `name` and `label` parameters with a new name and new label. When you restore a table, the table will be restored only in the `draft` version. Examples: Publish live version of a table: ``` { \"published\": true } ``` Unpublish live version of a table: ``` { \"published\": false } ``` Restore a table: (send `archived=true` in query parameters) ``` { \"archived\": false } ``` Restore a table with a new name: (send `archived=true` in query parameters) ``` { \"label\": \"New Table Name\", \"name\": \"new_table_name\", \"archived\": false } ``` # @param table_id_or_name The ID or name of the table to return. # @param hub_db_table_v3_live_input The JSON object as described. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Whether to return only results that have been archived. # @option opts [Boolean] :include_foreign_ids Set this to `true` to populate foreign ID values in the result. # @return [HubDbTableV3] describe 'update_table test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end