module TheCity::API::Topics
Public Instance Methods
post_topic(options)
click to toggle source
Posts a topic to The City
@req_scope group_content @return [TheCity::Topic] @param options [Hash] A customizable set of options. @option options [Integer] :group_id The id of the group you will be posting to. @option options [String] :title The title of the topic. @option options [String] :body The body text of the topic.
# File lib/the_city/api/topics.rb, line 20 def post_topic(options) raise(Error::ArgumentError, "Must supply a options[:group_id] for the topic's originating group") unless options[:group_id] raise(Error::ArgumentError, "Title (options[:title]) required") unless options[:title] raise(Error::ArgumentError, "Body (options[:body]) required") unless options[:body] gid = options[:group_id] || 0 object_from_response(TheCity::Topic, :post, "/groups/#{gid}/topics/", options, {:client => self}) end
topic(*args)
click to toggle source
Returns a topic by id
@req_scope group_content @return [TheCity::Topic] @raise [TheCity::Error::NotFound] Error
raised when the topic cannot be found. @overload topic(id)
@param id [Integer] The id of the topic.
@overload topic(id, options={})
@param id [Integer] The id of the topic. @param options [Hash] A customizable set of options. @option options [Boolean] :force_download Forces the request to hit the server and flush the cached response
# 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.options.delete(:force_download) @topics[tid] ||= object_from_response(TheCity::Topic, :get, "/topics/#{tid}", arguments.options, {:client => self}) end