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
-
.me ⇒ User
Gets the information about the authenticated user.
-
.two_factor_exchange_token(otp_token) ⇒ String
Requests a new two-factor authentication exchange token.
Methods inherited from Base
Constructor Details
This class inherits a constructor from DNSimple::Base
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/dnsimple/user.rb', line 10 def created_at @created_at end |
#domain_count ⇒ Object
Returns the value of attribute domain_count.
6 7 8 |
# File 'lib/dnsimple/user.rb', line 6 def domain_count @domain_count end |
#domain_limit ⇒ Object
Returns the value of attribute domain_limit.
7 8 9 |
# File 'lib/dnsimple/user.rb', line 7 def domain_limit @domain_limit end |
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/dnsimple/user.rb', line 5 def email @email end |
#failed_login_count ⇒ Object
Returns the value of attribute failed_login_count.
9 10 11 |
# File 'lib/dnsimple/user.rb', line 9 def failed_login_count @failed_login_count end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/dnsimple/user.rb', line 4 def id @id end |
#login_count ⇒ Object
Returns the value of attribute login_count.
8 9 10 |
# File 'lib/dnsimple/user.rb', line 8 def login_count @login_count end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
11 12 13 |
# File 'lib/dnsimple/user.rb', line 11 def updated_at @updated_at end |
Class Method Details
.me ⇒ User
Gets the information about the authenticated user.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dnsimple/user.rb', line 18 def self.me response = DNSimple::Client.get("/v1/user") case response.code when 200 new(response["user"]) else raise RequestError.new("Error finding account", response) end end |
.two_factor_exchange_token(otp_token) ⇒ String
Requests a new two-factor authentication exchange token.
The exchange-token is required to validate API requests using HTTP Basic Authentication when the account has two-factor authentication enabled.
45 46 47 48 |
# File 'lib/dnsimple/user.rb', line 45 def self.two_factor_exchange_token(otp_token) response = DNSimple::Client.get("/v1/user", :headers => { DNSimple::Client::HEADER_2FA_STRICT => "1", DNSimple::Client::HEADER_OTP_TOKEN => otp_token }) response.headers[DNSimple::Client::HEADER_EXCHANGE_TOKEN] end |