Module: Assistly::Client::Topic
- Included in:
- Assistly::Client
- Defined in:
- lib/assistly/client/topic.rb
Overview
Defines methods related to topics
Instance Method Summary collapse
-
#create_topic(name, *args) ⇒ Object
Creates a new topic.
-
#delete_topic(id) ⇒ Object
Deletes a single topic.
-
#topic(id, *args) ⇒ Object
Returns extended information on a single topic.
-
#topics(*args) ⇒ Object
Returns extended information of topics.
-
#update_topic(id, *args) ⇒ Object
Updates a single topic.
Instance Method Details
#create_topic(name, *args) ⇒ Object
Creates a new topic
@param name [String] A topic name @option options [Hash] @example Creates a new topic Assistly.create_topic("name") Assistly.create_topic("name", :description => "description")
47 48 49 50 51 52 53 54 55 |
# File 'lib/assistly/client/topic.rb', line 47 def create_topic(name, *args) = args.last.is_a?(Hash) ? args.pop : {} response = post("topics",) if response['success'] return response['results']['topic'] else return response end end |
#delete_topic(id) ⇒ Object
Deletes a single topic
@param id [Integer] a topic ID @example Deletes topic 12345 Assistly.update_topic(12345, :subject => "New Subject")
84 85 86 87 |
# File 'lib/assistly/client/topic.rb', line 84 def delete_topic(id) response = delete("topics/#{id}") response end |
#topic(id, *args) ⇒ Object
Returns extended information on a single topic
@param id [Integer] a topic ID @option options [Hash] @example Return extended information for 12345 Assistly.topic(12345) Assistly.topic(12345, :by => "external_id")
31 32 33 34 35 |
# File 'lib/assistly/client/topic.rb', line 31 def topic(id, *args) = args.last.is_a?(Hash) ? args.pop : {} response = get("topics/#{id}",) response.topic end |
#topics(*args) ⇒ Object
Returns extended information of topics
@option options [Boolean, String, Integer] @example Return extended information for 12345 Assistly.topics Assistly.topics(:count => 5) Assistly.topics(:count => 5, :page => 3)
15 16 17 18 19 |
# File 'lib/assistly/client/topic.rb', line 15 def topics(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get("topics",) response end |
#update_topic(id, *args) ⇒ Object
Updates a single topic
@param id [Integer] a topic ID @option options [String] @example Updates information for topic 12345 Assistly.update_topic(12345, :subject => "New Subject")
66 67 68 69 70 71 72 73 74 |
# File 'lib/assistly/client/topic.rb', line 66 def update_topic(id, *args) = args.last.is_a?(Hash) ? args.pop : {} response = put("topics/#{id}",) if response['success'] return response['results']['topic'] else return response end end |