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
data/README.md CHANGED
@@ -2,10 +2,7 @@ SpaceX Ruby Client
2
2
  ===============
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/spacex.svg)](https://badge.fury.io/rb/spacex)
5
- [![Build Status](https://travis-ci.com/rodolfobandeira/spacex.svg?branch=master)](https://travis-ci.org/rodolfobandeira/spacex)
6
- [![Coverage Status - Coverall](https://coveralls.io/repos/github/rodolfobandeira/spacex/badge.svg?branch=master)](https://coveralls.io/github/rodolfobandeira/spacex?branch=master)
7
- [![Maintainability](https://api.codeclimate.com/v1/badges/d125a8ff6d902eb48c8f/maintainability)](https://codeclimate.com/github/rodolfobandeira/spacex/maintainability)
8
- [![Test Coverage - CodeClimate](https://api.codeclimate.com/v1/badges/d125a8ff6d902eb48c8f/test_coverage)](https://codeclimate.com/github/rodolfobandeira/spacex/test_coverage)
5
+ [![Tests](https://github.com/rodolfobandeira/spacex/actions/workflows/ruby.yml/badge.svg)](https://github.com/rodolfobandeira/spacex/actions/workflows/ruby.yml)
9
6
 
10
7
  A Ruby library that consumes the [SpaceX API](https://github.com/r-spacex/SpaceX-API).
11
8
 
@@ -13,50 +10,11 @@ A Ruby library that consumes the [SpaceX API](https://github.com/r-spacex/SpaceX
13
10
  ## Table of Contents
14
11
 
15
12
  - [Installation](#installation)
16
- - [Usage](#usage)
17
- - [API Info](#api-info)
18
- - `SPACEX::ApiInfo.info`
19
- - [Capsules](#capsules)
20
- - `SPACEX::Capsules.info`
21
- - `SPACEX::Capsules.info('capsule_serial')`
22
- - [Company Info](#company-info)
23
- - `SPACEX::CompanyInfo.info`
24
- - [Cores](#cores)
25
- - `SPACEX::Cores.info`
26
- - `SPACEX::Cores.info('core_serial')`
27
- - [Dragon Capsules](#dragon-capsules)
28
- - `SPACEX::DragonCapsules.info`
29
- - `SPACEX::DragonCapsules.info('dragon_id')`
30
- - [History](#history)
31
- - `SPACEX::History.info`
32
- - `SPACEX::History.info(4)`
33
- - [LandingPads](#landing_pads)
34
- - `SPACEX::LandingPads.info`
35
- - `SPACEX::LandingPads.info('LZ-4')`
36
- - [LaunchPads](#launch_pads)
37
- - `SPACEX::LaunchPads.info`
38
- - `SPACEX::LaunchPads.info('vafb_slc_4e')`
13
+ - [Quick Start](#quick-start)
39
14
  - [Launches](#launches)
40
- - `SPACEX::Launches.all`
41
- - `SPACEX::Launches.info`
42
- - `SPACEX::Launches.info('flight_number')`
43
- - `SPACEX::Launches.latest`
44
- - `SPACEX::Launches.next`
45
- - `SPACEX::Launches.past`
46
- - [Missions](#missions)
47
- - `SPACEX::Missions.info`
48
- - `SPACEX::Missions.info('mission_id')`
49
- - [Payloads](#payloads)
50
- - `SPACEX::Payloads.info`
51
- - `SPACEX::Payloads.info('payload_id')`
52
- - [Roadster](#roadster)
53
- - `SPACEX::Roadster.info`
54
15
  - [Rockets](#rockets)
55
- - `SPACEX::Rockets.info`
56
- - `SPACEX::Rockets.info('falcon1')`
57
- - [Ships](#ships)
58
- - `SPACEX::Ships.info`
59
- - `SPACEX::Ships.info('ship_id')`
16
+ - [Starlink](#starlink)
17
+ - [Available Resources](#available-resources)
60
18
  - [Contributing](#contributing)
61
19
  - [Copyright](#copyright)
62
20
 
@@ -72,489 +30,73 @@ gem 'spacex'
72
30
  Then run `bundle install`.
73
31
 
74
32
 
75
- ## Usage
76
-
77
- ### API Info
78
-
79
- - Get information about the API: `SPACEX::ApiInfo.info`
80
-
81
- Here's an example of the response:
82
-
83
- ```ruby
84
- api_info = SPACEX::ApiInfo.info
85
-
86
- api_info.project_name # 'SpaceX-API'
87
- 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'
88
- api_info.organization = # 'r/SpaceX'
89
- api_info.organization_link = # 'https://github.com/r-spacex'
90
- api_info.project_link = # 'https://github.com/r-spacex/SpaceX-API'
91
- api_info.version = # '3.1.0'
92
- ```
93
-
94
- ### Capsules
95
-
96
- - Get information for all capsules: `SPACEX::Capsules.info`
97
- - Get information about a specific capsule: `SPACEX::Capsules.info('capsule_serial')`
98
-
99
- This example shows how to get capsule information and what the data fields are for that object:
100
-
101
- ```ruby
102
- capsules_info = SPACEX::Capsules.info
103
-
104
- capsules_info.first.capsule_id # 'dragon2'
105
- capsules_info.first.capsule_serial # 'C201'
106
- capsules_info.first.details # 'Pressure vessel used for Dragon 2 structural testing. Rumored to be repurposed for first Red Dragon Mission'
107
- capsules_info.first.landings # 0
108
- capsules_info.first.missions # []
109
- capsules_info.first.original_launch # nil capsules_info.first.original_launch_unix # nil
110
- capsules_info.first.status # 'active'
111
- capsules_info.first.type # 'Dragon 2.0'
112
- ```
113
-
114
- ### Company Info
115
-
116
- - Get information about the company: `SPACEX::CompanyInfo.info`
117
-
118
- Here is an example of the company information:
119
-
120
- ```ruby
121
- company_info = SPACEX::CompanyInfo.info
122
-
123
- company_info.name # 'SpaceX'
124
- company_info.founder # 'Elon Musk'
125
- company_info.founded # 2002
126
- company_info.employees # 7000
127
- company_info.vehicles # 3
128
- company_info.launche_sites # nil
129
- company_info.test_sites # 1
130
- company_info.ceo # 'Elon Musk'
131
- company_info.cto # 'Elon Musk'
132
- company_info.coo # 'Gwynne Shotwell'
133
- company_info.cto_propulsion # 'Tom Mueller'
134
- company_info.valuation # 15_000_000_000
135
- company_info.headquarters.address # 'Rocket Road'
136
- company_info.headquarters.city # 'Hawthorne'
137
- company_info.headquarters.state # 'California'
138
- company_info.summary # 'SpaceX designs, manufactures and launches advanced rockets and spacecraft. The company was founded in 2002 to revolutionize space technology, with the ultimate goal of enabling people to live on other planets.'
139
- ```
140
-
141
- ### Cores
142
-
143
- - Get information for all cores: `SPACEX::Cores.info`
144
- - Get information about a specific core: `SPACEX::Cores.info('core_serial')`
145
-
146
- The following code snippet shows how to get the cores information and what the data fields are for a single core:
147
-
148
- ```ruby
149
- cores_info = SPACEX::Cores.info
150
-
151
- cores_info.first.asds_attempts # 0
152
- cores_info.first.asds_landings # 0
153
- cores_info.first.block # 5
154
- cores_info.first.core_serial # 'B1052'
155
- cores_info.first.details # 'On test stand at McGregor'
156
- cores_info.first.missions # []
157
- cores_info.first.original_launch # nil
158
- cores_info.first.original_launch_unix # nil
159
- cores_info.first.rtls_attempts # 0
160
- cores_info.first.rtls_landings # 0
161
- cores_info.first.status # 'active'
162
- cores_info.first.water_landing # false
163
- ```
164
-
165
- ### Dragon Capsules
166
-
167
- - Get information for all dragon capsules: `SPACEX::DragonCapsules.info`
168
- - Get information about a specific dragon capsule: `SPACEX::DragonCapsules.info('dragon_id')`
169
-
170
- This code snippet shows the `dragon1` dragon capsule information:
171
-
172
- ```ruby
173
- dragon_capsules = SPACEX::DragonCapsules.info
174
-
175
- dragon_capsules.first.capsule_id # "dragon1"
176
- dragon_capsules.first.name # "Dragon 1"
177
- dragon_capsules.first.type # "capsule"
178
- dragon_capsules.first.active # true
179
- dragon_capsules.first.crew_capacity # 0
180
- dragon_capsules.first.sidewall_angle_deg # 15
181
- dragon_capsules.first.orbit_duration_yr # 2
182
- dragon_capsules.first.dry_mass_kg # 4200
183
- dragon_capsules.first.dry_mass_lb # 9300
184
- dragon_capsules.first.first_flight # "2010-12-08"
185
- dragon_capsules.first.heat_shield['material'] # "PICA-X"
186
- dragon_capsules.first.heat_shield['size_meters'] # 3.6
187
- dragon_capsules.first.heat_shield['temp_degrees'] # 3000
188
- dragon_capsules.first.heat_shield['dev_partner'] # "NASA"
189
- dragon_capsules.first.thrusters[0]['type'] # "Draco"
190
- dragon_capsules.first.thrusters[0]['amount'] # 18
191
- dragon_capsules.first.thrusters[0]['pods'] # 4
192
- dragon_capsules.first.thrusters[0]['fuel_1'] # "nitrogen tetroxide"
193
- dragon_capsules.first.thrusters[0]['fuel_2'] # "monomethylhydrazine"
194
- dragon_capsules.first.thrusters[0]['thrust']['kN'] # 0.4
195
- dragon_capsules.first.thrusters[0]['thrust']['lbf'] # 90
196
- dragon_capsules.first.launch_payload_mass['kg'] # 6000
197
- dragon_capsules.first.launch_payload_mass['lb'] # 13228
198
- dragon_capsules.first.launch_payload_vol['cubic_meters'] # 25
199
- dragon_capsules.first.launch_payload_vol['cubic_feet'] # 883
200
- dragon_capsules.first.return_payload_mass['kg'] # 3000
201
- dragon_capsules.first.return_payload_mass['lb'] # 6614
202
- dragon_capsules.first.return_payload_vol['cubic_meters'] # 11
203
- dragon_capsules.first.return_payload_vol['cubic_feet'] # 388
204
- dragon_capsules.first.pressurized_capsule['payload_volume']['cubic_meters']) # 11
205
- dragon_capsules.first.pressurized_capsule['payload_volume']['cubic_feet'] # 388
206
- dragon_capsules.first.trunk['trunk_volume['cubic_meters'] # 14
207
- dragon_capsules.first.trunk['trunk_volume['cubic_feet'] # 494
208
- dragon_capsules.first.trunk['cargo']['solar_array'] # 2
209
- dragon_capsules.first.trunk['cargo']['unpressurized_cargo'] # true
210
- dragon_capsules.first.height_w_trunk['meters'] # 7.2
211
- dragon_capsules.first.height_w_trunk['feet'] # 23.6
212
- dragon_capsules.first.diameter['meters'] # 3.7
213
- dragon_capsules.first.diameter['feet'] # 12
214
- dragon_capsules.first.wikipedia # "https://en.wikipedia.org/wiki/SpaceX_Dragon"
215
- dragon_capsules.first.description # "Dragon is a reusable spacecraft developed by SpaceX, an American private space transportation company based in Hawthorne, California. Dragon is launched into space by the SpaceX Falcon 9 two-stage-to-orbit launch vehicle. The Dragon spacecraft was originally designed for human travel, but so far has only been used to deliver cargo to the International Space Station (ISS)."
216
- ```
217
-
218
- ### History
219
-
220
- - Get information for all historical events: `SPACEX::History.info`
221
- - Get information about a specific historical event: `SPACEX::History.info('4')`
222
-
223
- ```ruby
224
- require 'spacex'
225
- historical_events = SPACEX::History.info
226
-
227
- first_event = historical_events.first
228
- first_event.id # 1
229
- first_event.title # Falcon 1 Makes History
230
- first_event.event_date_utc # 2008-09-28T23:15:00Z
231
- first_event.event_date_unix # 1222643700
232
- first_event.flight_number # 4
233
- first_event.details # Falcon 1 becomes the first privately developed liquid fuel rocket to reach Earth orbit.
234
- first_event.links['reddit'] # nil
235
- first_event.links['article'] # http://www.spacex.com/news/2013/02/11/flight-4-launch-update-0
236
- first_event.links['wikipedia'] # https://en.wikipedia.org/wiki/Falcon_1
237
- ```
238
-
239
- ### LandingPads
240
-
241
- - Get information for all LandingPads: `SPACEX::LandingPads.info`
242
- - Get information about a specific LandingPad: `SPACEX::LandingPads.info('LZ-4')`
243
-
244
- This code shows how to get the information for a specific LandingPad by id and lists the fields:
245
-
246
- ```ruby
247
- landing_pad = SPACEX::LandingPads.info('LZ-4')
248
- landing_pad.id # 'LZ-4'
249
- landing_pad.full_name # 'Landing Zone 4'
250
- landing_pad.status # 'active'
251
- landing_pad.location['name'] # 'Vandenberg Air Force Base'
252
- landing_pad.location['region'] # 'California'
253
- landing_pad.location['latitude'] # 34.632989
254
- landing_pad.location['longitude'] # -120.615167
255
- landing_pad.landing_type # 'RTLS'
256
- landing_pad.attempted_landings # 2
257
- landing_pad.successful_landings # 2
258
- landing_pad.wikipedia # "https://en.wikipedia.org/wiki/Vandenberg_AFB_Space_Launch_Complex_4#LZ-4_landing_history"
259
- 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."
260
- ```
261
-
262
- ### LaunchPads
263
-
264
- - Get information for all LaunchPads: `SPACEX::LaunchPads.info`
265
- - Get information about a specific LaunchPad: `SPACEX::LaunchPads.info('vafb_slc_4e')`
266
-
267
- This code shows how to get the information for a specific LaunchPad by site_id and lists the fields:
268
-
269
- ```ruby
270
- launch_pad = SPACEX::LaunchPads.info('vafb_slc_4e')
271
-
272
- launch_pad.id # 6
273
- launch_pad.name # 'VAFB SLC 4E'
274
- launch_pad.status # 'active'
275
- launch_pad.location['name'] # 'Vandenberg Air Force Base',
276
- launch_pad.location['region'] # 'California',
277
- launch_pad.location['latitude'] # 34.632093,
278
- launch_pad.location['longitude'] # -120.610829
279
- launch_pad.vehicles_launched # ['Falcon 9']
280
- launch_pad.attempted_launches # 15
281
- launch_pad.successful_launches # 15
282
- launch_pad.wikipedia # 'https://en.wikipedia.org/wiki/Vandenberg_AFB_Space_Launch_Complex_4'
283
- 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.'
284
- launch_pad.site_id # 'vafb_slc_4e'
285
- launch_pad.site_name_long # 'Vandenberg Air Force Base Space Launch Complex 4E'
286
- ```
33
+ ## Quick Start
287
34
 
288
35
  ### Launches
289
36
 
290
- - Get information for all launches: `SPACEX::Launches.all` or `SPACEX::Launches.info`
291
- - Get information about a specific launch: `SPACEX::Launches.info('flight_number')`
292
- - Get information on past launches: `SPACEX::Launches.past`
293
- - Get information on the next launch: `SPACEX::Launches.next`
294
- - Get the latest launch information: `SPACEX::Launches.latest`
295
- - Get information on upcoming launches: `SPACEX::Launches.upcoming`
296
-
297
- This code snippet shows how to get information for a specific launch by flight number and list the fields:
298
-
299
- ```ruby
300
- require 'spacex'
301
- launch_68 = SPACEX::Launches.info(68)
302
-
303
- launch_68.flight_number # 68
304
- launch_68.mission_name # 'Telstar 18V'
305
- launch_68.rocket.rocket_name # 'Falcon 9'
306
- launch_68.rocket.first_stage.cores.first.land_success # true
307
- ```
308
-
309
- This code snippet shows how to get information on past launches:
310
37
  ```ruby
311
- past_launches = SPACEX::Launches.past
312
-
313
- past_launches.first.flight_number # 1
314
- past_launches.first.mission_name # 'FalconSat'
315
- past_launches.first.rocket.rocket_name # 'Falcon 1'
316
- past_launches.first.launch_success # false
317
-
318
- past_launches.last.flight_number # 69
319
- past_launches.last.mission_name # 'SAOCOM 1A'
320
- past_launches.last.rocket.rocket_name # 'Falcon 9'
321
- past_launches.last.rocket.first_stage.cores.first.land_success # true
322
- past_launches.last.launch_success # true
323
- ```
324
-
325
-
326
-
327
- The following code snippet shows the latest launch information and the data fields available on the Launch object:
328
-
329
- ```ruby
330
- require 'spacex'
331
- latest_launch = SPACEX::Launches.latest
332
-
333
- latest_launch.flight_number # 67
334
- latest_launch.mission_name # 'Merah Putih'
335
- latest_launch.launch_year # '2018'
336
- latest_launch.launch_date_unix # 1_533_619_080
337
- latest_launch.launch_date_utc # '2018-08-07T05:18:00.000Z'
338
- latest_launch.launch_date_local # '2018-08-07T01:18:00-04:00'
339
- latest_launch.launch_success # true
340
- latest_launch.rocket.rocket_id # 'falcon9'
341
- latest_launch.rocket.rocket_name # 'Falcon 9'
342
- latest_launch.rocket.rocket_type # 'FT'
343
- latest_launch.rocket.first_stage.cores.first.core_serial # 'B1046'
344
- latest_launch.rocket.first_stage.cores.first.flight # 2
345
- latest_launch.rocket.first_stage.cores.first.block # 5
346
- latest_launch.rocket.first_stage.cores.first.reused # true
347
- latest_launch.rocket.first_stage.cores.first.land_success # true
348
- latest_launch.rocket.first_stage.cores.first.landing_type # 'ASDS'
349
- latest_launch.rocket.first_stage.cores.first.landing_vehicle # 'OCISLY'
350
- latest_launch.rocket.second_stage.block # 5
351
- latest_launch.rocket.second_stage.payloads.first.payload_id # 'Telkom-4'
352
- latest_launch.rocket.second_stage.payloads.first.norad_id.first # 43_587
353
- latest_launch.rocket.second_stage.payloads.first.reused # false
354
- latest_launch.rocket.second_stage.payloads.first.customers.first # 'Telkom'
355
- latest_launch.rocket.second_stage.payloads.first.nationality # 'Indonesia'
356
- latest_launch.rocket.second_stage.payloads.first.manufacturer # 'SSL'
357
- latest_launch.rocket.second_stage.payloads.first.payload_type # 'Satellite'
358
- latest_launch.rocket.second_stage.payloads.first.payload_mass_kg # 5800
359
- latest_launch.rocket.second_stage.payloads.first.payload_mass_lbs # 12_786.81
360
- latest_launch.rocket.second_stage.payloads.first.orbit # 'GTO'
361
- latest_launch.rocket.second_stage.payloads.first.orbit_params.reference_system # 'geocentric'
362
- latest_launch.rocket.second_stage.payloads.first.orbit_params.regime # 'geostationary'
363
- latest_launch.rocket.second_stage.payloads.first.orbit_params.longitude # -108
364
- latest_launch.rocket.second_stage.payloads.first.orbit_params.semi_major_axis_km # 21_226.178
365
- latest_launch.rocket.second_stage.payloads.first.orbit_params.eccentricity # 0.6904141
366
- latest_launch.rocket.second_stage.payloads.first.orbit_params.periapsis_km # 193.19
367
- latest_launch.rocket.second_stage.payloads.first.orbit_params.apoapsis_km # 29_502.896
368
- latest_launch.rocket.second_stage.payloads.first.orbit_params.inclination_deg # 27.0648
369
- latest_launch.rocket.second_stage.payloads.first.orbit_params.period_min # 512.941
370
- latest_launch.rocket.second_stage.payloads.first.orbit_params.lifespan_years # 15
371
- latest_launch.rocket.second_stage.payloads.first.orbit_params.epoch # '2018-08-07T06:57:16.000Z'
372
- latest_launch.rocket.second_stage.payloads.first.orbit_params.mean_motion # 2.80734018
373
- latest_launch.rocket.second_stage.payloads.first.orbit_params.raan # 227.0228
374
- latest_launch.telemetry.flight_club # nil
375
- latest_launch.reuse.core # true
376
- latest_launch.reuse.sire_core1 # nil
377
- latest_launch.reuse.side_core2 # false
378
- latest_launch.reuse.fairings # false
379
- latest_launch.reuse.capsule # false
380
- latest_launch.launch_site.site_id # 'ccafs_slc_40'
381
- latest_launch.launch_site.site_name # 'CCAFS SLC 40'
382
- latest_launch.launch_site.site_name_long # 'Cape Canaveral Air Force Station Space Launch Complex 40'
383
- latest_launch.launch_success # true
384
- latest_launch.links.mission_patch # 'https://images2.imgbox.com/a8/f5/ZgdsrbqW_o.png'
385
- latest_launch.links.mision_patch_small # nil
386
- latest_launch.links.reddit_campaign # 'https://www.reddit.com/r/spacex/comments/91gwfg/merah_putih_telkom4_launch_campaign_thread/'
387
- latest_launch.links.reddit_launch # 'https://www.reddit.com/r/spacex/comments/9539nr/rspacex_merah_putih_telkom4_official_launch/'
388
- latest_launch.links.reddit_recovery # nil
389
- latest_launch.links.reddit_media # 'https://www.reddit.com/r/spacex/comments/94zr0b/rspacex_merah_putih_media_thread_videos_images/'
390
- latest_launch.links.presskit # 'https://www.spacex.com/sites/spacex/files/merahputihpresskit.pdf'
391
- latest_launch.links.article_link # 'https://spaceflightnow.com/2018/08/07/indonesian-communications-satellite-deployed-in-orbit-by-spacex/'
392
- latest_launch.links.wikipedia # 'https://en.wikipedia.org/wiki/Telkom_Indonesia'
393
- latest_launch.links.video_link # 'https://www.youtube.com/watch?v=FjfQNBYv2IY'
394
- latest_launch.details # 'Indonesian comsat intended to replace the aging Telkom 1 at 108° E. First reflight of a Block 5-version booster.'
395
- latest_launch.upcoming # false
396
- latest_launch.static_fire_date_utc # '2018-08-02T15:53:00.000Z'
397
- ```
398
-
399
- This code snippet shows how to get information on upcoming launches:
400
- ```ruby
401
- upcoming_launches = SPACEX::Launches.upcoming
402
-
403
- upcoming_launches.first.flight_number # 70
404
- upcoming_launches.first.mission_name # 'Es’hail 2'
405
- upcoming_launches.first.launch_date_utc # '2018-11-14T20:46:00.000Z'
38
+ # Get the latest launch
39
+ launch = SPACEX::Launches.latest
40
+ launch.name # "Starlink 6-14"
41
+ launch.date_utc # "2023-09-08T02:47:00.000Z"
42
+ launch.success # true
43
+ launch.details # "..."
406
44
 
407
- upcoming_launches.last.flight_number # 91
408
- upcoming_launches.last.mission_name # 'GPS IIIA-3'
409
- upcoming_launches.last.launch_date_utc # '2019-10-01T00:00:00.000Z'
45
+ # Get upcoming launches
46
+ upcoming = SPACEX::Launches.upcoming
47
+ upcoming.first.name # "Starlink 7-1"
48
+ upcoming.first.date_utc # "2024-01-15T00:00:00.000Z"
410
49
  ```
411
50
 
412
- ### Missions
51
+ Also available: `SPACEX::Launches.info`, `SPACEX::Launches.next`, `SPACEX::Launches.past`.
413
52
 
414
- - Get information for all mission: `SPACEX::Missions.info`
415
- - Get information about a specific mission: `SPACEX::Missions.info('mission_id')`
416
-
417
- This code shows how to get the first mission information and lists the fields:
53
+ ### Rockets
418
54
 
419
55
  ```ruby
420
- missions = SPACEX::Missions.info
421
-
422
- missions.first.mission_id # "F3364BF"
423
- missions.first.mission_name # "Iridium NEXT"
424
- missions.first.manufacturers # ["Orbital ATK"]
425
- missions.first.payload_ids # ["Iridium NEXT 1", "Iridium NEXT 2", "Iridium NEXT 3", "Iridium NEXT 4", "Iridium NEXT 5", "Iridium NEXT 6", "Iridium NEXT 7"]
426
- missions.first.wikipedia # "https://en.wikipedia.org/wiki/Iridium_satellite_constellation"
427
- missions.first.website # "https://www.iridiumnext.com/"
428
- missions.first.twitter # "https://twitter.com/IridiumBoss?lang=en"
429
- missions.first.description # "In 2017, Iridium began launching Iridium NEXT, a second-generation worldwide network of telecommunications satellites, consisting of 66 active satellites, with another nine in-orbit spares and six on-ground spares. These satellites will incorporate features such as data transmission that were not emphasized in the original design. The constellation will provide L-band data speeds of up to 128 kbit/s to mobile terminals, up to 1.5 Mbit/s to Iridium Pilot marine terminals, and high-speed Ka-band service of up to 8 Mbit/s to fixed/transportable terminals. The next-generation terminals and service are expected to be commercially available by the end of 2018. However, Iridium's proposed use of its next-generation satellites has raised concerns the service will harmfully interfere with GPS devices. The satellites will incorporate a secondary payload for Aireon, a space-qualified ADS-B data receiver. This is for use by air traffic control and, via FlightAware, for use by airlines. A tertiary payload on 58 satellites is a marine AIS ship-tracker receiver, for Canadian company exactEarth Ltd. Iridium can also be used to provide a data link to other satellites in space, enabling command and control of other space assets regardless of the position of ground stations and gateways."
430
- ```
431
-
432
- ### Payloads
433
-
434
- - Get information for all payloads: `SPACEX::Payloads.info`
435
- - Get information about a specific payload: `SPACEX::Payloads.info('payload_id')`
436
-
437
- The following code shows how to get information about a specific payload and lists the payload data fields:
56
+ # Get all rockets
57
+ rockets = SPACEX::Rockets.info
58
+ rockets.first.name # "Falcon 1"
59
+ rockets.first.active # false
438
60
 
439
- ```ruby
440
- payload = SPACEX::Payloads.info('FalconSAT-2')
441
-
442
- payload.payload_id # 'FalconSAT-2'
443
- payload.reused # false
444
- payload.customers # ['DARPA']
445
- payload.nationality # 'United States'
446
- payload.manufacturer # 'SSTL'
447
- payload.payload_type # 'Satellite'
448
- payload.payload_mass_kg # 20
449
- payload.payload_mass_lbs # 43
450
- payload.orbit # 'LEO'
451
- payload.orbit_params # {"reference_system"=>"geocentric", "regime"=>"low-earth", "longitude"=>nil, "semi_major_axis_km"=>nil, "eccentricity"=>nil, "periapsis_km"=>400, "apoapsis_km"=>500, "inclination_deg"=>39, "period_min"=>nil, "lifespan_years"=>nil, "epoch"=>nil, "mean_motion"=>nil, "raan"=>nil, "arg_of_pericenter"=>nil, "mean_anomaly"=>nil}
61
+ # Get a specific rocket by ID
62
+ falcon9 = SPACEX::Rockets.info('5e9d0d95eda69973a809d1ec')
63
+ falcon9.name # "Falcon 9"
64
+ falcon9.active # true
65
+ falcon9.cost_per_launch # 50_000_000
452
66
  ```
453
67
 
454
- ### Roadster
455
-
456
- - Get roadster orbital data: `SPACEX::Roadster.info`
457
-
458
- The following code shows how to get information about the Roadster:
68
+ ### Starlink
459
69
 
460
70
  ```ruby
461
- roadster = SPACEX::Roadster.info
462
-
463
- roadster.name # "Elon Musk's Tesla Roadster"
464
- roadster.launch_date_utc # '2018-02-06T20:45:00.000Z'
465
- roadster.launch_date_unix # 1_517_949_900
466
- roadster.launch_date_kg # nil
467
- roadster.launch_date_lbs # nil
468
- roadster.norad_id # 43_205
469
- roadster.epoch_jd # 2_458_353.027800926
470
- roadster.orbit_type # 'heliocentric'
471
- roadster.apoapsis_au # 1.663757412460597
472
- roadster.periapsis_au # 0.9860953641129515
473
- roadster.semo_major_axis_au # nil
474
- roadster.eccentricity # 0.2557357353354217
475
- roadster.inclination # 1.077474057737451
476
- roadster.longitude # 317.0962040947829
477
- roadster.periapsis_arg # 177.491390597234
478
- roadster.speed_kph # 76_703.72399999999
479
- roadster.speed_mph # 47_661.469685603995
480
- roadster.earth_distance_km # 172_954_806.23899576
481
- roadster.earth_distance_mi # 107_469_100.90753104
482
- roadster.mars_distance_km # 147_648_108.6344399
483
- roadster.mars_distance_mi # 91_744_252.91029055
484
- roadster.wikipedia # 'https://en.wikipedia.org/wiki/Elon_Musk%27s_Tesla_Roadster'
485
- roadster.details # "Elon Musk's Tesla Roadster is an electric sports car that served as the dummy payload for the February 2018 Falcon Heavy test flight and is now an artificial satellite of the Sun. Starman, a mannequin dressed in a spacesuit, occupies the driver's seat. The car and rocket are products of Tesla and SpaceX, both companies founded by Elon Musk. This 2008-model Roadster was previously used by Musk for commuting, and is the only consumer car sent into space."
71
+ # Get all Starlink satellites
72
+ satellites = SPACEX::Starlink.info
73
+ satellites.first.latitude # 53.0 (illustrative live data will differ)
74
+ satellites.first.longitude # -94.0
75
+ satellites.first.height_km # 550.6
76
+ satellites.first.velocity_kms # 7.66
486
77
  ```
487
78
 
488
- ### Rockets
489
-
490
- - Get information for all rockets: `SPACEX::Rockets.info`
491
- - Get information about a specific rocket: `SPACEX::Rockets.info('rocket_id')`
492
-
493
- This example shows a single rocket and its data fields:
494
-
495
- ```
496
- rockets = SPACEX::Rockets.info
497
- first_rocket = rockets.first
498
-
499
- first_rocket.id # 1
500
- first_rocket.active # false
501
- first_rocket.stages # 2
502
- first_rocket.boosters # 0
503
- first_rocket.cost_per_launch # 6700000
504
- first_rocket.success_rate_pct # 40
505
- first_rocket.first_flight # "2006-03-24"
506
- first_rocket.country # "Republic of the Marshall Islands"
507
- first_rocket.company # "SpaceX"
508
- first_rocket.height # {"meters"=>22.25, "feet"=>73}
509
- first_rocket.diameter # {"meters"=>1.68, "feet"=>5.5}
510
- first_rocket.mass # {"kg"=>30146, "lb"=>66460}
511
- first_rocket.payload_weights # [{"id"=>"leo", "name"=>"Low Earth Orbit", "kg"=>450, "lb"=>992}]
512
- first_rocket.first_stage # {"reusable"=>false, "engines"=>1, "fuel_amount_tons"=>44.3, "burn_time_sec"=>169, "thrust_sea_level"=>{"kN"=>420, "lbf"=>94000}, "thrust_vacuum"=>{"kN"=>480, "lbf"=>110000}}
513
- first_rocket.second_stage # {"engines"=>1, "fuel_amount_tons"=>3.38, "burn_time_sec"=>378, "thrust"=>{"kN"=>31, "lbf"=>7000}, "payloads"=>{"option_1"=>"composite fairing", "composite_fairing"=>{"height"=>{"meters"=>3.5, "feet"=>11.5}, "diameter"=>{"meters"=>1.5, "feet"=>4.9}}}}
514
- first_rocket.engines # {"number"=>1, "type"=>"merlin", "version"=>"1C", "layout"=>"single", "engine_loss_max"=>0, "propellant_1"=>"liquid oxygen", "propellant_2"=>"RP-1 kerosene", "thrust_sea_level"=>{"kN"=>420, "lbf"=>94000}, "thrust_vacuum"=>{"kN"=>480, "lbf"=>110000}, "thrust_to_weight"=>96}
515
- first_rocket.landing_legs # {"number"=>0, "material"=>nil}
516
- first_rocket.wikipedia # "https://en.wikipedia.org/wiki/Falcon_1"
517
- first_rocket.description # "The Falcon 1 was an expendable launch system privately developed and manufactured by SpaceX during 2006-2009. On 28 September 2008, Falcon 1 became the first privately-developed liquid-fuel launch vehicle to go into orbit around the Earth."
518
- first_rocket.rocket_id # "falcon1"
519
- first_rocket.rocket_name # "Falcon 1"
520
- first_rocket.rocket_type # "rocket"
521
- first_rocket.flickr_images # ["https://www.spacex.com/sites/spacex/files/styles/media_gallery_large/public/2009_-_01_liftoff_south_full_wide_ro8a1280_edit.jpg?itok=8loiSGt1", "https://www.spacex.com/sites/spacex/files/styles/media_gallery_large/public/2009_-_02_default_liftoff_west_full_wide_nn6p2062_xl.jpg?itok=p776nHsM"]
522
- ```
523
-
524
- ### Ships
525
79
 
526
- - Get information for all ships: `SPACEX::Ships.info`
527
- - Get information about a specific ship: `SPACEX::Ships.info('ship_id')`
80
+ ## Available Resources
528
81
 
529
- The following code shows how to get information about a specific ship and lists the ship data fields:
82
+ All resources live under the `SPACEX::` namespace and support `.info` and `.info('id')`.
530
83
 
531
- ```ruby
532
- ship = SPACEX::Ships.info('AMERICANCHAMPION')
533
-
534
- ship.ship_id # 'AMERICANCHAMPION'
535
- ship.ship_name # 'American Champion'
536
- ship.ship_model # nil
537
- ship.ship_type # 'Tug'
538
- ship.roles # ['Support Ship', 'Barge Tug']
539
- ship.active # false
540
- ship.imo # 7_434_016
541
- ship.mmsi # 367_020_820
542
- ship.abs # 571_252
543
- ship.ship_class # 7_604_342 # Call as array since "class" is a method in Ruby
544
- ship.weight_lbs # 588_000
545
- ship.weight_kg # 266_712
546
- ship.year_built # 1976
547
- ship.home_port # 'Port of Los Angeles'
548
- ship.status # 'Stopped'
549
- ship.speed_kn # 0
550
- ship.course_deg # nil
551
- ship.position # ({ 'latitude' => 30.52852, 'longitude' => -88.09869 })
552
- ship.successful_landings # nil
553
- ship.attempted_landings # nil
554
- ship.missions # [{ 'flight' => 7, 'name' => 'COTS 1' }, { 'flight' => 8, 'name' => 'COTS 2' }]
555
- ship.url # 'https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION'
556
- ship.image # 'https://i.imgur.com/woCxpkj.jpg'
557
- ```
84
+ | Resource | Notes |
85
+ |---|---|
86
+ | `SPACEX::Capsules` | |
87
+ | `SPACEX::Company` | Single object — `.info` only |
88
+ | `SPACEX::Cores` | |
89
+ | `SPACEX::Crew` | |
90
+ | `SPACEX::Dragons` | |
91
+ | `SPACEX::History` | |
92
+ | `SPACEX::Landpads` | |
93
+ | `SPACEX::Launches` | Also: `.latest`, `.next`, `.past`, `.upcoming` |
94
+ | `SPACEX::Launchpads` | |
95
+ | `SPACEX::Payloads` | |
96
+ | `SPACEX::Roadster` | Single object `.info` only |
97
+ | `SPACEX::Rockets` | |
98
+ | `SPACEX::Ships` | |
99
+ | `SPACEX::Starlink` | |
558
100
 
559
101
 
560
102
  ## Contributing
@@ -566,6 +108,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
566
108
 
567
109
  ## Copyright
568
110
 
569
- Copyright (c) 2018, [Rodolfo Bandeira](https://twitter.com/rodolfobandeira) and [Contributors](CHANGELOG.md).
111
+ Copyright (c) 2018, [Rodolfo Bandeira](https://x.com/rodolfobandeira) and [Contributors](CHANGELOG.md).
570
112
 
571
113
  MIT License, see [LICENSE](https://github.com/rodolfobandeira/spacex/blob/master/LICENSE) for details.