Permalink
Browse files

user commodity methods

  • Loading branch information...
1 parent 625717d commit 8c6d19049b6cc9625505ea89b85e7fd57d9f4b96 andrea@VEGETA committed Sep 6, 2010
Showing with 18 additions and 17 deletions.
  1. +0 −17 lib/HNAPI/domain/User.rb
  2. +18 −0 lib/HNAPI/domain/user.rb
View
17 lib/HNAPI/domain/User.rb
@@ -1,17 +0,0 @@
-
-class User
-
- def login(name, password)
- if LoginService.new.login(name, password)
- @name = name
- end
- return @name
- end
-
- def logout
- if LoginService.new.logout
- @name = nil
- end
- return @name == nil
- end
-end
View
18 lib/HNAPI/domain/user.rb
@@ -0,0 +1,18 @@
+
+class User
+
+ attr_reader :name
+
+ def initialize(name)
+ @name = name
+ end
+
+ def login(password)
+ return LoginService.new.login(@name, password)
+ end
+
+ def logout
+ return LoginService.new.logout
+ end
+
+end

0 comments on commit 8c6d190

Please sign in to comment.