spacex 1.0.2 → 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 +54 -1
  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 +6 -9
  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 +106 -137
  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/docs/v3.md ADDED
@@ -0,0 +1,525 @@
1
+ # V3 Usage
2
+ - [API Info](#api-info)
3
+ - `SPACEX::ApiInfo.info`
4
+ - [Capsules](#capsules)
5
+ - `SPACEX::Capsules.info`
6
+ - `SPACEX::Capsules.info('capsule_serial')`
7
+ - [Company Info](#company-info)
8
+ - `SPACEX::CompanyInfo.info`
9
+ - [Cores](#cores)
10
+ - `SPACEX::Cores.info`
11
+ - `SPACEX::Cores.info('core_serial')`
12
+ - [Dragon Capsules](#dragon-capsules)
13
+ - `SPACEX::DragonCapsules.info`
14
+ - `SPACEX::DragonCapsules.info('dragon_id')`
15
+ - [History](#history)
16
+ - `SPACEX::History.info`
17
+ - `SPACEX::History.info(4)`
18
+ - [LandingPads](#landing_pads)
19
+ - `SPACEX::LandingPads.info`
20
+ - `SPACEX::LandingPads.info('LZ-4')`
21
+ - [LaunchPads](#launch_pads)
22
+ - `SPACEX::LaunchPads.info`
23
+ - `SPACEX::LaunchPads.info('vafb_slc_4e')`
24
+ - [Launches](#launches)
25
+ - `SPACEX::Launches.all`
26
+ - `SPACEX::Launches.info`
27
+ - `SPACEX::Launches.info('flight_number')`
28
+ - `SPACEX::Launches.latest`
29
+ - `SPACEX::Launches.next`
30
+ - `SPACEX::Launches.past`
31
+ - [Missions](#missions)
32
+ - `SPACEX::Missions.info`
33
+ - `SPACEX::Missions.info('mission_id')`
34
+ - [Payloads](#payloads)
35
+ - `SPACEX::Payloads.info`
36
+ - `SPACEX::Payloads.info('payload_id')`
37
+ - [Roadster](#roadster)
38
+ - `SPACEX::Roadster.info`
39
+ - [Rockets](#rockets)
40
+ - `SPACEX::Rockets.info`
41
+ - `SPACEX::Rockets.info('falcon1')`
42
+ - [Ships](#ships)
43
+ - `SPACEX::Ships.info`
44
+ - `SPACEX::Ships.info('ship_id')`
45
+
46
+ ### API Info
47
+
48
+ - Get information about the API: `SPACEX::ApiInfo.info`
49
+
50
+ Here's an example of the response:
51
+
52
+ ```ruby
53
+ api_info = SPACEX::ApiInfo.info
54
+
55
+ api_info.project_name # 'SpaceX-API'
56
+ 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'
57
+ api_info.organization = # 'r/SpaceX'
58
+ api_info.organization_link = # 'https://github.com/r-spacex'
59
+ api_info.project_link = # 'https://github.com/r-spacex/SpaceX-API'
60
+ api_info.version = # '3.1.0'
61
+ ```
62
+
63
+ ### Capsules
64
+
65
+ - Get information for all capsules: `SPACEX::Capsules.info`
66
+ - Get information about a specific capsule: `SPACEX::Capsules.info('capsule_serial')`
67
+
68
+ This example shows how to get capsule information and what the data fields are for that object:
69
+
70
+ ```ruby
71
+ capsules_info = SPACEX::Capsules.info
72
+
73
+ capsules_info.first.capsule_id # 'dragon2'
74
+ capsules_info.first.capsule_serial # 'C201'
75
+ capsules_info.first.details # 'Pressure vessel used for Dragon 2 structural testing. Rumored to be repurposed for first Red Dragon Mission'
76
+ capsules_info.first.landings # 0
77
+ capsules_info.first.missions # []
78
+ capsules_info.first.original_launch # nil capsules_info.first.original_launch_unix # nil
79
+ capsules_info.first.status # 'active'
80
+ capsules_info.first.type # 'Dragon 2.0'
81
+ ```
82
+
83
+ ### Company Info
84
+
85
+ - Get information about the company: `SPACEX::CompanyInfo.info`
86
+
87
+ Here is an example of the company information:
88
+
89
+ ```ruby
90
+ company_info = SPACEX::CompanyInfo.info
91
+
92
+ company_info.name # 'SpaceX'
93
+ company_info.founder # 'Elon Musk'
94
+ company_info.founded # 2002
95
+ company_info.employees # 7000
96
+ company_info.vehicles # 3
97
+ company_info.launche_sites # nil
98
+ company_info.test_sites # 1
99
+ company_info.ceo # 'Elon Musk'
100
+ company_info.cto # 'Elon Musk'
101
+ company_info.coo # 'Gwynne Shotwell'
102
+ company_info.cto_propulsion # 'Tom Mueller'
103
+ company_info.valuation # 15_000_000_000
104
+ company_info.headquarters.address # 'Rocket Road'
105
+ company_info.headquarters.city # 'Hawthorne'
106
+ company_info.headquarters.state # 'California'
107
+ 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.'
108
+ ```
109
+
110
+ ### Cores
111
+
112
+ - Get information for all cores: `SPACEX::Cores.info`
113
+ - Get information about a specific core: `SPACEX::Cores.info('core_serial')`
114
+
115
+ The following code snippet shows how to get the cores information and what the data fields are for a single core:
116
+
117
+ ```ruby
118
+ cores_info = SPACEX::Cores.info
119
+
120
+ cores_info.first.asds_attempts # 0
121
+ cores_info.first.asds_landings # 0
122
+ cores_info.first.block # 5
123
+ cores_info.first.core_serial # 'B1052'
124
+ cores_info.first.details # 'On test stand at McGregor'
125
+ cores_info.first.missions # []
126
+ cores_info.first.original_launch # nil
127
+ cores_info.first.original_launch_unix # nil
128
+ cores_info.first.rtls_attempts # 0
129
+ cores_info.first.rtls_landings # 0
130
+ cores_info.first.status # 'active'
131
+ cores_info.first.water_landing # false
132
+ ```
133
+
134
+ ### Dragon Capsules
135
+
136
+ - Get information for all dragon capsules: `SPACEX::DragonCapsules.info`
137
+ - Get information about a specific dragon capsule: `SPACEX::DragonCapsules.info('dragon_id')`
138
+
139
+ This code snippet shows the `dragon1` dragon capsule information:
140
+
141
+ ```ruby
142
+ dragon_capsules = SPACEX::DragonCapsules.info
143
+
144
+ dragon_capsules.first.capsule_id # "dragon1"
145
+ dragon_capsules.first.name # "Dragon 1"
146
+ dragon_capsules.first.type # "capsule"
147
+ dragon_capsules.first.active # true
148
+ dragon_capsules.first.crew_capacity # 0
149
+ dragon_capsules.first.sidewall_angle_deg # 15
150
+ dragon_capsules.first.orbit_duration_yr # 2
151
+ dragon_capsules.first.dry_mass_kg # 4200
152
+ dragon_capsules.first.dry_mass_lb # 9300
153
+ dragon_capsules.first.first_flight # "2010-12-08"
154
+ dragon_capsules.first.heat_shield['material'] # "PICA-X"
155
+ dragon_capsules.first.heat_shield['size_meters'] # 3.6
156
+ dragon_capsules.first.heat_shield['temp_degrees'] # 3000
157
+ dragon_capsules.first.heat_shield['dev_partner'] # "NASA"
158
+ dragon_capsules.first.thrusters[0]['type'] # "Draco"
159
+ dragon_capsules.first.thrusters[0]['amount'] # 18
160
+ dragon_capsules.first.thrusters[0]['pods'] # 4
161
+ dragon_capsules.first.thrusters[0]['fuel_1'] # "nitrogen tetroxide"
162
+ dragon_capsules.first.thrusters[0]['fuel_2'] # "monomethylhydrazine"
163
+ dragon_capsules.first.thrusters[0]['thrust']['kN'] # 0.4
164
+ dragon_capsules.first.thrusters[0]['thrust']['lbf'] # 90
165
+ dragon_capsules.first.launch_payload_mass['kg'] # 6000
166
+ dragon_capsules.first.launch_payload_mass['lb'] # 13228
167
+ dragon_capsules.first.launch_payload_vol['cubic_meters'] # 25
168
+ dragon_capsules.first.launch_payload_vol['cubic_feet'] # 883
169
+ dragon_capsules.first.return_payload_mass['kg'] # 3000
170
+ dragon_capsules.first.return_payload_mass['lb'] # 6614
171
+ dragon_capsules.first.return_payload_vol['cubic_meters'] # 11
172
+ dragon_capsules.first.return_payload_vol['cubic_feet'] # 388
173
+ dragon_capsules.first.pressurized_capsule['payload_volume']['cubic_meters']) # 11
174
+ dragon_capsules.first.pressurized_capsule['payload_volume']['cubic_feet'] # 388
175
+ dragon_capsules.first.trunk['trunk_volume['cubic_meters'] # 14
176
+ dragon_capsules.first.trunk['trunk_volume['cubic_feet'] # 494
177
+ dragon_capsules.first.trunk['cargo']['solar_array'] # 2
178
+ dragon_capsules.first.trunk['cargo']['unpressurized_cargo'] # true
179
+ dragon_capsules.first.height_w_trunk['meters'] # 7.2
180
+ dragon_capsules.first.height_w_trunk['feet'] # 23.6
181
+ dragon_capsules.first.diameter['meters'] # 3.7
182
+ dragon_capsules.first.diameter['feet'] # 12
183
+ dragon_capsules.first.wikipedia # "https://en.wikipedia.org/wiki/SpaceX_Dragon"
184
+ 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)."
185
+ ```
186
+
187
+ ### History
188
+
189
+ - Get information for all historical events: `SPACEX::History.info`
190
+ - Get information about a specific historical event: `SPACEX::History.info('4')`
191
+
192
+ ```ruby
193
+ require 'spacex'
194
+ historical_events = SPACEX::History.info
195
+
196
+ first_event = historical_events.first
197
+ first_event.id # 1
198
+ first_event.title # Falcon 1 Makes History
199
+ first_event.event_date_utc # 2008-09-28T23:15:00Z
200
+ first_event.event_date_unix # 1222643700
201
+ first_event.flight_number # 4
202
+ first_event.details # Falcon 1 becomes the first privately developed liquid fuel rocket to reach Earth orbit.
203
+ first_event.links['reddit'] # nil
204
+ first_event.links['article'] # http://www.spacex.com/news/2013/02/11/flight-4-launch-update-0
205
+ first_event.links['wikipedia'] # https://en.wikipedia.org/wiki/Falcon_1
206
+ ```
207
+
208
+ ### LandingPads
209
+
210
+ - Get information for all LandingPads: `SPACEX::LandingPads.info`
211
+ - Get information about a specific LandingPad: `SPACEX::LandingPads.info('LZ-4')`
212
+
213
+ This code shows how to get the information for a specific LandingPad by id and lists the fields:
214
+
215
+ ```ruby
216
+ landing_pad = SPACEX::LandingPads.info('LZ-4')
217
+ landing_pad.id # 'LZ-4'
218
+ landing_pad.full_name # 'Landing Zone 4'
219
+ landing_pad.status # 'active'
220
+ landing_pad.location['name'] # 'Vandenberg Air Force Base'
221
+ landing_pad.location['region'] # 'California'
222
+ landing_pad.location['latitude'] # 34.632989
223
+ landing_pad.location['longitude'] # -120.615167
224
+ landing_pad.landing_type # 'RTLS'
225
+ landing_pad.attempted_landings # 2
226
+ landing_pad.successful_landings # 2
227
+ landing_pad.wikipedia # "https://en.wikipedia.org/wiki/Vandenberg_AFB_Space_Launch_Complex_4#LZ-4_landing_history"
228
+ 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."
229
+ ```
230
+
231
+ ### LaunchPads
232
+
233
+ - Get information for all LaunchPads: `SPACEX::LaunchPads.info`
234
+ - Get information about a specific LaunchPad: `SPACEX::LaunchPads.info('vafb_slc_4e')`
235
+
236
+ This code shows how to get the information for a specific LaunchPad by site_id and lists the fields:
237
+
238
+ ```ruby
239
+ launch_pad = SPACEX::LaunchPads.info('vafb_slc_4e')
240
+
241
+ launch_pad.id # 6
242
+ launch_pad.name # 'VAFB SLC 4E'
243
+ launch_pad.status # 'active'
244
+ launch_pad.location['name'] # 'Vandenberg Air Force Base',
245
+ launch_pad.location['region'] # 'California',
246
+ launch_pad.location['latitude'] # 34.632093,
247
+ launch_pad.location['longitude'] # -120.610829
248
+ launch_pad.vehicles_launched # ['Falcon 9']
249
+ launch_pad.attempted_launches # 15
250
+ launch_pad.successful_launches # 15
251
+ launch_pad.wikipedia # 'https://en.wikipedia.org/wiki/Vandenberg_AFB_Space_Launch_Complex_4'
252
+ 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.'
253
+ launch_pad.site_id # 'vafb_slc_4e'
254
+ launch_pad.site_name_long # 'Vandenberg Air Force Base Space Launch Complex 4E'
255
+ ```
256
+
257
+ ### Launches
258
+
259
+ - Get information for all launches: `SPACEX::Launches.all` or `SPACEX::Launches.info`
260
+ - Get information about a specific launch: `SPACEX::Launches.info('flight_number')`
261
+ - Get information on past launches: `SPACEX::Launches.past`
262
+ - Get information on the next launch: `SPACEX::Launches.next`
263
+ - Get the latest launch information: `SPACEX::Launches.latest`
264
+ - Get information on upcoming launches: `SPACEX::Launches.upcoming`
265
+
266
+ This code snippet shows how to get information for a specific launch by flight number and list the fields:
267
+
268
+ ```ruby
269
+ require 'spacex'
270
+ launch_68 = SPACEX::Launches.info(68)
271
+
272
+ launch_68.flight_number # 68
273
+ launch_68.mission_name # 'Telstar 18V'
274
+ launch_68.rocket.rocket_name # 'Falcon 9'
275
+ launch_68.rocket.first_stage.cores.first.land_success # true
276
+ ```
277
+
278
+ This code snippet shows how to get information on past launches:
279
+ ```ruby
280
+ past_launches = SPACEX::Launches.past
281
+
282
+ past_launches.first.flight_number # 1
283
+ past_launches.first.mission_name # 'FalconSat'
284
+ past_launches.first.rocket.rocket_name # 'Falcon 1'
285
+ past_launches.first.launch_success # false
286
+
287
+ past_launches.last.flight_number # 69
288
+ past_launches.last.mission_name # 'SAOCOM 1A'
289
+ past_launches.last.rocket.rocket_name # 'Falcon 9'
290
+ past_launches.last.rocket.first_stage.cores.first.land_success # true
291
+ past_launches.last.launch_success # true
292
+ ```
293
+
294
+
295
+
296
+ The following code snippet shows the latest launch information and the data fields available on the Launch object:
297
+
298
+ ```ruby
299
+ require 'spacex'
300
+ latest_launch = SPACEX::Launches.latest
301
+
302
+ latest_launch.flight_number # 67
303
+ latest_launch.mission_name # 'Merah Putih'
304
+ latest_launch.launch_year # '2018'
305
+ latest_launch.launch_date_unix # 1_533_619_080
306
+ latest_launch.launch_date_utc # '2018-08-07T05:18:00.000Z'
307
+ latest_launch.launch_date_local # '2018-08-07T01:18:00-04:00'
308
+ latest_launch.launch_success # true
309
+ latest_launch.rocket.rocket_id # 'falcon9'
310
+ latest_launch.rocket.rocket_name # 'Falcon 9'
311
+ latest_launch.rocket.rocket_type # 'FT'
312
+ latest_launch.rocket.first_stage.cores.first.core_serial # 'B1046'
313
+ latest_launch.rocket.first_stage.cores.first.flight # 2
314
+ latest_launch.rocket.first_stage.cores.first.block # 5
315
+ latest_launch.rocket.first_stage.cores.first.reused # true
316
+ latest_launch.rocket.first_stage.cores.first.land_success # true
317
+ latest_launch.rocket.first_stage.cores.first.landing_type # 'ASDS'
318
+ latest_launch.rocket.first_stage.cores.first.landing_vehicle # 'OCISLY'
319
+ latest_launch.rocket.second_stage.block # 5
320
+ latest_launch.rocket.second_stage.payloads.first.payload_id # 'Telkom-4'
321
+ latest_launch.rocket.second_stage.payloads.first.norad_id.first # 43_587
322
+ latest_launch.rocket.second_stage.payloads.first.reused # false
323
+ latest_launch.rocket.second_stage.payloads.first.customers.first # 'Telkom'
324
+ latest_launch.rocket.second_stage.payloads.first.nationality # 'Indonesia'
325
+ latest_launch.rocket.second_stage.payloads.first.manufacturer # 'SSL'
326
+ latest_launch.rocket.second_stage.payloads.first.payload_type # 'Satellite'
327
+ latest_launch.rocket.second_stage.payloads.first.payload_mass_kg # 5800
328
+ latest_launch.rocket.second_stage.payloads.first.payload_mass_lbs # 12_786.81
329
+ latest_launch.rocket.second_stage.payloads.first.orbit # 'GTO'
330
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.reference_system # 'geocentric'
331
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.regime # 'geostationary'
332
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.longitude # -108
333
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.semi_major_axis_km # 21_226.178
334
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.eccentricity # 0.6904141
335
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.periapsis_km # 193.19
336
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.apoapsis_km # 29_502.896
337
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.inclination_deg # 27.0648
338
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.period_min # 512.941
339
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.lifespan_years # 15
340
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.epoch # '2018-08-07T06:57:16.000Z'
341
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.mean_motion # 2.80734018
342
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.raan # 227.0228
343
+ latest_launch.telemetry.flight_club # nil
344
+ latest_launch.reuse.core # true
345
+ latest_launch.reuse.sire_core1 # nil
346
+ latest_launch.reuse.side_core2 # false
347
+ latest_launch.reuse.fairings # false
348
+ latest_launch.reuse.capsule # false
349
+ latest_launch.launch_site.site_id # 'ccafs_slc_40'
350
+ latest_launch.launch_site.site_name # 'CCAFS SLC 40'
351
+ latest_launch.launch_site.site_name_long # 'Cape Canaveral Air Force Station Space Launch Complex 40'
352
+ latest_launch.launch_success # true
353
+ latest_launch.links.mission_patch # 'https://images2.imgbox.com/a8/f5/ZgdsrbqW_o.png'
354
+ latest_launch.links.mision_patch_small # nil
355
+ latest_launch.links.reddit_campaign # 'https://www.reddit.com/r/spacex/comments/91gwfg/merah_putih_telkom4_launch_campaign_thread/'
356
+ latest_launch.links.reddit_launch # 'https://www.reddit.com/r/spacex/comments/9539nr/rspacex_merah_putih_telkom4_official_launch/'
357
+ latest_launch.links.reddit_recovery # nil
358
+ latest_launch.links.reddit_media # 'https://www.reddit.com/r/spacex/comments/94zr0b/rspacex_merah_putih_media_thread_videos_images/'
359
+ latest_launch.links.presskit # 'https://www.spacex.com/sites/spacex/files/merahputihpresskit.pdf'
360
+ latest_launch.links.article_link # 'https://spaceflightnow.com/2018/08/07/indonesian-communications-satellite-deployed-in-orbit-by-spacex/'
361
+ latest_launch.links.wikipedia # 'https://en.wikipedia.org/wiki/Telkom_Indonesia'
362
+ latest_launch.links.video_link # 'https://www.youtube.com/watch?v=FjfQNBYv2IY'
363
+ latest_launch.details # 'Indonesian comsat intended to replace the aging Telkom 1 at 108° E. First reflight of a Block 5-version booster.'
364
+ latest_launch.upcoming # false
365
+ latest_launch.static_fire_date_utc # '2018-08-02T15:53:00.000Z'
366
+ ```
367
+
368
+ This code snippet shows how to get information on upcoming launches:
369
+ ```ruby
370
+ upcoming_launches = SPACEX::Launches.upcoming
371
+
372
+ upcoming_launches.first.flight_number # 70
373
+ upcoming_launches.first.mission_name # 'Es’hail 2'
374
+ upcoming_launches.first.launch_date_utc # '2018-11-14T20:46:00.000Z'
375
+
376
+ upcoming_launches.last.flight_number # 91
377
+ upcoming_launches.last.mission_name # 'GPS IIIA-3'
378
+ upcoming_launches.last.launch_date_utc # '2019-10-01T00:00:00.000Z'
379
+ ```
380
+
381
+ ### Missions
382
+
383
+ - Get information for all mission: `SPACEX::Missions.info`
384
+ - Get information about a specific mission: `SPACEX::Missions.info('mission_id')`
385
+
386
+ This code shows how to get the first mission information and lists the fields:
387
+
388
+ ```ruby
389
+ missions = SPACEX::Missions.info
390
+
391
+ missions.first.mission_id # "F3364BF"
392
+ missions.first.mission_name # "Iridium NEXT"
393
+ missions.first.manufacturers # ["Orbital ATK"]
394
+ 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"]
395
+ missions.first.wikipedia # "https://en.wikipedia.org/wiki/Iridium_satellite_constellation"
396
+ missions.first.website # "https://www.iridiumnext.com/"
397
+ missions.first.twitter # "https://twitter.com/IridiumBoss?lang=en"
398
+ 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."
399
+ ```
400
+
401
+ ### Payloads
402
+
403
+ - Get information for all payloads: `SPACEX::Payloads.info`
404
+ - Get information about a specific payload: `SPACEX::Payloads.info('payload_id')`
405
+
406
+ The following code shows how to get information about a specific payload and lists the payload data fields:
407
+
408
+ ```ruby
409
+ payload = SPACEX::Payloads.info('FalconSAT-2')
410
+
411
+ payload.payload_id # 'FalconSAT-2'
412
+ payload.reused # false
413
+ payload.customers # ['DARPA']
414
+ payload.nationality # 'United States'
415
+ payload.manufacturer # 'SSTL'
416
+ payload.payload_type # 'Satellite'
417
+ payload.payload_mass_kg # 20
418
+ payload.payload_mass_lbs # 43
419
+ payload.orbit # 'LEO'
420
+ 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}
421
+ ```
422
+
423
+ ### Roadster
424
+
425
+ - Get roadster orbital data: `SPACEX::Roadster.info`
426
+
427
+ The following code shows how to get information about the Roadster:
428
+
429
+ ```ruby
430
+ roadster = SPACEX::Roadster.info
431
+
432
+ roadster.name # "Elon Musk's Tesla Roadster"
433
+ roadster.launch_date_utc # '2018-02-06T20:45:00.000Z'
434
+ roadster.launch_date_unix # 1_517_949_900
435
+ roadster.launch_date_kg # nil
436
+ roadster.launch_date_lbs # nil
437
+ roadster.norad_id # 43_205
438
+ roadster.epoch_jd # 2_458_353.027800926
439
+ roadster.orbit_type # 'heliocentric'
440
+ roadster.apoapsis_au # 1.663757412460597
441
+ roadster.periapsis_au # 0.9860953641129515
442
+ roadster.semo_major_axis_au # nil
443
+ roadster.eccentricity # 0.2557357353354217
444
+ roadster.inclination # 1.077474057737451
445
+ roadster.longitude # 317.0962040947829
446
+ roadster.periapsis_arg # 177.491390597234
447
+ roadster.speed_kph # 76_703.72399999999
448
+ roadster.speed_mph # 47_661.469685603995
449
+ roadster.earth_distance_km # 172_954_806.23899576
450
+ roadster.earth_distance_mi # 107_469_100.90753104
451
+ roadster.mars_distance_km # 147_648_108.6344399
452
+ roadster.mars_distance_mi # 91_744_252.91029055
453
+ roadster.wikipedia # 'https://en.wikipedia.org/wiki/Elon_Musk%27s_Tesla_Roadster'
454
+ 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."
455
+ ```
456
+ ### Rockets
457
+
458
+ - Get information for all rockets: `SPACEX::Rockets.info`
459
+ - Get information about a specific rocket: `SPACEX::Rockets.info('rocket_id')`
460
+
461
+ This example shows a single rocket and its data fields:
462
+
463
+ ```
464
+ rockets = SPACEX::Rockets.info
465
+ first_rocket = rockets.first
466
+
467
+ first_rocket.id # 1
468
+ first_rocket.active # false
469
+ first_rocket.stages # 2
470
+ first_rocket.boosters # 0
471
+ first_rocket.cost_per_launch # 6700000
472
+ first_rocket.success_rate_pct # 40
473
+ first_rocket.first_flight # "2006-03-24"
474
+ first_rocket.country # "Republic of the Marshall Islands"
475
+ first_rocket.company # "SpaceX"
476
+ first_rocket.height # {"meters"=>22.25, "feet"=>73}
477
+ first_rocket.diameter # {"meters"=>1.68, "feet"=>5.5}
478
+ first_rocket.mass # {"kg"=>30146, "lb"=>66460}
479
+ first_rocket.payload_weights # [{"id"=>"leo", "name"=>"Low Earth Orbit", "kg"=>450, "lb"=>992}]
480
+ 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}}
481
+ 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}}}}
482
+ 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}
483
+ first_rocket.landing_legs # {"number"=>0, "material"=>nil}
484
+ first_rocket.wikipedia # "https://en.wikipedia.org/wiki/Falcon_1"
485
+ 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."
486
+ first_rocket.rocket_id # "falcon1"
487
+ first_rocket.rocket_name # "Falcon 1"
488
+ first_rocket.rocket_type # "rocket"
489
+ 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"]
490
+ ```
491
+
492
+ ### Ships
493
+
494
+ - Get information for all ships: `SPACEX::Ships.info`
495
+ - Get information about a specific ship: `SPACEX::Ships.info('ship_id')`
496
+
497
+ The following code shows how to get information about a specific ship and lists the ship data fields:
498
+
499
+ ```ruby
500
+ ship = SPACEX::Ships.info('AMERICANCHAMPION')
501
+
502
+ ship.ship_id # 'AMERICANCHAMPION'
503
+ ship.ship_name # 'American Champion'
504
+ ship.ship_model # nil
505
+ ship.ship_type # 'Tug'
506
+ ship.roles # ['Support Ship', 'Barge Tug']
507
+ ship.active # false
508
+ ship.imo # 7_434_016
509
+ ship.mmsi # 367_020_820
510
+ ship.abs # 571_252
511
+ ship.ship_class # 7_604_342 # Call as array since "class" is a method in Ruby
512
+ ship.weight_lbs # 588_000
513
+ ship.weight_kg # 266_712
514
+ ship.year_built # 1976
515
+ ship.home_port # 'Port of Los Angeles'
516
+ ship.status # 'Stopped'
517
+ ship.speed_kn # 0
518
+ ship.course_deg # nil
519
+ ship.position # ({ 'latitude' => 30.52852, 'longitude' => -88.09869 })
520
+ ship.successful_landings # nil
521
+ ship.attempted_landings # nil
522
+ ship.missions # [{ 'flight' => 7, 'name' => 'COTS 1' }, { 'flight' => 8, 'name' => 'COTS 2' }]
523
+ ship.url # 'https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION'
524
+ ship.image # 'https://i.imgur.com/woCxpkj.jpg'
525
+ ```