lib/mambanation/base.rb in mambanation-0.1.16 vs lib/mambanation/base.rb in mambanation-0.1.17

- old
+ new

@@ -35,11 +35,11 @@ perform_get("/users/#{id.to_i}.json", :query => query) end alias_method :user_by_id, :user def user_set_websession(id, credentials) - perform_post("/users/#{id.to_i}/update_websession", :query => { :user_credentials => credentials }) + perform_post("/users/#{id.to_i}/update_websession", :body => { :user => { :user_credentials => credentials }}) end # # User actions # @@ -138,22 +138,22 @@ end # # Posts # - def user_posts(id,app_id) - perform_get("/users/#{id.to_i}/posts.json", :query => { :fb_application_id => app_id }) - end + def posts(id, query = {}) + perform_get("/posts/#{id}.json", :query => query) + end + def user_posts(id, app_id, query = {}) + perform_get("/users/#{id.to_i}/posts.json", :query => ({ :fb_application_id => app_id }.merge(query))) + end + def create_post(id, app_id, post) perform_post("/posts", :body => { :post => post , :user_id => id , :fb_sig_app_id => app_id}) end - def posts(id, query = {}) - perform_get("/posts/#{id}.json", :query => query) - end - def publish_post(id, stream_id) perform_post("/posts/#{id}/publish.json", :body => { :post => { :stream_id => stream_id } }) end # @@ -164,30 +164,30 @@ end # # Users System Messages # - def user_system_messages(id) - perform_get("/users/#{id.to_i}/system_messages.json") + def user_system_messages(id, query = {}) + perform_get("/users/#{id.to_i}/system_messages.json", :query => query) end - def user_unread_system_messages(id) - perform_get("/users/#{id.to_i}/unread_system_messages.json") + def user_unread_system_messages(id, query = {}) + perform_get("/users/#{id.to_i}/unread_system_messages.json", :query => query) end def read_user_message(id, message_id) - perform_post("/users/#{id.to_i}/messages/#{message_id.to_i}/read.json") + perform_post("/users/#{id.to_i}/messages/#{message_id.to_i}/read.json", :body => {}) end # # User Announcements # - def announcements(id) - perform_get("/users/#{id.to_i}/announcements.json") + def announcements(id, query = {}) + perform_get("/users/#{id.to_i}/announcements.json", :query => query) end - def read_user_announcement(id, announcement_id) - perform_put("/users/#{id.to_i}/announcements/#{announcement_id.to_i}/read.json") + def read_user_announcement(id, announcement_id, query = {}) + perform_put("/users/#{id.to_i}/announcements/#{announcement_id.to_i}/read.json", :query => query) end protected def self.mime_type(file)