/zendesk_help_center_api_client_rb

Zendesk Help Center REST API Client

Primary LanguageRubyApache License 2.0Apache-2.0

Zendesk HelpCenter API Client

This gem added support for Zendesk Help Center methods under ZendeskAPI::Client gem.

To experiment with that code, run bin/console for an interactive prompt.

Installation

Add this line to your application's Gemfile:

gem 'zendesk_help_center_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install zendesk_help_center_api

Usage

require 'zendesk_api/help_center'

Zendesk CLient

client = ZendeskAPI::Client.new do |config|
  config.url = "<- your-zendesk-url ->" # e.g. https://mydesk.zendesk.com/api/v2
  config.username = "login.email@zendesk.com"
  config.password = "your zendesk password"
end

Help Center

Categories

categories = client.hc_categories
category = categories.build(name: 'Test Category')
category.save
category.update(description: 'This is a test')
category.destroy

Sections

sections = category.sections
section = sections.first
category.update(name: 'This is a test')

Articles

articles = section.articles
articles.build(title: 'Test Article')
category.update(body: 'This is a test')
article.destroy

Help Center Translations

Translations represent the content in all supported languages of a Help Center item such as an article or a section. The default language is also included in the translations.

categories_tr = category.translations
category_tr = categories_tr.build(locale: 'uk', title: 'Тестова Стаття', body: '')
category_tr.save

sections_tr = sections.translations
section_tr = article_tr.build(locale: 'uk', title: 'Це тест', body: '')
section_tr.save

articles_tr = article.translations
article_tr = article_translations.build(locale: 'uk', title: 'Тестова Стаття', body: '')
article_tr.save

Development

After checking out the repo, run bin/setup to install dependencies. Then, 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, run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/mamantoha/zendesk_help_center_api_client_rb/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License and Author

Copyright: 2015-2017 Anton Maminov

This project is licensed under the Apache License, a copy of which can be found in the LICENSE file.