Class: PostyClient::Resources::User

Inherits:
Base
  • Object
show all
Extended by:
FinderConcern
Defined in:
lib/posty_client/resources/user.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #errors, #name, #new_resource

Instance Method Summary collapse

Methods included from FinderConcern

find_all_by_domain, find_all_by_user

Methods inherited from Base

#create, #delete, #load, #new_resource?, #request_with_error_handling, resource_name, #resource_name, #save, #update

Constructor Details

#initialize(domain, name = nil) ⇒ User

Returns a new instance of User.


10
11
12
13
14
# File 'lib/posty_client/resources/user.rb', line 10

def initialize(domain, name=nil)
  @name = name
  @domain = domain
  load if name
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain


8
9
10
# File 'lib/posty_client/resources/user.rb', line 8

def domain
  @domain
end

Instance Method Details

#aliasesObject


16
17
18
# File 'lib/posty_client/resources/user.rb', line 16

def aliases
  UserAlias.find_all_by_user(self)
end

#resource_slugObject


24
25
26
# File 'lib/posty_client/resources/user.rb', line 24

def resource_slug
  [domain.slug, 'users'].join('/')
end

#slugObject


20
21
22
# File 'lib/posty_client/resources/user.rb', line 20

def slug
  [resource_slug, name].join('/')
end