Skip to content

yatmsu/docbase-ruby

 
 

Repository files navigation

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')

or

ENV['DOCBASE_ACCESS_TOKEN'] = 'your_access_token'

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

teams

client.teams.body
# => [{ domain: 'kray', name: 'kray' }, { domain: 'danny', name: 'danny' }]

tags

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

groups

client.groups.body
# => [{ id: 1, name: 'DocBase' }, { id: 2, name: 'kray' }]

posts

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

client.posts(params).body
# => {
#   id: 1,
#   title: 'memo title',
#   body: 'memo body',
#   draft: false,
#   url: 'https://kray.docbase.io/posts/1',
#   created_at: '2015-03-10T12:01:54+09:00',
#   tags: [
#     { name: 'rails' },
#     { name: 'ruby' },
#   ],
#   scope: 'group',
#   groups: [
#     { name: 'DocBase' }
#   ],
#   user: {
#     id: 1,
#     name: 'danny'
#   },
# }

switch team

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

client.team = 'danny'
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.

About

DocBase API Client, written in Ruby

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 98.1%
  • Shell 1.9%