Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/seatable_ruby. To experiment with that code, run bin/console for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
Install the gem and add to the application's Gemfile by executing:
$ bundle add seatable_ruby
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install seatable_ruby
- create a file with any name (whatever you like) in the
initializersfolder. - add the following lines to this file:
require 'seatable_ruby' SeatableRuby.config do |c| c.api_token = ENV['SEATABLE_API_TOKEN'] .... c.account_token = ENV['SEATABLE_ACCOUNT_TOKEN'] # If you know your account_token. OR/AND c.account_credentials = { # To get an account_token username: ENV['SEATABLE_USERNAME'], password: ENV['SEATABLE_PASSWORD'] .... # If setup the account_credentials and account_token data, # then gem will works with account_credentials only. # More info about priorities in the `Account` section. } end
NOTE: Put your seatable data into ENV['SEATABLE_...']. You can do it by using the dotenv-rails gem OR use master.key and credentials.yml.enc if you rails version is 5.0 +.
- Account token:
- Method - [POST]
- There are 3 options to get account_token. If all of them defined, then gem will works in the next priorities:
- [1]: pass seatable account credentials =>
SeatableRuby::Account.new({ username: 'email address', password: 'passsword' }).account_token=>token_string - [2]: set seatable
account_credentialsinto/config/initializers/seatable.rb(take a look Config section) =>SeatableRuby::Account.new.account_token=>token_string - [3]: set seatable
account_tokeninto/config/initializers/seatable.rb(take a look Config section) =>SeatableRuby::Account.new.account_token=>token_string
- [1]: pass seatable account credentials =>
- More api info here
-
Get Base Info:
- Method - [GET]
- Instance method -
basic_info - More api info here
-
Get Metadata:
- Method - [GET]
- Instance method -
basic_metadata - More api info here
-
Get Big Data Status:
- Method - [GET]
- Instance method -
basic_big_data_status - More api info here
- Get Big Data Status:
- Method - [GET]
- Instance method -
list_columns(query_params)- Required
query_paramsis{ table_name: '...' } - All
query_paramsare{ table_name: '...', view_name: '...' }
- Required
- More api info here
-
Export Base:
- Method - [GET]
- Instance method -
export_base(path_params, query_params)- Required
path_paramsis{ workspace_id: '..' } - Required
query_paramsis{ dtable_name: 'base name' }
- Required
- NOTE: in the api they show us the
:base_namekey for some reason, but work version is the:dtable_namekey - More api info here
-
Export Table:
- Method - [GET]
- Instance method -
export_table(path_params, query_params)- Required
path_paramsis{ workspace_id: '..' } - Required
query_paramsis{ table_id: 'xxxx', table_name: '', dtable_name: '...'] }
- Required
- NOTE: in the api they show us the
:base_namekey for some reason, but work version is the:dtable_namekey - More api info here
-
Export View:
- Method - [GET]
- Instance method -
export_view(path_params, query_params)- Required
path_paramsis{ workspace_id: '..' } - Required
query_paramsis{ table_id: "xxxx", table_name: '...', dtable_name: 'name of your base', view_id: '', view_name: 'name of view' }
- Required
- NOTE: in the api they show us the
:base_namekey for some reason, but work version is the:dtable_namekey - More api info here
-
List Rows(with SQL):
- Method - [POST]
- Instance method -
list_rows_with_sql(body_params)- Required
body_paramsare{ sql: '...', convert_keys: boolean }
- Required
- More api info here
-
List Rows:
- Method - [GET]
- Instance method -
list_rows(query_params)- Required
query_paramsis{ table_name: '...' } - All
query_paramsare{ table_name: '...', view_name: '...', convert_link_id: '...', order_by: '...', direction: '...', start: '...', limit: '...' }
- Required
- NOTE: The response returns only up to 1.000 rows, even if limit is set to more than 1.000. This request can not return rows from the big data backend. User the request List Rows (with SQL) instead.
- More api info here
-
Append Row:
- Method - [POST]
- Instance method -
append_row(body_params)- Required
body_paramsare{ table_name: '...', row: { row data } }
- Required
- More api info here
-
Insert Row:
- Method - [POST]
- Instance method -
insert_row(body_params)- Required
body_paramsare{ table_name: '...', row: { row data } } - All params:
body_paramsare{ table_name: '...', anchor_row_id: '...', row_insert_position: '...', row: { row data } }
- Required
- More api info here
-
Update Row:
- Method - [PUT]
- Instance method -
update_row(body_params)- Required
body_paramsare{ table_name: '...', row_id: '...', row: { row data }] }
- Required
- More api info here
-
Delete Row:
- Method - [DELETE]
- Instance method -
delete_row(body_params)- Required
body_paramsare{ table_name: '...', row_id: '...' }
- Required
- More api info here
-
Get Row:
- Method - [GET]
- Instance method -
get_row(path_params, query_params)- Required
path_paramsis{ row_id: '...' } - Required
query_paramsis{ table_name: '...' } - All
query_paramsare{ table_name: '...', convert: boolean }
- Required
- More api info here
-
Batch Append Rows:
- Method - [POST]
- Instance method -
append_rows(body_params)- Required
body_paramsare{ table_name: '..', rows: [...] }
- Required
- More api info here
-
Batch Update Rows:
- Method - [PUT]
- Instance method -
update_rows(body_params)- Required
body_paramsare{ table_name: '...', updates: [ row_id: '...', row: { "Name":"Max", "Age":"21" } ] }
- Required
- More api info here
-
Batch Delete Rows:
- Method - [DELETE]
- Instance method -
delete_rows(body_params)- Required
body_paramsare{ table_name: '...', row_ids: ['..', '..'] }
- Required
- More api info here
-
Lock Rows:
- Method - [PUT]
- Instance method -
lock_rows(body_params)- Required
body_paramsare{ table_name: '...', row_ids: [ '..', '..' ] } - NOTE: Lock rows is an advanced feature in SeaTable and only available for
enterprisesubscriptions.
- Required
- More api info here
-
Unlock Rows:
- Method - [PUT]
- Instance method -
unlock_rows(body_params)- Required
body_paramsare{ table_name: '...', row_ids: [ '..', '..' ] }
- Required
- More api info here
-
List Views:
- Method - [GET]
- Instance method -
list_views(query_params)- Required
query_paramsis{ table_name: '...' }
- Required
- More api info here
-
Create View:
- Method - [POST]
- Instance method -
create_view(query_params, body_params)- Required
query_paramsis{ table_name: '...' } - Required
body_paramsare{ name: '...', type: 'table|archive' } - All
body_paramsare{ name: '...', type: 'table|archive', is_locked: boolean }
- Required
- More api info here
-
Get View:
- Method - [GET]
- Instance method -
get_view(path_params, query_params)- Required
path_paramsis{ view_name: '...' } - Required
query_paramsis{ table_name: '...' }
- Required
- More api info here
After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/viktorMarkevich/seatable_ruby.