31 lines
747 B
Ruby
31 lines
747 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SpaceTraders::Waypoint < SpaceTraders::Model
|
|
attributes :symbol,
|
|
:type,
|
|
:systemSymbol,
|
|
:x,
|
|
:y,
|
|
:orbitals,
|
|
:orbits,
|
|
:faction,
|
|
:traits,
|
|
:modifiers,
|
|
:chart,
|
|
:isUnderConstruction
|
|
|
|
def self.waypoints(client, system:, page: 1)
|
|
list = client.systems.waypoints(id: system, page:)
|
|
list.map { new(client, **_1) }
|
|
end
|
|
|
|
def self.load(client, id:, system:)
|
|
new(client, _system: system, **client.systems.waypoints(system:, waypoint: id))
|
|
end
|
|
|
|
def reload!
|
|
update(**client.systems.waypoint(system: self.systemSymbol, waypoint: symbol))
|
|
self
|
|
end
|
|
end
|