Class: ReamazeAPI::Article
- Defined in:
- lib/reamaze_api/article.rb
Instance Method Summary collapse
-
#all(params = {}) ⇒ Object
Public: Retrieves KB articles.
-
#create(params) ⇒ Object
Public: Create a new KB article.
-
#find(slug) ⇒ Object
Public: Retrieves a specific KB article.
-
#update(slug, params) ⇒ Object
Public: Update an existing KB article.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from ReamazeAPI::Resource
Instance Method Details
#all(params = {}) ⇒ Object
Public: Retrieves KB articles.
params - Hash of parameters to pass to the API
API Routes
GET /articles
GET /topics/{slug}/articles
See also: www.reamaze.com/api/get_articles
Returns a Hash.
15 16 17 18 19 20 |
# File 'lib/reamaze_api/article.rb', line 15 def all(params = {}) params = Utils.symbolize_hash(params) url = articles_path(params.delete(:topic)) paginate url, :articles, params end |
#create(params) ⇒ Object
Public: Create a new KB article.
params - Hash of parameters to pass to the API
API Routes
POST /articles (no topic)
POST /topics/{slug}/articles
See also: www.reamaze.com/api/post_article
Returns a Hash.
49 50 51 52 53 |
# File 'lib/reamaze_api/article.rb', line 49 def create(params) params = Utils.symbolize_hash(params) post articles_path(params.delete(:topic)), params end |
#find(slug) ⇒ Object
Public: Retrieves a specific KB article.
slug - Article slug
API Routes
GET /articles/{slug}
See also: www.reamaze.com/api/get_article
Returns a Hash.
33 34 35 |
# File 'lib/reamaze_api/article.rb', line 33 def find(slug) get "/articles/#{slug}" end |
#update(slug, params) ⇒ Object
Public: Update an existing KB article.
slug - Article slug params - Hash of parameters to pass to the API
API Routes
PUT /articles/{slug}
See also: www.reamaze.com/api/put_article
Returns a Hash.
67 68 69 |
# File 'lib/reamaze_api/article.rb', line 67 def update(slug, params) put "/articles/#{slug}", params end |