lib/mambanation/base.rb in mambanation-0.1.27 vs lib/mambanation/base.rb in mambanation-0.1.28
- old
+ new
@@ -152,12 +152,10 @@
end
# options:
# application_id => Integer, Array
def user_posts(id, query = {})
- query[:application_id] = urlencode_array({:application_id => query[:application_id]}) if query.is_a?(Hash) && query[:application_id]
-
perform_get("/users/#{id.to_i}/posts.json", :query => query)
end
def create_post(id, post, application_id, query = {})
perform_post("/posts", :body => { :user_id => id, :post => post, :application_id => application_id }.merge(query))
@@ -239,22 +237,10 @@
def build_multipart_bodies(parts) self.class.build_multipart_bodies(parts) end
private
- def urlencode_array(value_hash)
- return_string = ''
- value_hash.each_pair do |k,v|
- return_string = case v.class.to_s
- when "Hash" then urlencode_array(v)
- when "Array" then v.map { |value| value.is_a?(Hash) ? urlencode_array(value) : "#{k}[]=#{value}" }.join('&')
- else "#{k}[]=#{v}"
- end
- end
- return_string
- end
-
def request_options(opts={})
opts[:headers] ||= {}
opts[:headers].merge! "X-FB-COOKIES" => @fbs_cookies if @fbs_cookies
opts
end
@@ -274,6 +260,6 @@
def perform_delete(path, options={})
MambaNation::Request.delete(self, path, request_options(options))
end
end
-end
+end
\ No newline at end of file