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