Class: TMDBParty::CastMember
- Inherits:
-
Object
- Object
- TMDBParty::CastMember
- Includes:
- Attributes
- Defined in:
- lib/tmdb_party/cast_member.rb
Instance Attribute Summary collapse
-
#tmdb ⇒ Object
readonly
Returns the value of attribute tmdb.
Class Method Summary collapse
Instance Method Summary collapse
- #character_name ⇒ Object
- #image_url ⇒ Object
-
#initialize(values, tmdb) ⇒ CastMember
constructor
A new instance of CastMember.
- #person ⇒ Object
Methods included from Attributes
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
#tmdb ⇒ Object (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_name ⇒ Object
13 14 15 |
# File 'lib/tmdb_party/cast_member.rb', line 13 def character_name read_attribute('character') end |
#image_url ⇒ Object
17 18 19 |
# File 'lib/tmdb_party/cast_member.rb', line 17 def image_url read_attribute('profile') end |
#person ⇒ Object
21 22 23 |
# File 'lib/tmdb_party/cast_member.rb', line 21 def person tmdb.get_person(id) end |