Module: TheCity::API::Needs
Instance Method Summary collapse
-
#need(*args) ⇒ TheCity::Need
Returns a need by id.
-
#post_need(options) ⇒ TheCity::Need
Posts a need to The City.
Instance Method Details
#need(id) ⇒ TheCity::Need #need(id, options = {}) ⇒ TheCity::Need
Returns a need by id
41 42 43 44 45 46 47 |
# File 'lib/the_city/api/needs.rb', line 41 def need(*args) @needs ||= {} arguments = TheCity::Arguments.new(args) nid = args.shift @needs[nid] = nil if arguments..delete(:force_download) @needs[nid] ||= object_from_response(TheCity::Need, :get, "/needs/#{nid}", arguments., {:client => self}) end |
#post_need(options) ⇒ TheCity::Need
Posts a need to The City
20 21 22 23 24 25 26 |
# File 'lib/the_city/api/needs.rb', line 20 def post_need() raise(Error::ArgumentError, "Must supply a options[:group_id] for the needs'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::Need, :post, "/groups/#{gid}/needs/", , {:client => self}) end |