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.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +26 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +6 -0
  5. data/.rubocop_todo.yml +1 -1
  6. data/CHANGELOG.md +52 -3
  7. data/CLAUDE.md +55 -0
  8. data/Dangerfile +28 -0
  9. data/Gemfile +12 -1
  10. data/README.md +52 -510
  11. data/docs/v3.md +525 -0
  12. data/docs/v4.md +179 -0
  13. data/lib/spacex/base_request.rb +8 -8
  14. data/lib/spacex/capsules.rb +10 -12
  15. data/lib/spacex/company.rb +7 -0
  16. data/lib/spacex/cores.rb +11 -14
  17. data/lib/spacex/crew.rb +15 -0
  18. data/lib/spacex/{dragon_capsules.rb → dragons.rb} +14 -16
  19. data/lib/spacex/history.rb +9 -2
  20. data/lib/spacex/landpads.rb +23 -0
  21. data/lib/spacex/launches.rb +35 -11
  22. data/lib/spacex/launchpads.rb +23 -0
  23. data/lib/spacex/models.rb +16 -0
  24. data/lib/spacex/payloads.rb +31 -2
  25. data/lib/spacex/rockets.rb +26 -3
  26. data/lib/spacex/ships.rb +22 -24
  27. data/lib/spacex/starlink.rb +16 -0
  28. data/lib/spacex/version.rb +1 -1
  29. data/lib/spacex.rb +2 -17
  30. data/spacex.gemspec +5 -8
  31. data/spec/coverage_helper.rb +5 -0
  32. data/spec/fixtures/spacex/v4/capsules/all.yml +122 -0
  33. data/spec/fixtures/spacex/v4/capsules/one.yml +89 -0
  34. data/spec/fixtures/spacex/v4/company.yml +80 -0
  35. data/spec/fixtures/spacex/v4/cores/all.yml +76 -0
  36. data/spec/fixtures/spacex/v4/cores/one.yml +75 -0
  37. data/spec/fixtures/spacex/v4/crew/all.yml +92 -0
  38. data/spec/fixtures/spacex/v4/crew/one.yml +74 -0
  39. data/spec/fixtures/spacex/v4/dragons/all.yml +101 -0
  40. data/spec/fixtures/spacex/v4/dragons/one.yml +189 -0
  41. data/spec/fixtures/spacex/v4/history/all.yml +85 -0
  42. data/spec/fixtures/spacex/v4/history/one.yml +168 -0
  43. data/spec/fixtures/spacex/v4/landpads/all.yml +85 -0
  44. data/spec/fixtures/spacex/v4/landpads/one.yml +172 -0
  45. data/spec/fixtures/spacex/v4/launches/all.yml +85 -0
  46. data/spec/fixtures/spacex/v4/launches/latest.yml +84 -0
  47. data/spec/fixtures/spacex/v4/launches/next.yml +84 -0
  48. data/spec/fixtures/spacex/v4/launches/one.yml +167 -0
  49. data/spec/fixtures/spacex/v4/launches/past.yml +85 -0
  50. data/spec/fixtures/spacex/v4/launches/upcoming.yml +97 -0
  51. data/spec/fixtures/spacex/v4/launchpads/all.yml +139 -0
  52. data/spec/fixtures/spacex/v4/launchpads/one.yml +225 -0
  53. data/spec/fixtures/spacex/v4/payloads/all.yml +85 -0
  54. data/spec/fixtures/spacex/v4/payloads/one.yml +167 -0
  55. data/spec/fixtures/spacex/v4/roadster.yml +90 -0
  56. data/spec/fixtures/spacex/v4/rockets/all.yml +76 -0
  57. data/spec/fixtures/spacex/v4/rockets/one.yml +84 -0
  58. data/spec/fixtures/spacex/v4/ships/all.yml +164 -0
  59. data/spec/fixtures/spacex/v4/ships/one.yml +248 -0
  60. data/spec/fixtures/spacex/v4/starlink/all.yml +17713 -0
  61. data/spec/fixtures/spacex/v4/starlink/one.yml +17798 -0
  62. data/spec/spacex/base_request_spec.rb +112 -0
  63. data/spec/spacex/capsules_spec.rb +19 -28
  64. data/spec/spacex/company_spec.rb +26 -0
  65. data/spec/spacex/cores_spec.rb +18 -31
  66. data/spec/spacex/crew_spec.rb +27 -0
  67. data/spec/spacex/dragons_spec.rb +39 -0
  68. data/spec/spacex/history_spec.rb +16 -40
  69. data/spec/spacex/landpads_spec.rb +35 -0
  70. data/spec/spacex/launches_spec.rb +28 -628
  71. data/spec/spacex/launchpads_spec.rb +34 -0
  72. data/spec/spacex/payloads_spec.rb +27 -51
  73. data/spec/spacex/roadster_spec.rb +5 -29
  74. data/spec/spacex/rockets_spec.rb +26 -194
  75. data/spec/spacex/ships_spec.rb +20 -51
  76. data/spec/spacex/starlink_spec.rb +28 -0
  77. data/spec/spacex/version_spec.rb +12 -0
  78. data/spec/spec_helper.rb +3 -9
  79. metadata +103 -134
  80. data/.ruby-version +0 -1
  81. data/.travis.yml +0 -21
  82. data/lib/spacex/api_info.rb +0 -7
  83. data/lib/spacex/company_info.rb +0 -7
  84. data/lib/spacex/endpoint.rb +0 -3
  85. data/lib/spacex/landing_pads.rb +0 -11
  86. data/lib/spacex/launch_pads.rb +0 -11
  87. data/lib/spacex/missions.rb +0 -18
  88. data/spec/fixtures/spacex/api_info/info.yml +0 -65
  89. data/spec/fixtures/spacex/capsules/C202.yml +0 -123
  90. data/spec/fixtures/spacex/capsules.yml +0 -83
  91. data/spec/fixtures/spacex/company_info/info.yml +0 -129
  92. data/spec/fixtures/spacex/cores/B1041.yml +0 -123
  93. data/spec/fixtures/spacex/cores.yml +0 -62
  94. data/spec/fixtures/spacex/dragon_capsules/info/dragon1.yml +0 -131
  95. data/spec/fixtures/spacex/dragon_capsules/info.yml +0 -77
  96. data/spec/fixtures/spacex/history/info/4.yml +0 -62
  97. data/spec/fixtures/spacex/history/info.yml +0 -62
  98. data/spec/fixtures/spacex/landing_pads/info/LZ-4.yml +0 -70
  99. data/spec/fixtures/spacex/landing_pads/info.yml +0 -68
  100. data/spec/fixtures/spacex/launch_pads/info/vafb_slc_4e.yml +0 -71
  101. data/spec/fixtures/spacex/launch_pads/info.yml +0 -104
  102. data/spec/fixtures/spacex/launches/68.yml +0 -69
  103. data/spec/fixtures/spacex/launches/all.yml +0 -62
  104. data/spec/fixtures/spacex/launches/info.yml +0 -62
  105. data/spec/fixtures/spacex/launches/latest.yml +0 -245
  106. data/spec/fixtures/spacex/launches/next.yml +0 -123
  107. data/spec/fixtures/spacex/launches/past.yml +0 -62
  108. data/spec/fixtures/spacex/launches/upcoming.yml +0 -64
  109. data/spec/fixtures/spacex/launches.yml +0 -62
  110. data/spec/fixtures/spacex/missions/F3364BF.yml +0 -157
  111. data/spec/fixtures/spacex/missions/info.yml +0 -62
  112. data/spec/fixtures/spacex/payloads/RatSat.yml +0 -62
  113. data/spec/fixtures/spacex/payloads/info.yml +0 -62
  114. data/spec/fixtures/spacex/roadster/info.yml +0 -133
  115. data/spec/fixtures/spacex/rockets/info/falcon1.yml +0 -139
  116. data/spec/fixtures/spacex/rockets/info/invalid.yml +0 -61
  117. data/spec/fixtures/spacex/rockets/info.yml +0 -105
  118. data/spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml +0 -125
  119. data/spec/fixtures/spacex/ships/info.yml +0 -139
  120. data/spec/spacex/api_info_spec.rb +0 -16
  121. data/spec/spacex/company_info_spec.rb +0 -27
  122. data/spec/spacex/dragon_capsules_spec.rb +0 -107
  123. data/spec/spacex/endpoint_spec.rb +0 -9
  124. data/spec/spacex/landing_pads_spec.rb +0 -72
  125. data/spec/spacex/launch_pads_spec.rb +0 -77
  126. data/spec/spacex/missions_spec.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ba8dea97006be5eeec023b28e7682cb23404c9c9
