Project

docbase

0.01
No commit activity in last 3 years
No release in over 3 years
DocBase API Client, written in Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.15.2
 Project Readme

docbase-ruby

Build Status

DocBase API Client, written in Ruby.

Installation

Add this line to your application's Gemfile:

gem 'docbase'

And then execute:

$ bundle

Or install it yourself as:

$ gem install docbase

Usage

client = DocBase::Client.new(access_token: 'your_access_token', team: 'your_team')

Docbase::Client.new options

  • access_token
    • access token
  • team
    • team subdomain
  • retry_on_rate_limit_exceeded
    • #16
    • true or false

users

client.users(q: 'name')
client.users(q: 'name', page: 2)
client.users(q: 'name', page: 1, per_page: 100)
client.users(q: 'name', page: 1, per_page: 100, include_user_groups: true)

tags

client.tags.body
# => [{ name: 'ruby' }, { name: 'rails' }]

groups

List

client.groups.body
client.groups(name: 'developers').body
client.groups(page: 2, per_page: 10).body

Show

client.group(1).body

Create

params = {
  name: 'group',
  description: 'Important group.',
}

client.create_group(params)

Add users to group

params = {
  group_id: 1,
  user_ids: [10, 11, 12]
}

client.add_users_to_group(params)

Remove users from group

params = {
  group_id: 1,
  user_ids: [10, 11, 12]
}

client.remove_users_from_group(params)

posts

Search

client.posts(q: 'body')
client.posts(q: 'body', page: 2)
client.posts(q: 'body', page: 1, per_page: 100)

Show

client.post(1)

Create

params = {
  title: 'memo title',
  body: 'memo body',
  draft: false,
  tags: ['rails', 'ruby'],
  scope: 'group',
  groups: [1],
  notice: true,
}

client.create_post(params)

Update

params = {
  id: 1,
  title: 'memo title',
  body: 'memo body',
  draft: false,
  tags: ['rails', 'ruby'],
  scope: 'group',
  groups: [1],
  notice: true,
}

client.update_post(params)

Archive

client.archive_post(1)

Unarchive

client.unarchive_post(1)

Delete

client.delete_post(1)

Comment

Create

params = {
  post_id: 1,
  body: 'GJ!!',
  notice: true,
}

client.create_comment(params)

Delete

client.delete_comment(1)

attachments

Create

client.upload('./test.jpg')
client.upload(['./test.jpg', './README.md'])

Download

response = client.attachment(file_id)
File.open(file_id, 'wb') { |f| f.write(response.body) }

switch team

client = DocBase::Client.new(access_token: 'your_access_token', team: 'kray')
client.tags.body
# => [{ name: 'ruby' }, { name: 'rails' }]

client.team = 'danny'
client.access_token = 'danny_team_access_token'
client.tags.body
# => [{ name: 'javascript' }, { name: 'react' }]

API Document

https://help.docbase.io/posts/45703

License

The gem is available as open source under the terms of the MIT License.