Class: Starwars::Starship

Inherits:
Base show all
Defined in:
lib/starwars/resources/starship.rb,
lib/starwars.rb

Overview

A Starship resource is a single transport craft that has hyperdrive capability.

Constant Summary collapse

RESOURCE_NAME =

Define the source name in the starwars api

'starships'

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

Methods inherited from OpenStruct

#[]

Instance Method Details

#cargo_capacityInteger

The maximum number of kilograms that this starship can transport

Examples:

starship.cargo_capacity

Returns:

  • (Integer)


91
# File 'lib/starwars/resources/starship.rb', line 91

property :cargo_capacity, type: Integer

#consumablesString

consumables

Examples:

starship.consumables

Returns:

  • (String)


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

property :consumables

#cost_in_creditsString

The cost of this new starship, in Galactic Credits

Examples:

starship.cost_in_credits

Returns:

  • (String)


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

property :cost_in_credits, type: Integer

#crewInteger

The number of personnel needed to run or pilot this starship

Examples:

starship.crew

Returns:

  • (Integer)


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

property :crew, type: Integer

#filmsArray<Film>

List of films

Examples:

starship.films

Returns:



113
# File 'lib/starwars/resources/starship.rb', line 113

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

#hyperdrive_ratingFloat

The class of this starships hyperdrive

Examples:

starship.hyperdrive_rating

Returns:

  • (Float)


99
# File 'lib/starwars/resources/starship.rb', line 99

property :hyperdrive_rating, type: Float

#lengthString

The length of this starship in meters

Examples:

starship.length

Returns:

  • (String)


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

property :length, type: Integer

#manufacturerString

The manufacturer of the starship

Examples:

starship.manufacturer #=> 'Imperial Department of Military Research'

Returns:

  • (String)


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

property :manufacturer

#max_atmosphering_speedInteger

The maximum speed of this starship in atmosphere

Examples:

starship.max_atmosphering_speed

Returns:

  • (Integer)


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

property :max_atmosphering_speed, type: Integer

#modelString

The model or official name of this starship

Examples:

starship.model #=> 'DS-1 Orbital Battle Station'

Returns:

  • (String)


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

property :model

#nameString

Note:

The common name, such as “Death Star”.

The name of this starship

Examples:

starship.name #=> 'Death Star'

Returns:

  • (String)


20
# File 'lib/starwars/resources/starship.rb', line 20

property :name

#passengersInteger

The number of non-essential people this starship can transport

Examples:

starship.passengers

Returns:

  • (Integer)


84
# File 'lib/starwars/resources/starship.rb', line 84

property :passengers, type: Integer

#pilotsArray<Pilot>

List of pilots

Examples:

starship.pilots

Returns:

  • (Array<Pilot>)


106
# File 'lib/starwars/resources/starship.rb', line 106

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

#starship_classString

The class of this starship

Examples:

starship.starship_class #=> 'Starfighter'

Returns:

  • (String)


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

property :starship_class