Skip to content

Commit a81e575

Browse files
authored
Add Article::Label resource (#511)
Per the [API docs](https://developer.zendesk.com/api-reference/help_center/help-center-api/article_labels/), we are able to list / add / remove labels from articles. This adds support for those endpoints to this client.
1 parent 275f78a commit a81e575

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/zendesk_api/resources.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ class Vote < Resource; end
228228
has_many Vote
229229
class Translation < Resource; end
230230
has_many Translation
231+
class Label < DataResource
232+
include Read
233+
include Create
234+
include Destroy
235+
end
236+
has_many Label
231237
end
232238

233239
class TopicSubscription < Resource

spec/live/article_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
expect(article.translations.map(&:locale)).to include("fr")
1212
end
1313

14+
it "can have labels", :vcr do
15+
label = article.labels.create!(name: "ruby-client-test-label")
16+
17+
expect(article.labels.map(&:name)).to include(label.name)
18+
ensure # Cleanup
19+
label&.destroy
20+
end
21+
1422
describe "creating articles within a section" do
1523
def valid_attributes
1624
{ :name => "My Article", user_segment_id: nil, permission_group_id: 2801272, title: "My super article" }

0 commit comments

Comments
 (0)