Class: Starwars::Film

Inherits:
Base
  • Object
show all
Defined in:
lib/starwars/resources/film.rb,
lib/starwars.rb

Overview

A Film resource is an single film.

Constant Summary collapse

RESOURCE_NAME =

Define the source name in the starwars api

'films'

Constants inherited from Base

Base::BASE_URL, Base::FORMAT

Instance Method Summary collapse

Methods inherited from Base

#==, #created, #edited, fetch, #fetch, fetch_all, #id, #request_attributes, #url

Instance Method Details

#charactersArray<Person>

List of people

Examples:

film.characters

Returns:


49
# File 'lib/starwars/resources/film.rb', line 49

collection :characters, class: Starwars::Person,  deserialize: ->(_, fragment, _) { Person.new(url: fragment) }

#directorString

The name of the director of this film

Examples:

film.director #=> 'George Lucas'

Returns:

  • (String)

28
# File 'lib/starwars/resources/film.rb', line 28

property :director

#episode_idInteger

The episode number of this film

Examples:

film.episode_id #=> 1

Returns:

  • (Integer)

42
# File 'lib/starwars/resources/film.rb', line 42

property :episode_id, type: Integer

#opening_crawlString

The opening paragraphs at the beginning of this film

Examples:

film.opening_crawl #=> 'It is a period of civil war ...'

Returns:

  • (String)

21
# File 'lib/starwars/resources/film.rb', line 21

property :opening_crawl

#planetsArray<Person>

List of planets

Examples:

film.characters

Returns:


56
# File 'lib/starwars/resources/film.rb', line 56

collection :planets, class: Starwars::Planet,  deserialize: ->(_, fragment, _) { Planet.new(url: fragment) }

#producerString

The name(s) of the producer(s) of this film. Comma seperated

Examples:

film.producer #=> 'Gary Kurtz, Rick McCallum'

Returns:

  • (String)

35
# File 'lib/starwars/resources/film.rb', line 35

property :producer

#speciesArray<Specie>

List of species

Examples:

film.species

Returns:


77
# File 'lib/starwars/resources/film.rb', line 77

collection :species, class: Starwars::Specie,  deserialize: ->(_, fragment, _) { Specie.new(url: fragment) }

#starshipsArray<Starship>

List of starships

Examples:

film.starships

Returns:


63
# File 'lib/starwars/resources/film.rb', line 63

collection :starships, class: Starwars::Starship,  deserialize: ->(_, fragment, _) { Starship.new(url: fragment) }

#titleString

The title of this film

Examples:

film.title #=> 'A New Hope'

Returns:

  • (String)

14
# File 'lib/starwars/resources/film.rb', line 14

property :title

#vehiclesArray<Vehicle>

List of vehicles

Examples:

film.vehicles

Returns:


70
# File 'lib/starwars/resources/film.rb', line 70

collection :vehicles, class: Starwars::Vehicle,  deserialize: ->(_, fragment, _) { Vehicle.new(url: fragment) }