lib/ncmb/user.rb in ncmb-ruby-client-0.0.9 vs lib/ncmb/user.rb in ncmb-ruby-client-0.1.0

- old
+ new

@@ -1,15 +1,14 @@ module NCMB class User < NCMB::Object include NCMB - def initialize(params = {}, alc = nil) - super('users', params, alc) + def initialize(params = {}) + super('users', params) end def signUp - path = "/#{@@client.api_version}/#{@name}" begin result = @@client.post path, @fields rescue => e @@last_error = e return false @@ -17,12 +16,15 @@ @fields.merge!(result) @@current_user = self self end + def base_path + path = "/#{@@client.api_version}/#{@name}" + end + def put - path = "/#{@@client.api_version}/#{@name}/#{@fields[:objectId]}" params = @fields session_key = params[:sessionToken] [:objectId, :createDate, :updateDate, :sessionToken, :password].each do |name| params.delete name end @@ -31,10 +33,9 @@ self end alias :update :put def delete - path = "/#{@@client.api_version}/#{@name}/#{@fields[:objectId]}" response = @@client.delete path, {}, @fields[:sessionToken] if response == true @@current_user = nil return true else \ No newline at end of file