4
- data.tar.gz: f4339d8b99c2b0449106834051e530b13bb424fa
2
+ SHA256:
3
+ metadata.gz: f08ca1e01d80b1922668c71034ae3dce21dc1365d4c0bf85f73fdeddaf45d821
4
+ data.tar.gz: 84a2e60410992072b39dda2719c5e5fb9b934c2aba854442ed419125aafa68e8
5
5
  SHA512:
6
- metadata.gz: cb37692b58fa907c1d16f7058f2ecc5795908e29411ba1e12312f4af04905b96fdd3869cf8f15a60cd2abdecc53b179e7f142864d7561cbb3eb7e0bac0b6a993
7
- data.tar.gz: d1e4f3cba8dfb8dbd644d008120bd2b13737139a40e892ea8efea285988467c41fae6235f54336d8b8886e36fd32100abda171e98e704c82b37823eae82e86ed
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
@@ -51,3 +51,4 @@ Gemfile.lock
51
51
 
52
52
  *.gem
53
53
  .byebug_history
54
+ .claude
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
@@ -20,5 +20,5 @@ Metrics/BlockLength:
20
20
  # Offense count: 136
21
21
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
22
22
  # URISchemes: http, https
23
- Metrics/LineLength:
23
+ Layout/LineLength:
24
24
  Max: 264
data/CHANGELOG.md CHANGED
@@ -1,11 +1,60 @@
1
- ### 1.0.4 (next)
1
+ # Changelog
2
2
 
3
- * Your contribution here.
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
- ### 1.0.3 (2020/03/14)
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 'http://rubygems.org'
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'