Skip to content
Helper library for working with the Salesforce Knowledge Base
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
exe
lib
test
.gitignore
.projections.json
.ruby-version
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Gemfile
LICENSE.txt
README.md
Rakefile
_config.yml
sfkb.gemspec

README.md

SFKB

SalesForce Knowledge Base

A Ruby library that extends Restforce to provide convenient access to Articles and ArticlesVersions in the Salesforce Knowledge Base.

Build Status Test Coverage Maintainability Dependency Status Gem Version License

Requirements

Installation

gem install sfkb

Usage

Include it in your project, for example in your Gemfile

gem 'sfkb'

or just require it.

Now you can use the module as a client, or do something fancier by instantiating a SFKB::Client.

For example, here's how to print the titles of the master versions of the first 10 documents:

require 'sfkb'
SFKB.new.articles.take(10).each { |a| puts a.OnlineMasterVersion.data.Title }

Here's how to list the titles of every translation of every draft article:

sf = SFKB.new
sf.articles.select(:hasTranslations?) do |a|
    sf.translations(a, 'Draft').each do |t|
        puts t.data.Title
    end
end

Documentation is available here.

You will need to register an app in your Salesforce instance so you can obtain your SALESFORCE_CLIENT_ID and SALESFORCE_CLIENT_SECRET (see below).

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bjjb/sfkb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Testing

When testing, you'll want to preconfigure your environment with these settings:

  • SALESFORCE_CLIENT_ID
  • SALESFORCE_CLIENT_SECRET

You might also want to set the following (which defaults to 'login.salesforce.com) to something like 'company.my.salesforce.com', or 'test.salesforce.com' if you want to use a sandbox.

  • SALESFORCE_HOST

For authentication, you may either use the username/password/token-secret combination:

  • SALESFORCE_USERNAME
  • SALESFORCE_PASSWORD
  • SALESFORCE_SECURITY_TOKEN

or

  • SALESFORCE_OAUTH_TOKEN
  • SALESFORCE_REFRESH_TOKEN

the latter of which is optional, and can (and probably should) be set using the authentication_callback. For more details, see Restforce.

License

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

Code of Conduct

Everyone interacting in the Glinga project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

You can’t perform that action at this time.