Class: Starwars::Vehicle

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

Overview

A Vehicle resource is a single transport craft that does not have hyperdrive capability.

Constant Summary collapse

RESOURCE_NAME =

Define the source name in the starwars api

'vehicles'

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 vehicle can transport

Examples:

vehicle.cargo_capacity

Returns:

  • (Integer)


83
# File 'lib/starwars/resources/vehicle.rb', line 83

property :cargo_capacity, type: Integer

#consumablesString

consumables

Examples:

vehicle.consumables

Returns:

  • (String)


41
# File 'lib/starwars/resources/vehicle.rb', line 41

property :consumables

#cost_in_creditsString

The cost of this vehicle new, in Galactic Credits

Examples:

vehicle.cost_in_credits

Returns:

  • (String)


55
# File 'lib/starwars/resources/vehicle.rb', line 55

property :cost_in_credits

#crewInteger

The number of personnel needed to run or pilot this vehicle

Examples:

vehicle.crew

Returns:

  • (Integer)


69
# File 'lib/starwars/resources/vehicle.rb', line 69

property :crew, type: Integer

#filmsArray<Film>

List of films

Examples:

vehicle.films

Returns:



104
# File 'lib/starwars/resources/vehicle.rb', line 104

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

#lengthFloat

The length of this vehicle in meters

Examples:

vehicle.length

Returns:

  • (Float)


90
# File 'lib/starwars/resources/vehicle.rb', line 90

property :length, type: Float

#manufacturerString

The manufacturer of this vehicle. Comma-seperated if more than one

Examples:

vehicle.manufacturer #=> 'Incom corporation'

Returns:

  • (String)


34
# File 'lib/starwars/resources/vehicle.rb', line 34

property :manufacturer

#max_atmosphering_speedInteger

The maximum speed of this vehicle in atmosphere

Examples:

vehicle.max_atmosphering_speed

Returns:

  • (Integer)


62
# File 'lib/starwars/resources/vehicle.rb', line 62

property :max_atmosphering_speed, type: Integer

#modelString

The model or official name of this vehicle

Examples:

vehicle.model #=> 't-47 airspeeder'

Returns:

  • (String)


27
# File 'lib/starwars/resources/vehicle.rb', line 27

property :model

#nameString

Note:

The common name, such as “Sand Crawler” or “Speeder bike”

The name of this vehicle

Examples:

vehicle.name #=> 'Snowspeeder'

Returns:

  • (String)


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

property :name

#passengersInteger

The number of non-essential people this vehicle can transport

Examples:

vehicle.passengers

Returns:

  • (Integer)


76
# File 'lib/starwars/resources/vehicle.rb', line 76

property :passengers, type: Integer

#pilotsArray<Pilot>

List of pilots

Examples:

vehicle.pilots

Returns:

  • (Array<Pilot>)


97
# File 'lib/starwars/resources/vehicle.rb', line 97

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

#vehicle_classString

The class of this vehicle, such as “Wheeled” or “Repulsorcraft”

Examples:

vehicle.vehicle_class #=> 'airspeeder'

Returns:

  • (String)


48
# File 'lib/starwars/resources/vehicle.rb', line 48

property :vehicle_class