Module: TheCity::API::Topics
Instance Method Summary collapse
-
#post_topic(options) ⇒ TheCity::Topic
Posts a topic to The City.
-
#topic(*args) ⇒ TheCity::Topic
Returns a topic by id.
Instance Method Details
#post_topic(options) ⇒ TheCity::Topic
Posts a topic to The City
20 21 22 23 24 25 26 |
# File 'lib/the_city/api/topics.rb', line 20 def post_topic() raise(Error::ArgumentError, "Must supply a options[:group_id] for the topic's originating group") unless [:group_id] raise(Error::ArgumentError, "Title (options[:title]) required") unless [:title] raise(Error::ArgumentError, "Body (options[:body]) required") unless [:body] gid = [:group_id] || 0 object_from_response(TheCity::Topic, :post, "/groups/#{gid}/topics/", , {:client => self}) end |
#topic(id) ⇒ TheCity::Topic #topic(id, options = {}) ⇒ TheCity::Topic
Returns a topic by id
41 42 43 44 45 46 47 |
# File 'lib/the_city/api/topics.rb', line 41 def topic(*args) @topics ||= {} arguments = TheCity::Arguments.new(args) tid = args.shift @topics[tid] = nil if arguments..delete(:force_download) @topics[tid] ||= object_from_response(TheCity::Topic, :get, "/topics/#{tid}", arguments., {:client => self}) end |