module Typetalk::Api::Topic

Public Instance Methods

favorite_topic(topic_id, options={}) click to toggle source
# File lib/typetalk/api/topic.rb, line 42
def favorite_topic(topic_id, options={})
  options = {token:nil}.merge(options)

  response = connection.post do |req|
    req.url "#{endpoint}/topics/#{topic_id}/favorite"
    req.params[:access_token] = options[:token] || access_token
  end
  parse_response(response)
end
get_topic(topic_id, options={}) click to toggle source
# File lib/typetalk/api/topic.rb, line 17
def get_topic(topic_id, options={})
  options = {token:nil, count:nil, from:nil, direction:nil}.merge(options)

  response = connection.get do |req|
    req.url "#{endpoint}/topics/#{topic_id}"
    req.params[:access_token] = options[:token] || access_token
    req.params[:count] = options[:count] unless options[:count].nil?
    req.params[:from] = options[:from] unless options[:from].nil?
    req.params[:direction] = options[:direction] unless options[:direction].nil?
  end
  parse_response(response)
end
get_topic_members(topic_id, options={}) click to toggle source
# File lib/typetalk/api/topic.rb, line 31
def get_topic_members(topic_id, options={})
  options = {token:nil}.merge(options)

  response = connection.get do |req|
    req.url "#{endpoint}/topics/#{topic_id}/members/status"
    req.params[:access_token] = options[:token] || access_token
  end
  parse_response(response)
end
get_topics(options={}) click to toggle source
# File lib/typetalk/api/topic.rb, line 6
def get_topics(options={})
  options = {token:nil}.merge(options)

  response = connection.get do |req|
    req.url "#{endpoint}/topics"
    req.params[:access_token] = options[:token] || access_token
  end
  parse_response(response)
end
unfavorite_topic(topic_id, options={}) click to toggle source
# File lib/typetalk/api/topic.rb, line 53
def unfavorite_topic(topic_id, options={})
  options = {token:nil}.merge(options)

  response = connection.delete do |req|
    req.url "#{endpoint}/topics/#{topic_id}/favorite"
    req.params[:access_token] = options[:token] || access_token
  end
  parse_response(response)
end