lib/ronin/credential.rb in ronin-1.0.0 vs lib/ronin/credential.rb in ronin-1.1.0.rc1
- old
+ new
@@ -16,15 +16,14 @@
# You should have received a copy of the GNU General Public License
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
#
require 'ronin/model'
+require 'ronin/user_name'
+require 'ronin/password'
module Ronin
- autoload :UserName, 'ronin/user_name'
- autoload :Password, 'ronin/password'
-
#
# Represents Credentials used to access services or websites.
#
class Credential
@@ -48,10 +47,12 @@
# @return [Array<Credential>]
# The credentials for the user.
#
# @since 1.0.0
#
+ # @api public
+ #
def self.for_user(name)
all('user_name.name' => name)
end
#
@@ -63,10 +64,12 @@
# @return [Array<Credential>]
# The credentials with the common password.
#
# @since 1.0.0
#
+ # @api public
+ #
def self.with_password(password)
all('password.clear_text' => password)
end
#
@@ -75,10 +78,12 @@
# @return [String]
# The user name.
#
# @since 1.0.0
#
+ # @api public
+ #
def user
self.user_name.name if self.user_name
end
#
@@ -87,10 +92,12 @@
# @return [String]
# The clear-text password.
#
# @since 1.0.0
#
+ # @api public
+ #
def clear_text
self.password.clear_text if self.password
end
#
@@ -99,10 +106,12 @@
# @return [String]
# The user name and the password.
#
# @since 1.0.0
#
+ # @api public
+ #
def to_s
"#{self.user_name}:#{self.password}"
end
#
@@ -118,9 +127,11 @@
# # => "alice"
# password
# # => "secret"
#
# @since 1.0.0
+ #
+ # @api public
#
def to_ary
[self.user_name.name, self.password.clear_text]
end