Skip to content

Commit

Permalink
Standardize endpoints usage
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandomaia committed Oct 28, 2018
1 parent 2385c93 commit eebc5ab
Showing 1 changed file with 33 additions and 29 deletions.
62 changes: 33 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ cores_info.first.water_landing # false

### Dragon Capsules

- Get all dragon capsules: `SPACEX::DragonCapsules.info`
- Get a specific dragon capsule (e.g., `dragon1`) by including the id in the call: `SPACEX::DragonCapsules.info('dragon_id')`
- Get information for all dragon capsules: `SPACEX::DragonCapsules.info`
- Get information about a specific dragon capsule: `SPACEX::DragonCapsules.info('dragon_id')`

This code snippet shows the `dragon1` dragon capsule information:

Expand Down Expand Up @@ -190,7 +190,9 @@ dragon_capsules.first.description # "Dragon is a reusable spacecraft developed b
### History

- Get information for all historical events: `SPACEX::History.info`
- Get information about a specific historical event: (e.g., `4`: `SPACEX::History.info('4')`
- Get information about a specific historical event: `SPACEX::History.info('event_id')`

The following code shows how to get information about the first historical event and lists the event data fields:

```ruby
require 'spacex'
Expand All @@ -210,10 +212,23 @@ first_event.links['wikipedia'] # https://en.wikipedia.org/wiki/Falcon_1

### Launches

- Get information on all launches: `SPACEX::Launches.all` or `SPACEX::Launches.info`
- Get information for a specific launch (by flight number): `SPACEX::Launches.info(68)`
- Get information on the next launch: `SPACEX::Launches.next`
- Get the latest launch information: `SPACEX::Launches.latest`
- Get information for all launches: `SPACEX::Launches.all` or `SPACEX::Launches.info`
- Get information about a specific launch: `SPACEX::Launches.info('flight_number')`

This code snippet shows how to get information for flight number 68 and list the fields:

```ruby
require 'spacex'
launch_68 = SPACEX::Launches.info(68)

launch_68.flight_number # 68
launch_68.mission_name # 'Telstar 18V'
launch_68.rocket.rocket_name # 'Falcon 9'
launch_68.rocket.first_stage.cores.first.land_success # true
```

- Get information about the next launch: `SPACEX::Launches.next`
- Get information about the latest launch: `SPACEX::Launches.latest`

The following code snippet shows the latest launch information and the data fields available on the Launch object:

Expand Down Expand Up @@ -287,23 +302,12 @@ latest_launch.upcoming # false
latest_launch.static_fire_date_utc # '2018-08-02T15:53:00.000Z'
```

This code snippet shows how to get information for a specific launch by flight number and list the fields:
```ruby
require 'spacex'
launch_68 = SPACEX::Launches.info(68)

launch_68.flight_number # 68
launch_68.mission_name # 'Telstar 18V'
launch_68.rocket.rocket_name # 'Falcon 9'
launch_68.rocket.first_stage.cores.first.land_success # true
```

### Missions

- Get all mission information: `SPACEX::Missions.info`
- Get information about a specific mission (e.g., `F3364BF`): `SPACEX::Missions.info('mission_id')`
- Get information for all missions: `SPACEX::Missions.info`
- Get information about a specific mission: `SPACEX::Missions.info('mission_id')`

This code shows how to get the first mission information and lists the fields:
This code shows how to get information about the first mission and lists the fields:

```ruby
missions = SPACEX::Missions.info
Expand All @@ -320,10 +324,10 @@ missions.first.description # "In 2017, Iridium began launching Iridium NEXT, a s

### Payloads

- Get information on all payloads: `SPACEX::Payloads.info`
- Get information about a specific payload (e.g., `FalconSAT-2`): `SPACEX::Payloads.info('payload_id')`
- Get information for all payloads: `SPACEX::Payloads.info`
- Get information about a specific payload: `SPACEX::Payloads.info('payload_id')`

The following code shows how to get information about a specific payload and lists the payload data fields:
The following code shows how to get information about the payload **FalconSAT-2** and lists the payload data fields:

```ruby
payload = SPACEX::Payloads.info('FalconSAT-2')
Expand Down Expand Up @@ -377,9 +381,9 @@ roadster.details # "Elon Musk's Tesla Roadster is an electric sports car that se
### Rockets

- Get information for all rockets: `SPACEX::Rockets.info`
- Get information about a specific rocket (e.g., `falcon1`: `SPACEX::Rockets.info('falcon1')`
- Get information about a specific rocket: `SPACEX::Rockets.info('rocket_id')`

This example shows a single rocket and its data fields:
This example shows how to get information about the first rocket and lists the rocket data fields:

```
rockets = SPACEX::Rockets.info
Expand Down Expand Up @@ -412,10 +416,10 @@ first_rocket.flickr_images # ["https://www.spacex.com/sites/spacex/files/styles/

### Ships

- Get all ship information: `SPACEX::Ships.info`
- Get information about a specific ship (e.g., `AMERICANCHAMPION`): `SPACEX::Ships.info('ship_id')`
- Get information for all ships: `SPACEX::Ships.info`
- Get information about a specific ship: `SPACEX::Ships.info('ship_id')`

The following code shows how to get information about a specific ship and lists the ship data fields:
The following code shows how to get information about the ship `AMERICANCHAMPION` and lists the ship data fields:

```ruby
ship = SPACEX::Ships.info('AMERICANCHAMPION')
Expand Down

0 comments on commit eebc5ab

Please sign in to comment.