Class: TMDBParty::CastMember

Inherits:
Object
  • Object
show all
Includes:
Attributes
Defined in:
lib/tmdb_party/cast_member.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Attributes

included

Constructor Details

#initialize(values, tmdb) ⇒ CastMember

Returns a new instance of CastMember.



8
9
10
11
# File 'lib/tmdb_party/cast_member.rb', line 8

def initialize(values, tmdb)
  @tmdb = tmdb
  self.attributes = values
end

Instance Attribute Details

#tmdbObject (readonly)

Returns the value of attribute tmdb.



4
5
6
# File 'lib/tmdb_party/cast_member.rb', line 4

def tmdb
  @tmdb
end

Class Method Details

.parse(data, tmdb) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/tmdb_party/cast_member.rb', line 25

def self.parse(data, tmdb)
  return unless data
  if data.is_a?(Array)
    data.collect do |person|
      CastMember.new(person, tmdb)
    end
  else
    [CastMember.new(data, tmdb)]
  end
end

Instance Method Details

#character_nameObject



13
14
15
# File 'lib/tmdb_party/cast_member.rb', line 13

def character_name
  read_attribute('character')
end

#image_urlObject



17
18
19
# File 'lib/tmdb_party/cast_member.rb', line 17

def image_url
  read_attribute('profile')
end

#personObject



21
22
23
# File 'lib/tmdb_party/cast_member.rb', line 21

def person
  tmdb.get_person(id)
end