Class: DNSimple::User
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#domain_count ⇒ Object
Returns the value of attribute domain_count.
-
#domain_limit ⇒ Object
Returns the value of attribute domain_limit.
-
#email ⇒ Object
Returns the value of attribute email.
-
#failed_login_count ⇒ Object
Returns the value of attribute failed_login_count.
-
#id ⇒ Object
Returns the value of attribute id.
-
#login_count ⇒ Object
Returns the value of attribute login_count.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(attributes) ⇒ User
Returns a new instance of User.
21 22 23 24 25 26 |
# File 'lib/dnsimple/user.rb', line 21 def initialize(attributes) attributes.each do |key, value| m = "#{key}=".to_sym self.send(m, value) if self.respond_to?(m) end end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
7 8 9 |
# File 'lib/dnsimple/user.rb', line 7 def created_at @created_at end |
#domain_count ⇒ Object
Returns the value of attribute domain_count.
17 18 19 |
# File 'lib/dnsimple/user.rb', line 17 def domain_count @domain_count end |
#domain_limit ⇒ Object
Returns the value of attribute domain_limit.
19 20 21 |
# File 'lib/dnsimple/user.rb', line 19 def domain_limit @domain_limit end |
#email ⇒ Object
Returns the value of attribute email.
11 12 13 |
# File 'lib/dnsimple/user.rb', line 11 def email @email end |
#failed_login_count ⇒ Object
Returns the value of attribute failed_login_count.
15 16 17 |
# File 'lib/dnsimple/user.rb', line 15 def failed_login_count @failed_login_count end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/dnsimple/user.rb', line 5 def id @id end |
#login_count ⇒ Object
Returns the value of attribute login_count.
13 14 15 |
# File 'lib/dnsimple/user.rb', line 13 def login_count @login_count end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
9 10 11 |
# File 'lib/dnsimple/user.rb', line 9 def updated_at @updated_at end |
Class Method Details
.me(options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dnsimple/user.rb', line 28 def self.me(={}) .merge!({:basic_auth => Client.credentials}) response = self.get("#{Client.base_uri}/users/me.json", ) case response.code when 200 return User.new(response["user"]) when 401 raise DNSimple::AuthenticationFailed, "Authentication failed" when 404 raise DNSimple::UserNotFound, "Could not find user" else raise DNSimple::Error, "Error: #{response.code} #{response.}" end end |