Class: Camdram::Person

Inherits:
Base
  • Object
show all
Includes:
API, Refreshable
Defined in:
lib/camdram/person.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Refreshable

#refresh!

Methods inherited from Base

#initialize, #make_orphan

Constructor Details

This class inherits a constructor from Camdram::Base

Instance Attribute Details

#descriptionObject

Returns the value of attribute description


11
12
13
# File 'lib/camdram/person.rb', line 11

def description
  @description
end

#nameObject

Returns the value of attribute name


11
12
13
# File 'lib/camdram/person.rb', line 11

def name
  @name
end

#slugObject

Returns the value of attribute slug


11
12
13
# File 'lib/camdram/person.rb', line 11

def slug
  @slug
end

Class Method Details

.urlString

Returns the URL stub assocaited with all people

Returns:

  • (String)

    The URL stub.


53
54
55
# File 'lib/camdram/person.rb', line 53

def self.url
  '/people'
end

Instance Method Details

#infoHash

Return a hash of the person's attributes

Returns:

  • (Hash)

    Hash with symbolized keys.


34
35
36
37
38
39
40
41
# File 'lib/camdram/person.rb', line 34

def info
  {
    id: id,
    description: description,
    name: name,
    slug: slug,
  }
end

#role_tagsObject


22
23
24
25
26
27
28
29
# File 'lib/camdram/person.rb', line 22

def role_tags
  tags = Set.new
  roles.each do |role|
    tag = role.tag
    tags.add(tag) unless tag.nil?
  end
  tags
end

#rolesArray

Gets an array of roles the person has been in

Returns:

  • (Array)

    An array of Role objects.


16
17
18
19
20
# File 'lib/camdram/person.rb', line 16

def roles
  roles_url = "#{self.class.url}/#{slug}/roles.json"
  response = get(roles_url)
  split_object( response, Role )
end

#url_slugString

Returns the URL+slug of the person

Returns:

  • (String)

    The full URL and slug.


46
47
48
# File 'lib/camdram/person.rb', line 46

def url_slug
  "#{self.class.url}/#{slug}.json"
end