Module: TheCity::API::Events
Instance Method Summary collapse
-
#event(*args) ⇒ TheCity::Event
Returns an Event by id.
-
#post_event(options) ⇒ TheCity::Event
Posts an Event to The City.
Instance Method Details
#event(id) ⇒ TheCity::Event #event(id, options = {}) ⇒ TheCity::Event
Returns an Event by id
45 46 47 48 49 50 51 |
# File 'lib/the_city/api/events.rb', line 45 def event(*args) @events ||= {} arguments = TheCity::Arguments.new(args) eid = args.shift @events[eid] = nil if arguments..delete(:force_download) @events[eid] ||= object_from_response(TheCity::Event, :get, "/events/#{eid}", arguments., {:client => self}) end |
#post_event(options) ⇒ TheCity::Event
Posts an Event to The City
22 23 24 25 26 27 28 29 30 |
# File 'lib/the_city/api/events.rb', line 22 def post_event() raise(Error::ArgumentError, "Must supply a options[:group_id] for the events's originating group") unless [:group_id] raise(Error::ArgumentError, "Title (options[:title]) required") unless [:title] raise(Error::ArgumentError, "Body (options[:body]) required") unless [:body] raise(Error::ArgumentError, "Starting At (options[:starting_at]) required") unless [:starting_at] raise(Error::ArgumentError, "Ending At (options[:ending_at]) required") unless [:ending_at] gid = [:group_id] || 0 object_from_response(TheCity::Event, :post, "/groups/#{gid}/events/", , {:client => self}) end |