Class: Fastly::User
Overview
A representation of a User in Fastly
Constant Summary collapse
- PRIORITIES =
          :nodoc: 
- { :admin => 1, :owner => 10, :superuser => 10, :user => 20, :engineer => 30, :billing => 30 } 
Instance Attribute Summary collapse
- 
  
    
      #customer_id  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute customer_id. 
- 
  
    
      #id  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute id. 
- 
  
    
      #login  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute login. 
- 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute name. 
- 
  
    
      #password  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute password. 
- 
  
    
      #role  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute role. 
Attributes inherited from Base
Instance Method Summary collapse
- 
  
    
      #can_do?(test_role)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Does this User have sufficient permissions to perform the given role. 
- 
  
    
      #customer  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Get the Customer object this user belongs to. 
- 
  
    
      #owner?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Whether or not this User is the owner of the Customer they belong to. 
Methods inherited from Base
#as_hash, #delete!, delete_path, get_path, #initialize, list_path, path, post_path, put_path, #require_api_key!, #save!
Constructor Details
This class inherits a constructor from Fastly::Base
Instance Attribute Details
#customer_id ⇒ Object
Returns the value of attribute customer_id.
| 4 5 6 | # File 'lib/fastly/user.rb', line 4 def customer_id @customer_id end | 
#id ⇒ Object
Returns the value of attribute id.
| 4 5 6 | # File 'lib/fastly/user.rb', line 4 def id @id end | 
#login ⇒ Object
Returns the value of attribute login.
| 4 5 6 | # File 'lib/fastly/user.rb', line 4 def login @login end | 
#name ⇒ Object
Returns the value of attribute name.
| 4 5 6 | # File 'lib/fastly/user.rb', line 4 def name @name end | 
#password ⇒ Object
Returns the value of attribute password.
| 4 5 6 | # File 'lib/fastly/user.rb', line 4 def password @password end | 
#role ⇒ Object
Returns the value of attribute role.
| 4 5 6 | # File 'lib/fastly/user.rb', line 4 def role @role end | 
Instance Method Details
#can_do?(test_role) ⇒ Boolean
Does this User have sufficient permissions to perform the given role
| 49 50 51 52 53 54 55 56 57 58 | # File 'lib/fastly/user.rb', line 49 def can_do?(test_role) test_priority = PRIORITIES[test_role.to_sym] || 1000 my_priority = PRIORITIES[role.to_sym] || 1000 if test_priority == my_priority test_role.to_s == :owner ? owner? : test_role.to_sym == role.to_sym else my_priority < test_priority end end | 
#customer ⇒ Object
Get the Customer object this user belongs to
| 29 30 31 | # File 'lib/fastly/user.rb', line 29 def customer @customer ||= fetcher.get(Customer, customer_id) end | 
#owner? ⇒ Boolean
Whether or not this User is the owner of the Customer they belong to
| 34 35 36 | # File 'lib/fastly/user.rb', line 34 def owner? customer.owner_id == id end |