Module: Typetalk::Api::Topic
- Included in:
- Typetalk::Api
- Defined in:
- lib/typetalk/api/topic.rb
Instance Method Summary collapse
- #favorite_topic(topic_id, options = {}) ⇒ Object
- #get_topic(topic_id, options = {}) ⇒ Object
- #get_topic_members(topic_id, options = {}) ⇒ Object
- #get_topics(options = {}) ⇒ Object
- #unfavorite_topic(topic_id, options = {}) ⇒ Object
Instance Method Details
#favorite_topic(topic_id, options = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/typetalk/api/topic.rb', line 42 def favorite_topic(topic_id, ={}) = {token:nil}.merge() response = connection.post do |req| req.url "#{endpoint}/topics/#{topic_id}/favorite" req.params[:access_token] = [:token] || access_token end parse_response(response) end |
#get_topic(topic_id, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/typetalk/api/topic.rb', line 17 def get_topic(topic_id, ={}) = {token:nil, count:nil, from:nil, direction:nil}.merge() response = connection.get do |req| req.url "#{endpoint}/topics/#{topic_id}" req.params[:access_token] = [:token] || access_token req.params[:count] = [:count] unless [:count].nil? req.params[:from] = [:from] unless [:from].nil? req.params[:direction] = [:direction] unless [:direction].nil? end parse_response(response) end |
#get_topic_members(topic_id, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/typetalk/api/topic.rb', line 31 def get_topic_members(topic_id, ={}) = {token:nil}.merge() response = connection.get do |req| req.url "#{endpoint}/topics/#{topic_id}/members/status" req.params[:access_token] = [:token] || access_token end parse_response(response) end |
#get_topics(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/typetalk/api/topic.rb', line 6 def get_topics(={}) = {token:nil}.merge() response = connection.get do |req| req.url "#{endpoint}/topics" req.params[:access_token] = [:token] || access_token end parse_response(response) end |
#unfavorite_topic(topic_id, options = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/typetalk/api/topic.rb', line 53 def unfavorite_topic(topic_id, ={}) = {token:nil}.merge() response = connection.delete do |req| req.url "#{endpoint}/topics/#{topic_id}/favorite" req.params[:access_token] = [:token] || access_token end parse_response(response) end |