spacex 1.0.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +26 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +52 -3
- data/CLAUDE.md +55 -0
- data/Dangerfile +28 -0
- data/Gemfile +12 -1
- data/README.md +52 -510
- data/docs/v3.md +525 -0
- data/docs/v4.md +179 -0
- data/lib/spacex/base_request.rb +8 -8
- data/lib/spacex/capsules.rb +10 -12
- data/lib/spacex/company.rb +7 -0
- data/lib/spacex/cores.rb +11 -14
- data/lib/spacex/crew.rb +15 -0
- data/lib/spacex/{dragon_capsules.rb → dragons.rb} +14 -16
- data/lib/spacex/history.rb +9 -2
- data/lib/spacex/landpads.rb +23 -0
- data/lib/spacex/launches.rb +35 -11
- data/lib/spacex/launchpads.rb +23 -0
- data/lib/spacex/models.rb +16 -0
- data/lib/spacex/payloads.rb +31 -2
- data/lib/spacex/rockets.rb +26 -3
- data/lib/spacex/ships.rb +22 -24
- data/lib/spacex/starlink.rb +16 -0
- data/lib/spacex/version.rb +1 -1
- data/lib/spacex.rb +2 -17
- data/spacex.gemspec +5 -8
- data/spec/coverage_helper.rb +5 -0
- data/spec/fixtures/spacex/v4/capsules/all.yml +122 -0
- data/spec/fixtures/spacex/v4/capsules/one.yml +89 -0
- data/spec/fixtures/spacex/v4/company.yml +80 -0
- data/spec/fixtures/spacex/v4/cores/all.yml +76 -0
- data/spec/fixtures/spacex/v4/cores/one.yml +75 -0
- data/spec/fixtures/spacex/v4/crew/all.yml +92 -0
- data/spec/fixtures/spacex/v4/crew/one.yml +74 -0
- data/spec/fixtures/spacex/v4/dragons/all.yml +101 -0
- data/spec/fixtures/spacex/v4/dragons/one.yml +189 -0
- data/spec/fixtures/spacex/v4/history/all.yml +85 -0
- data/spec/fixtures/spacex/v4/history/one.yml +168 -0
- data/spec/fixtures/spacex/v4/landpads/all.yml +85 -0
- data/spec/fixtures/spacex/v4/landpads/one.yml +172 -0
- data/spec/fixtures/spacex/v4/launches/all.yml +85 -0
- data/spec/fixtures/spacex/v4/launches/latest.yml +84 -0
- data/spec/fixtures/spacex/v4/launches/next.yml +84 -0
- data/spec/fixtures/spacex/v4/launches/one.yml +167 -0
- data/spec/fixtures/spacex/v4/launches/past.yml +85 -0
- data/spec/fixtures/spacex/v4/launches/upcoming.yml +97 -0
- data/spec/fixtures/spacex/v4/launchpads/all.yml +139 -0
- data/spec/fixtures/spacex/v4/launchpads/one.yml +225 -0
- data/spec/fixtures/spacex/v4/payloads/all.yml +85 -0
- data/spec/fixtures/spacex/v4/payloads/one.yml +167 -0
- data/spec/fixtures/spacex/v4/roadster.yml +90 -0
- data/spec/fixtures/spacex/v4/rockets/all.yml +76 -0
- data/spec/fixtures/spacex/v4/rockets/one.yml +84 -0
- data/spec/fixtures/spacex/v4/ships/all.yml +164 -0
- data/spec/fixtures/spacex/v4/ships/one.yml +248 -0
- data/spec/fixtures/spacex/v4/starlink/all.yml +17713 -0
- data/spec/fixtures/spacex/v4/starlink/one.yml +17798 -0
- data/spec/spacex/base_request_spec.rb +112 -0
- data/spec/spacex/capsules_spec.rb +19 -28
- data/spec/spacex/company_spec.rb +26 -0
- data/spec/spacex/cores_spec.rb +18 -31
- data/spec/spacex/crew_spec.rb +27 -0
- data/spec/spacex/dragons_spec.rb +39 -0
- data/spec/spacex/history_spec.rb +16 -40
- data/spec/spacex/landpads_spec.rb +35 -0
- data/spec/spacex/launches_spec.rb +28 -628
- data/spec/spacex/launchpads_spec.rb +34 -0
- data/spec/spacex/payloads_spec.rb +27 -51
- data/spec/spacex/roadster_spec.rb +5 -29
- data/spec/spacex/rockets_spec.rb +26 -194
- data/spec/spacex/ships_spec.rb +20 -51
- data/spec/spacex/starlink_spec.rb +28 -0
- data/spec/spacex/version_spec.rb +12 -0
- data/spec/spec_helper.rb +3 -9
- metadata +103 -134
- data/.ruby-version +0 -1
- data/.travis.yml +0 -21
- data/lib/spacex/api_info.rb +0 -7
- data/lib/spacex/company_info.rb +0 -7
- data/lib/spacex/endpoint.rb +0 -3
- data/lib/spacex/landing_pads.rb +0 -11
- data/lib/spacex/launch_pads.rb +0 -11
- data/lib/spacex/missions.rb +0 -18
- data/spec/fixtures/spacex/api_info/info.yml +0 -65
- data/spec/fixtures/spacex/capsules/C202.yml +0 -123
- data/spec/fixtures/spacex/capsules.yml +0 -83
- data/spec/fixtures/spacex/company_info/info.yml +0 -129
- data/spec/fixtures/spacex/cores/B1041.yml +0 -123
- data/spec/fixtures/spacex/cores.yml +0 -62
- data/spec/fixtures/spacex/dragon_capsules/info/dragon1.yml +0 -131
- data/spec/fixtures/spacex/dragon_capsules/info.yml +0 -77
- data/spec/fixtures/spacex/history/info/4.yml +0 -62
- data/spec/fixtures/spacex/history/info.yml +0 -62
- data/spec/fixtures/spacex/landing_pads/info/LZ-4.yml +0 -70
- data/spec/fixtures/spacex/landing_pads/info.yml +0 -68
- data/spec/fixtures/spacex/launch_pads/info/vafb_slc_4e.yml +0 -71
- data/spec/fixtures/spacex/launch_pads/info.yml +0 -104
- data/spec/fixtures/spacex/launches/68.yml +0 -69
- data/spec/fixtures/spacex/launches/all.yml +0 -62
- data/spec/fixtures/spacex/launches/info.yml +0 -62
- data/spec/fixtures/spacex/launches/latest.yml +0 -245
- data/spec/fixtures/spacex/launches/next.yml +0 -123
- data/spec/fixtures/spacex/launches/past.yml +0 -62
- data/spec/fixtures/spacex/launches/upcoming.yml +0 -64
- data/spec/fixtures/spacex/launches.yml +0 -62
- data/spec/fixtures/spacex/missions/F3364BF.yml +0 -157
- data/spec/fixtures/spacex/missions/info.yml +0 -62
- data/spec/fixtures/spacex/payloads/RatSat.yml +0 -62
- data/spec/fixtures/spacex/payloads/info.yml +0 -62
- data/spec/fixtures/spacex/roadster/info.yml +0 -133
- data/spec/fixtures/spacex/rockets/info/falcon1.yml +0 -139
- data/spec/fixtures/spacex/rockets/info/invalid.yml +0 -61
- data/spec/fixtures/spacex/rockets/info.yml +0 -105
- data/spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml +0 -125
- data/spec/fixtures/spacex/ships/info.yml +0 -139
- data/spec/spacex/api_info_spec.rb +0 -16
- data/spec/spacex/company_info_spec.rb +0 -27
- data/spec/spacex/dragon_capsules_spec.rb +0 -107
- data/spec/spacex/endpoint_spec.rb +0 -9
- data/spec/spacex/landing_pads_spec.rb +0 -72
- data/spec/spacex/launch_pads_spec.rb +0 -77
- data/spec/spacex/missions_spec.rb +0 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f08ca1e01d80b1922668c71034ae3dce21dc1365d4c0bf85f73fdeddaf45d821
|
|
4
|
+
data.tar.gz: 84a2e60410992072b39dda2719c5e5fb9b934c2aba854442ed419125aafa68e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2656f35987ad503f00ea88f7577ef97b4999f7ded489ff0d21f35535f4040dfcc0473615dc0ffed82e0082920abfbe30a6d0102328067fe4c7876833254762cb
|
|
7
|
+
data.tar.gz: f4140ee9c5ce17c542f01bcf1076ff77c3bce63dfabf9ac22146568d5242328bdb90fbbd1086ed6c907f20452159819136244d8735651e30556349da50a9cfc4
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
ruby: ['3.2', '3.3']
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: ruby/setup-ruby@v1
|
|
21
|
+
with:
|
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
|
23
|
+
bundler-cache: true
|
|
24
|
+
|
|
25
|
+
- name: Run tests
|
|
26
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
+
Include:
|
|
3
|
+
- app/**/*.rb
|
|
4
|
+
- spec/**/*.rb
|
|
2
5
|
Exclude:
|
|
3
6
|
- vendor/**/*
|
|
7
|
+
- Dangerfile
|
|
8
|
+
NewCops: enable
|
|
4
9
|
|
|
5
10
|
Naming/MethodName:
|
|
6
11
|
Enabled: false
|
|
@@ -12,3 +17,4 @@ Style/Documentation:
|
|
|
12
17
|
Enabled: false
|
|
13
18
|
|
|
14
19
|
inherit_from: .rubocop_todo.yml
|
|
20
|
+
|
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
5
|
+
|
|
6
|
+
## [2.0.0] - 2026-03-21
|
|
7
|
+
|
|
8
|
+
### Breaking Changes
|
|
9
|
+
|
|
10
|
+
- `SPACEX::V4::*` namespace removed; use `SPACEX::*` directly
|
|
11
|
+
- V3-only endpoints removed entirely: `SPACEX::ApiInfo`, `SPACEX::Missions`,
|
|
12
|
+
`SPACEX::DragonCapsules`
|
|
13
|
+
- `SPACEX::Launches` now uses `/v4/launches` (different schema from V3)
|
|
14
|
+
- `SPACEX::Launches.all` removed (was a V3 alias; not carried forward)
|
|
15
|
+
- `SPACEX::LandingPads` renamed to `SPACEX::Landpads` (matches V4 path `/v4/landpads`)
|
|
16
|
+
- `SPACEX::LaunchPads` renamed to `SPACEX::Launchpads` (matches V4 path `/v4/launchpads`)
|
|
17
|
+
- `SPACEX::CompanyInfo` renamed to `SPACEX::Company` (matches V4 path `/v4/company`)
|
|
18
|
+
- `BaseRequest.info` no longer accepts a `version` parameter — always calls `/v4/`
|
|
19
|
+
- All `.info(id, _query = {})` signatures reduced to `.info(id = nil)` only
|
|
20
|
+
|
|
21
|
+
### Added
|
|
4
22
|
|
|
5
|
-
|
|
23
|
+
- `SPACEX::Company` — V4 company endpoint (replaces `SPACEX::CompanyInfo`)
|
|
24
|
+
- `SPACEX::Crew` — V4 crew endpoint with typed properties
|
|
25
|
+
- `SPACEX::Dragons` — new V4 dragons endpoint
|
|
26
|
+
- `SPACEX::History` — V4 history endpoint (replaces V3 version)
|
|
27
|
+
- `SPACEX::Landpads` — new V4 landpads endpoint
|
|
28
|
+
- `SPACEX::Launchpads` — new V4 launchpads endpoint
|
|
29
|
+
- `SPACEX::Payloads` — V4 payloads endpoint (replaces V3 version)
|
|
30
|
+
- `SPACEX::Roadster` — V4 roadster endpoint (replaces V3 version)
|
|
31
|
+
- `SPACEX::Rockets` — V4 rockets with typed properties (replaces V3/V4 version)
|
|
32
|
+
- `SPACEX::Ships` — V4 ships endpoint (replaces V3 version)
|
|
33
|
+
- `SPACEX::Starlink` — new V4 starlink endpoint
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### 1.1.0 (next)
|
|
38
|
+
|
|
39
|
+
* Your contribution here.
|
|
40
|
+
* [#95](https://github.com/rodolfobandeira/spacex/pull/95): Implement V4::Rockets [@invacuo](https://github.com/invacuo).
|
|
41
|
+
* [#96](https://github.com/rodolfobandeira/spacex/pull/96): Implement V4::Crew [@invacuo](https://github.com/invacuo).
|
|
42
|
+
* [#90](https://github.com/rodolfobandeira/spacex/pull/90): Implement V4::Cores [@mtking2](https://github.com/mtking2).
|
|
43
|
+
* [#91](https://github.com/rodolfobandeira/spacex/pull/91): Implement V4::Company [@mtking2](https://github.com/mtking2).
|
|
44
|
+
* [#93](https://github.com/rodolfobandeira/spacex/pull/93): Add DangerBot to help on Code Review [@rodolfobandeira](https://github.com/rodolfobandeira).
|
|
45
|
+
* [#89](https://github.com/rodolfobandeira/spacex/pull/89): Add a configurable simplecov to set a coverage threshold [@razanjoshi](https://github.com/razanjoshi).
|
|
46
|
+
* [#83](https://github.com/rodolfobandeira/spacex/pull/83): Implement V4::Capsules [@invacuo](https://github.com/invacuo).
|
|
47
|
+
* [#87](https://github.com/rodolfobandeira/spacex/pull/87): Update Rubocop version [@rodolfobandeira](https://github.com/rodolfobandeira).
|
|
48
|
+
* [#86](https://github.com/rodolfobandeira/spacex/pull/86): Make Github Actions run for MacOS and Ubuntu. As well many versions of Ruby [@rodolfobandeira](https://github.com/rodolfobandeira).
|
|
49
|
+
* [#79](https://github.com/rodolfobandeira/spacex/pull/79): Enable Github Actions [@rodolfobandeira](https://github.com/rodolfobandeira).
|
|
50
|
+
|
|
51
|
+
### 1.0.4 (2020/03/14)
|
|
6
52
|
|
|
7
53
|
* [#74](https://github.com/rodolfobandeira/spacex/pull/74): Security fix: CVE-2020-8130. Bump rake to version 12 [@rodolfobandeira](https://github.com/rodolfobandeira).
|
|
8
54
|
|
|
55
|
+
### 1.0.3 (skipped)
|
|
56
|
+
* Skipped
|
|
57
|
+
|
|
9
58
|
### 1.0.2 (2019/10/06)
|
|
10
59
|
|
|
11
60
|
* [#73](https://github.com/rodolfobandeira/spacex/pull/73): Fix Faraday adaptor failing rspec locally [@rodolfobandeira](https://github.com/rodolfobandeira).
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bundle install # Install dependencies
|
|
9
|
+
bundle exec rspec # Run all tests
|
|
10
|
+
bundle exec rspec spec/path/to_spec.rb # Run a single spec file
|
|
11
|
+
bundle exec rspec spec/path/to_spec.rb:42 # Run test at a specific line
|
|
12
|
+
bundle exec rubocop # Check style
|
|
13
|
+
bundle exec rubocop -a # Auto-fix style issues
|
|
14
|
+
bundle exec rake # Run rubocop + rspec (default task)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Coverage must remain at or above 93% (enforced by SimpleCov).
|
|
18
|
+
|
|
19
|
+
## Architecture
|
|
20
|
+
|
|
21
|
+
This is a Ruby HTTP client library wrapping the SpaceX REST API. It has two API versions with distinct patterns.
|
|
22
|
+
|
|
23
|
+
### HTTP Layer
|
|
24
|
+
|
|
25
|
+
`lib/spacex/base_request.rb` handles all requests using Faraday. The `info(path, klass = nil, version = 'v3')` class method builds the URL, makes the request, and wraps responses. Arrays of results are returned as-is; single-object responses are wrapped in `klass` (or `SPACEX::Response` if nil). `SPACEX::Response` extends `Hashie::Mash`, enabling attribute-style access on JSON.
|
|
26
|
+
|
|
27
|
+
### V3 Endpoints (legacy)
|
|
28
|
+
|
|
29
|
+
Modules under `lib/spacex/` with class methods. No property definitions — responses use dynamic `SPACEX::Response` (Hashie::Mash). Example:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
SPACEX::Launches.latest # GET /launches/latest
|
|
33
|
+
SPACEX::Launches.info(id) # GET /launches/:id
|
|
34
|
+
SPACEX::Launches.info # GET /launches
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### V4 Endpoints
|
|
38
|
+
|
|
39
|
+
Classes under `lib/spacex/v4/` extending `SPACEX::Resource` (which extends `Hashie::Trash`). Properties are declared explicitly. Include `Hashie::Extensions::IgnoreUndeclared` to tolerate unknown fields. Example:
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
SPACEX::V4::Crew.info # GET /v4/crew
|
|
43
|
+
SPACEX::V4::Crew.info(id) # GET /v4/crew/:id
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Adding a New V4 Endpoint
|
|
47
|
+
|
|
48
|
+
1. Create `lib/spacex/v4/thing.rb` extending `SPACEX::Resource`, declare properties, add `info` class method calling `BaseRequest.info`
|
|
49
|
+
2. Require it in `lib/spacex/models.rb`
|
|
50
|
+
3. Add VCR cassette fixture in `spec/fixtures/spacex/v4/`
|
|
51
|
+
4. Write spec in `spec/spacex/v4/thing_spec.rb` using `vcr: { cassette_name: 'v4/thing' }`
|
|
52
|
+
|
|
53
|
+
### Testing
|
|
54
|
+
|
|
55
|
+
Tests use RSpec + VCR for cassette-based HTTP mocking. Cassettes live in `spec/fixtures/spacex/`. VCR configuration is in `spec/support/vcr.rb`. Tag a context with `vcr: { cassette_name: 'path/cassette' }` to replay recorded HTTP.
|
data/Dangerfile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# message("Hello, this worked")
|
|
2
|
+
|
|
3
|
+
# DECLARE A PR TO BE SIMPLE TO AVOID SPECIFIC DANGER RULES
|
|
4
|
+
declared_trivial = (github.pr_title + github.pr_body).include?('#trivial')
|
|
5
|
+
|
|
6
|
+
warn 'This is a big PR eh? If possible, consider a small PR to help the code review process' if git.lines_of_code > 500
|
|
7
|
+
warn 'This PR does not have any reviewers yet.' unless github.pr_json['reviewers'].nil?
|
|
8
|
+
|
|
9
|
+
# Sometimes its a README fix, or something like that - which isn't relevant for
|
|
10
|
+
# including in a CHANGELOG for example
|
|
11
|
+
has_app_changes = !git.modified_files.grep(/lib/).empty?
|
|
12
|
+
has_test_changes = !git.modified_files.grep(/spec/).empty?
|
|
13
|
+
|
|
14
|
+
# Add a CHANGELOG entry for app changes
|
|
15
|
+
if !git.modified_files.include?('CHANGELOG.md') && (has_app_changes || has_test_changes) && !declared_trivial
|
|
16
|
+
failure "Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/rodolfobandeira/spacex/blob/main/CHANGELOG.md)."
|
|
17
|
+
message 'Note: Try to keep it simple. Just a short description with less than 10 words.'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
failure 'byebug left in tests' if `grep -r byebug spec/ `.length > 1
|
|
21
|
+
failure 'binding.pry left in tests' if `grep -r binding.pry spec/ `.length > 1
|
|
22
|
+
failure 'Please provide a summary in the Pull Request description' if github.pr_body.length < 5
|
|
23
|
+
|
|
24
|
+
# Rubocop
|
|
25
|
+
github.dismiss_out_of_range_messages # This and folling lines will make sure Rubocop runs only for the new
|
|
26
|
+
inline_comment = true # or modified lines only
|
|
27
|
+
fail_on_inline_comment = true # Fails instead of just "warn" for failed rubocop issues on new or modified files
|
|
28
|
+
rubocop.lint
|
data/Gemfile
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
source '
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
group :development, :test do
|
|
4
|
+
gem 'danger', '~> 9.0'
|
|
5
|
+
gem 'danger-rubocop'
|
|
6
|
+
gem 'simplecov', require: false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
group :development do
|
|
10
|
+
gem 'rubocop', '~> 1.22', require: false
|
|
11
|
+
end
|
|
12
|
+
|
|
2
13
|
group :test do
|
|
3
14
|
gem 'byebug'
|
|
4
15
|
gem 'pry'
|