Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support for tags resource #87

Closed
wants to merge 1 commit into from

2 participants

@benilovj

This is conversation starter, rather than finished code.

I would like to be able to use the gem to access the Tags resource. I would like to contribute a fix for this, however I'm not sure about what I should test, etc.

I'm assuming that I wouldn't be able to run the "live" specs locally - would I need Zendesk-internal systems?

@steved
Owner

You're welcome to run the live specs against your own zendesk test account if you'd like, but yeah otherwise you'd need internal resources. Just need valid basic auth credentials in spec/fixtures/credentials.yml and you should be able run rake spec:live.

The addition to resources.rb would allow the following client.tags. However, the CUD methods of the tags CRUD
are only applicable when used as a sub-resource to organizations, topics, and tickets. I think there would have to be some special handling before we'd able to do something like:

class Organization
  has_many Tag
end

organization = client.organizations.first
organization.tags = ["tag1"] # POST /api/v2/organizations/1/tags with the payload { "tags": ["tag1"] }
organization.tags.push("tag1") # PUT /api/v2/organizations/1/tags with the payload { "tags": ["tag1"] }
organization.tags.delete("tag1") # DELETE /api/v2/organizations/1/tags with the payload { "tags": ["tag1"] }
@steved steved closed this
@benilovj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 20, 2013
  1. @benilovj

    support for tags resource

    benilovj authored
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 0 deletions.
  1. +1 −0  lib/zendesk_api/resources.rb
  2. +13 −0 spec/live/tag_spec.rb
View
1  lib/zendesk_api/resources.rb
@@ -26,6 +26,7 @@ class Ability < DataResource; end
class Group < Resource; end
class SharingAgreement < ReadResource; end
class JobStatus < ReadResource; end
+ class Tag < Resource; end
class Attachment < Data
def initialize(client, attributes)
View
13 spec/live/tag_spec.rb
@@ -0,0 +1,13 @@
+require 'core/spec_helper'
+raise "boop"
+describe ZendeskAPI::Tag, :delete_after do
+ # def valid_attributes
+ # { :name => "My Forum", :forum_type => "articles", :access => "logged-in users", :category_id => category.id }
+ # end
+
+ # it_should_be_creatable
+ # it_should_be_updatable :name
+ # # Forum delete jobs are queued, so don't look for it
+ # it_should_be_deletable :find => false
+ it_should_be_readable :tags, :create => true
+end
Something went wrong with that request. Please try again.