README.md in spacex-1.0.1 vs README.md in spacex-1.0.2

- old
+ new

@@ -1,19 +1,23 @@ SpaceX Ruby Client =============== [![Gem Version](https://badge.fury.io/rb/spacex.svg)](https://badge.fury.io/rb/spacex) [![Build Status](https://travis-ci.com/rodolfobandeira/spacex.svg?branch=master)](https://travis-ci.org/rodolfobandeira/spacex) -[![Coverage Status](https://coveralls.io/repos/github/rodolfobandeira/spacex/badge.svg?branch=master)](https://coveralls.io/github/rodolfobandeira/spacex?branch=master) +[![Coverage Status - Coverall](https://coveralls.io/repos/github/rodolfobandeira/spacex/badge.svg?branch=master)](https://coveralls.io/github/rodolfobandeira/spacex?branch=master) +[![Maintainability](https://api.codeclimate.com/v1/badges/d125a8ff6d902eb48c8f/maintainability)](https://codeclimate.com/github/rodolfobandeira/spacex/maintainability) +[![Test Coverage - CodeClimate](https://api.codeclimate.com/v1/badges/d125a8ff6d902eb48c8f/test_coverage)](https://codeclimate.com/github/rodolfobandeira/spacex/test_coverage) A Ruby library that consumes the [SpaceX API](https://github.com/r-spacex/SpaceX-API). ## Table of Contents - [Installation](#installation) - [Usage](#usage) + - [API Info](#api-info) + - `SPACEX::ApiInfo.info` - [Capsules](#capsules) - `SPACEX::Capsules.info` - `SPACEX::Capsules.info('capsule_serial')` - [Company Info](#company-info) - `SPACEX::CompanyInfo.info` @@ -24,10 +28,16 @@ - `SPACEX::DragonCapsules.info` - `SPACEX::DragonCapsules.info('dragon_id')` - [History](#history) - `SPACEX::History.info` - `SPACEX::History.info(4)` + - [LandingPads](#landing_pads) + - `SPACEX::LandingPads.info` + - `SPACEX::LandingPads.info('LZ-4')` + - [LaunchPads](#launch_pads) + - `SPACEX::LaunchPads.info` + - `SPACEX::LaunchPads.info('vafb_slc_4e')` - [Launches](#launches) - `SPACEX::Launches.all` - `SPACEX::Launches.info` - `SPACEX::Launches.info('flight_number')` - `SPACEX::Launches.latest` @@ -62,10 +72,27 @@ Then run `bundle install`. ## Usage +### API Info + +- Get information about the API: `SPACEX::ApiInfo.info` + +Here's an example of the response: + +```ruby +api_info = SPACEX::ApiInfo.info + +api_info.project_name # 'SpaceX-API' +api_info.description = # 'Open Source REST API for rocket, core, capsule, pad, and launch data, created and maintained by the developers of the r/SpaceX organization' +api_info.organization = # 'r/SpaceX' +api_info.organization_link = # 'https://github.com/r-spacex' +api_info.project_link = # 'https://github.com/r-spacex/SpaceX-API' +api_info.version = # '3.1.0' +``` + ### Capsules - Get information for all capsules: `SPACEX::Capsules.info` - Get information about a specific capsule: `SPACEX::Capsules.info('capsule_serial')` @@ -205,9 +232,58 @@ first_event.flight_number # 4 first_event.details # Falcon 1 becomes the first privately developed liquid fuel rocket to reach Earth orbit. first_event.links['reddit'] # nil first_event.links['article'] # http://www.spacex.com/news/2013/02/11/flight-4-launch-update-0 first_event.links['wikipedia'] # https://en.wikipedia.org/wiki/Falcon_1 +``` + +### LandingPads + +- Get information for all LandingPads: `SPACEX::LandingPads.info` +- Get information about a specific LandingPad: `SPACEX::LandingPads.info('LZ-4')` + +This code shows how to get the information for a specific LandingPad by id and lists the fields: + +```ruby +landing_pad = SPACEX::LandingPads.info('LZ-4') +landing_pad.id # 'LZ-4' +landing_pad.full_name # 'Landing Zone 4' +landing_pad.status # 'active' +landing_pad.location['name'] # 'Vandenberg Air Force Base' +landing_pad.location['region'] # 'California' +landing_pad.location['latitude'] # 34.632989 +landing_pad.location['longitude'] # -120.615167 +landing_pad.landing_type # 'RTLS' +landing_pad.attempted_landings # 2 +landing_pad.successful_landings # 2 +landing_pad.wikipedia # "https://en.wikipedia.org/wiki/Vandenberg_AFB_Space_Launch_Complex_4#LZ-4_landing_history" +landing_pad.details # "SpaceX's west coast landing pad. The pad is adjacent to SLC-4E, SpaceX's west coast launch site. The pad was under construction for about a year starting in 2016. After concerns with seal mating season, this pad was first used for the SAOCOM 1A mission in October 2018. Officially referred to as LZ-4 in FCC filings." +``` + +### LaunchPads + +- Get information for all LaunchPads: `SPACEX::LaunchPads.info` +- Get information about a specific LaunchPad: `SPACEX::LaunchPads.info('vafb_slc_4e')` + +This code shows how to get the information for a specific LaunchPad by site_id and lists the fields: + +```ruby +launch_pad = SPACEX::LaunchPads.info('vafb_slc_4e') + +launch_pad.id # 6 +launch_pad.name # 'VAFB SLC 4E' +launch_pad.status # 'active' +launch_pad.location['name'] # 'Vandenberg Air Force Base', +launch_pad.location['region'] # 'California', +launch_pad.location['latitude'] # 34.632093, +launch_pad.location['longitude'] # -120.610829 +launch_pad.vehicles_launched # ['Falcon 9'] +launch_pad.attempted_launches # 15 +launch_pad.successful_launches # 15 +launch_pad.wikipedia # 'https://en.wikipedia.org/wiki/Vandenberg_AFB_Space_Launch_Complex_4' +launch_pad.details # 'SpaceX primary west coast launch pad for polar orbits and sun synchronous orbits, primarily used for Iridium. Also intended to be capable of launching Falcon Heavy.' +launch_pad.site_id # 'vafb_slc_4e' +launch_pad.site_name_long # 'Vandenberg Air Force Base Space Launch Complex 4E' ``` ### Launches - Get information for all launches: `SPACEX::Launches.all` or `SPACEX::Launches.info`