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.
- 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 +54 -1
- 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 +6 -9
- 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 +106 -137
- 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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe SPACEX::Launchpads do
|
|
4
|
+
context '#info', vcr: { cassette_name: 'v4/launchpads/all' } do
|
|
5
|
+
subject { SPACEX::Launchpads.info }
|
|
6
|
+
it 'returns an array of SPACEX::Launchpads' do
|
|
7
|
+
expect(subject).to be_an Array
|
|
8
|
+
expect(subject.first).to be_a SPACEX::Launchpads
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context "#info('5e9e4501f5090910d4566f83')",
|
|
13
|
+
vcr: { cassette_name: 'v4/launchpads/one' } do
|
|
14
|
+
subject { SPACEX::Launchpads.info('5e9e4501f5090910d4566f83') }
|
|
15
|
+
|
|
16
|
+
it 'returns a specific launchpad with all properties' do
|
|
17
|
+
expect(subject).to be_a SPACEX::Launchpads
|
|
18
|
+
expect(subject.id).to eq '5e9e4501f5090910d4566f83'
|
|
19
|
+
expect(subject.name).to eq 'VAFB SLC 3W'
|
|
20
|
+
expect(subject.full_name).to eq 'Vandenberg Space Force Base Space Launch Complex 3W'
|
|
21
|
+
expect(subject.locality).to eq 'Vandenberg Space Force Base'
|
|
22
|
+
expect(subject.region).to eq 'California'
|
|
23
|
+
expect(subject.latitude).to eq 34.6440904
|
|
24
|
+
expect(subject.longitude).to eq(-120.5931438)
|
|
25
|
+
expect(subject.launch_attempts).to eq 0
|
|
26
|
+
expect(subject.launch_successes).to eq 0
|
|
27
|
+
expect(subject.rockets).to be_an Array
|
|
28
|
+
expect(subject.timezone).to eq 'America/Los_Angeles'
|
|
29
|
+
expect(subject.launches).to be_an Array
|
|
30
|
+
expect(subject.status).to eq 'retired'
|
|
31
|
+
expect(subject.details).not_to be_nil
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -1,62 +1,38 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe SPACEX::Payloads do
|
|
4
|
-
context '#info', vcr: { cassette_name: 'payloads/
|
|
5
|
-
subject
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
expect(subject.first.payload_id).to eq 'FalconSAT-2'
|
|
10
|
-
expect(subject.first.reused).to eq false
|
|
11
|
-
expect(subject.first.customers).to eq ['DARPA']
|
|
12
|
-
expect(subject.first.nationality).to eq 'United States'
|
|
13
|
-
expect(subject.first.manufacturer).to eq 'SSTL'
|
|
14
|
-
expect(subject.first.payload_type).to eq 'Satellite'
|
|
15
|
-
expect(subject.first.payload_mass_kg).to eq 20
|
|
16
|
-
expect(subject.first.payload_mass_lbs).to eq 43
|
|
17
|
-
expect(subject.first.orbit).to eq 'LEO'
|
|
18
|
-
expect(subject.first.orbit_params.reference_system).to eq 'geocentric'
|
|
19
|
-
expect(subject.first.orbit_params.regime).to eq 'low-earth'
|
|
20
|
-
expect(subject.first.orbit_params.longitude).to eq nil
|
|
21
|
-
expect(subject.first.orbit_params.semi_major_axis_km).to eq nil
|
|
22
|
-
expect(subject.first.orbit_params.eccentricity).to eq nil
|
|
23
|
-
expect(subject.first.orbit_params.periapsis_km).to eq 400
|
|
24
|
-
expect(subject.first.orbit_params.apoapsis_km).to eq 500
|
|
25
|
-
expect(subject.first.orbit_params.inclination_deg).to eq 39
|
|
26
|
-
expect(subject.first.orbit_params.period_min).to eq nil
|
|
27
|
-
expect(subject.first.orbit_params.lifespan_years).to eq nil
|
|
4
|
+
context '#info', vcr: { cassette_name: 'v4/payloads/all' } do
|
|
5
|
+
subject { SPACEX::Payloads.info }
|
|
6
|
+
it 'returns an array of SPACEX::Payloads' do
|
|
7
|
+
expect(subject).to be_an Array
|
|
8
|
+
expect(subject.first).to be_a SPACEX::Payloads
|
|
28
9
|
end
|
|
29
10
|
end
|
|
30
11
|
|
|
31
|
-
context "#info('
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
it '
|
|
36
|
-
expect(subject
|
|
12
|
+
context "#info('5eb0e4b5b6c3bb0006eeb1e1')",
|
|
13
|
+
vcr: { cassette_name: 'v4/payloads/one' } do
|
|
14
|
+
subject { SPACEX::Payloads.info('5eb0e4b5b6c3bb0006eeb1e1') }
|
|
15
|
+
|
|
16
|
+
it 'returns a specific payload with all properties' do
|
|
17
|
+
expect(subject).to be_a SPACEX::Payloads
|
|
18
|
+
expect(subject.id).to eq '5eb0e4b5b6c3bb0006eeb1e1'
|
|
19
|
+
expect(subject.name).to eq 'FalconSAT-2'
|
|
20
|
+
expect(subject.type).to eq 'Satellite'
|
|
37
21
|
expect(subject.reused).to eq false
|
|
38
|
-
expect(subject.
|
|
39
|
-
expect(subject.
|
|
40
|
-
expect(subject.
|
|
41
|
-
expect(subject.
|
|
42
|
-
expect(subject.
|
|
43
|
-
expect(subject.
|
|
22
|
+
expect(subject.launch).to eq '5eb87cd9ffd86e000604b32a'
|
|
23
|
+
expect(subject.customers).to eq ['DARPA']
|
|
24
|
+
expect(subject.norad_ids).to eq []
|
|
25
|
+
expect(subject.nationalities).to eq ['United States']
|
|
26
|
+
expect(subject.manufacturers).to eq ['SSTL']
|
|
27
|
+
expect(subject.mass_kg).to eq 20
|
|
28
|
+
expect(subject.mass_lbs).to eq 43
|
|
44
29
|
expect(subject.orbit).to eq 'LEO'
|
|
45
|
-
expect(subject.
|
|
46
|
-
expect(subject.
|
|
47
|
-
expect(subject.
|
|
48
|
-
expect(subject.
|
|
49
|
-
expect(subject.
|
|
50
|
-
expect(subject.
|
|
51
|
-
expect(subject.orbit_params.longitude).to eq nil
|
|
52
|
-
expect(subject.orbit_params.mean_anomaly).to eq 98.2248
|
|
53
|
-
expect(subject.orbit_params.mean_motion).to eq 14.79249332
|
|
54
|
-
expect(subject.orbit_params.periapsis_km).to eq 625.256
|
|
55
|
-
expect(subject.orbit_params.period_min).to eq 97.346
|
|
56
|
-
expect(subject.orbit_params.raan).to eq 63.3956
|
|
57
|
-
expect(subject.orbit_params.reference_system).to eq 'geocentric'
|
|
58
|
-
expect(subject.orbit_params.regime).to eq 'low-earth'
|
|
59
|
-
expect(subject.orbit_params.semi_major_axis_km).to eq 7009.836
|
|
30
|
+
expect(subject.reference_system).to eq 'geocentric'
|
|
31
|
+
expect(subject.regime).to eq 'low-earth'
|
|
32
|
+
expect(subject.periapsis_km).to eq 400
|
|
33
|
+
expect(subject.apoapsis_km).to eq 500
|
|
34
|
+
expect(subject.inclination_deg).to eq 39
|
|
35
|
+
expect(subject.dragon).to be_a Hash
|
|
60
36
|
end
|
|
61
37
|
end
|
|
62
38
|
end
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
1
|
require 'spec_helper'
|
|
4
2
|
|
|
5
3
|
describe SPACEX::Roadster do
|
|
6
|
-
context '#info', vcr: { cassette_name: 'roadster
|
|
7
|
-
subject
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
it 'returns Roadster launch info' do
|
|
4
|
+
context '#info', vcr: { cassette_name: 'v4/roadster' } do
|
|
5
|
+
subject { SPACEX::Roadster.info }
|
|
6
|
+
|
|
7
|
+
it 'returns roadster info' do
|
|
11
8
|
expect(subject.name).to eq "Elon Musk's Tesla Roadster"
|
|
12
|
-
expect(subject.
|
|
13
|
-
expect(subject.launch_date_unix).to eq 1_517_949_900
|
|
14
|
-
expect(subject.launch_date_kg).to eq nil
|
|
15
|
-
expect(subject.launch_date_lbs).to eq nil
|
|
16
|
-
expect(subject.norad_id).to eq 43_205
|
|
17
|
-
expect(subject.epoch_jd).to eq 2_458_353.027800926
|
|
18
|
-
expect(subject.orbit_type).to eq 'heliocentric'
|
|
19
|
-
expect(subject.apoapsis_au).to eq 1.663757412460597
|
|
20
|
-
expect(subject.periapsis_au).to eq 0.9860953641129515
|
|
21
|
-
expect(subject.semo_major_axis_au).to eq nil
|
|
22
|
-
expect(subject.eccentricity).to eq 0.2557357353354217
|
|
23
|
-
expect(subject.inclination).to eq 1.077474057737451
|
|
24
|
-
expect(subject.longitude).to eq 317.0962040947829
|
|
25
|
-
expect(subject.periapsis_arg).to eq 177.491390597234
|
|
26
|
-
expect(subject.speed_kph).to eq 76_703.72399999999
|
|
27
|
-
expect(subject.speed_mph).to eq 47_661.469685603995
|
|
28
|
-
expect(subject.earth_distance_km).to eq 172_954_806.23899576
|
|
29
|
-
expect(subject.earth_distance_mi).to eq 107_469_100.90753104
|
|
30
|
-
expect(subject.mars_distance_km).to eq 147_648_108.6344399
|
|
31
|
-
expect(subject.mars_distance_mi).to eq 91_744_252.91029055
|
|
32
|
-
expect(subject.wikipedia).to eq 'https://en.wikipedia.org/wiki/Elon_Musk%27s_Tesla_Roadster'
|
|
33
|
-
expect(subject.details).to start_with "Elon Musk's Tesla Roadster is an electric sports"
|
|
9
|
+
expect(subject.id).to eq '5eb75f0842fea42237d7f3f4'
|
|
34
10
|
end
|
|
35
11
|
end
|
|
36
12
|
end
|
data/spec/spacex/rockets_spec.rb
CHANGED
|
@@ -1,210 +1,42 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe SPACEX::Rockets do
|
|
4
|
-
context '#info', vcr: { cassette_name: 'rockets/
|
|
5
|
-
subject
|
|
6
|
-
SPACEX::Rockets.info
|
|
7
|
-
end
|
|
4
|
+
context '#info', vcr: { cassette_name: 'v4/rockets/all' } do
|
|
5
|
+
subject { SPACEX::Rockets.info }
|
|
8
6
|
|
|
9
|
-
it
|
|
10
|
-
|
|
11
|
-
expect(
|
|
12
|
-
expect(first_subject.active).to eq false
|
|
13
|
-
expect(first_subject.stages).to eq 2
|
|
14
|
-
expect(first_subject.boosters).to eq 0
|
|
15
|
-
expect(first_subject.cost_per_launch).to eq 6_700_000
|
|
16
|
-
expect(first_subject.success_rate_pct).to eq 40
|
|
17
|
-
expect(first_subject.first_flight).to eq '2006-03-24'
|
|
18
|
-
expect(first_subject.country).to eq 'Republic of the Marshall Islands'
|
|
19
|
-
expect(first_subject.company).to eq 'SpaceX'
|
|
20
|
-
expect(first_subject.height).to eq(
|
|
21
|
-
'meters' => 22.25,
|
|
22
|
-
'feet' => 73
|
|
23
|
-
)
|
|
24
|
-
expect(first_subject.diameter).to eq(
|
|
25
|
-
'meters' => 1.68,
|
|
26
|
-
'feet' => 5.5
|
|
27
|
-
)
|
|
28
|
-
expect(first_subject.mass).to eq(
|
|
29
|
-
'kg' => 30_146,
|
|
30
|
-
'lb' => 66_460
|
|
31
|
-
)
|
|
32
|
-
expect(first_subject.payload_weights).to eq [{
|
|
33
|
-
'id' => 'leo',
|
|
34
|
-
'name' => 'Low Earth Orbit',
|
|
35
|
-
'kg' => 450,
|
|
36
|
-
'lb' => 992
|
|
37
|
-
}]
|
|
38
|
-
expect(first_subject.first_stage).to eq(
|
|
39
|
-
'reusable' => false,
|
|
40
|
-
'engines' => 1,
|
|
41
|
-
'fuel_amount_tons' => 44.3,
|
|
42
|
-
'burn_time_sec' => 169,
|
|
43
|
-
'thrust_sea_level' => {
|
|
44
|
-
'kN' => 420,
|
|
45
|
-
'lbf' => 94_000
|
|
46
|
-
},
|
|
47
|
-
'thrust_vacuum' => {
|
|
48
|
-
'kN' => 480,
|
|
49
|
-
'lbf' => 110_000
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
expect(first_subject.second_stage).to eq(
|
|
53
|
-
'engines' => 1,
|
|
54
|
-
'fuel_amount_tons' => 3.38,
|
|
55
|
-
'burn_time_sec' => 378,
|
|
56
|
-
'thrust' => {
|
|
57
|
-
'kN' => 31,
|
|
58
|
-
'lbf' => 7000
|
|
59
|
-
},
|
|
60
|
-
'payloads' => {
|
|
61
|
-
'option_1' => 'composite fairing',
|
|
62
|
-
'composite_fairing' => {
|
|
63
|
-
'height' => {
|
|
64
|
-
'meters' => 3.5,
|
|
65
|
-
'feet' => 11.5
|
|
66
|
-
},
|
|
67
|
-
'diameter' => {
|
|
68
|
-
'meters' => 1.5,
|
|
69
|
-
'feet' => 4.9
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
expect(first_subject.engines).to eq(
|
|
75
|
-
'number' => 1,
|
|
76
|
-
'type' => 'merlin',
|
|
77
|
-
'version' => '1C',
|
|
78
|
-
'layout' => 'single',
|
|
79
|
-
'engine_loss_max' => 0,
|
|
80
|
-
'propellant_1' => 'liquid oxygen',
|
|
81
|
-
'propellant_2' => 'RP-1 kerosene',
|
|
82
|
-
'thrust_sea_level' => {
|
|
83
|
-
'kN' => 420,
|
|
84
|
-
'lbf' => 94_000
|
|
85
|
-
},
|
|
86
|
-
'thrust_vacuum' => {
|
|
87
|
-
'kN' => 480,
|
|
88
|
-
'lbf' => 110_000
|
|
89
|
-
},
|
|
90
|
-
'thrust_to_weight' => 96
|
|
91
|
-
)
|
|
92
|
-
expect(first_subject.landing_legs).to eq(
|
|
93
|
-
'number' => 0,
|
|
94
|
-
'material' => nil
|
|
95
|
-
)
|
|
96
|
-
expect(first_subject.wikipedia).to eq(
|
|
97
|
-
'https://en.wikipedia.org/wiki/Falcon_1'
|
|
98
|
-
)
|
|
99
|
-
expect(first_subject.description).to eq(
|
|
100
|
-
'The Falcon 1 was an expendable launch system '\
|
|
101
|
-
'privately developed and manufactured by SpaceX during 2006-2009. '\
|
|
102
|
-
'On 28 September 2008, Falcon 1 became the first '\
|
|
103
|
-
'privately-developed liquid-fuel launch vehicle to '\
|
|
104
|
-
'go into orbit around the Earth.'
|
|
105
|
-
)
|
|
106
|
-
expect(first_subject.rocket_id).to eq 'falcon1'
|
|
107
|
-
expect(first_subject.rocket_name).to eq 'Falcon 1'
|
|
108
|
-
expect(first_subject.rocket_type).to eq 'rocket'
|
|
109
|
-
expect(first_subject.flickr_images).to eq(
|
|
110
|
-
[
|
|
111
|
-
'https://www.spacex.com/sites/spacex/files/styles/media_gallery_large/public/2009_-_01_liftoff_south_full_wide_ro8a1280_edit.jpg?itok=8loiSGt1',
|
|
112
|
-
'https://www.spacex.com/sites/spacex/files/styles/media_gallery_large/public/2009_-_02_default_liftoff_west_full_wide_nn6p2062_xl.jpg?itok=p776nHsM'
|
|
113
|
-
]
|
|
114
|
-
)
|
|
7
|
+
it 'returns an array of SPACEX::Rockets' do
|
|
8
|
+
expect(subject).to be_an Array
|
|
9
|
+
expect(subject.first).to be_a SPACEX::Rockets
|
|
115
10
|
end
|
|
116
11
|
end
|
|
117
12
|
|
|
118
|
-
context "#info('
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
end
|
|
13
|
+
context "#info('5e9d0d95eda69955f709d1eb')",
|
|
14
|
+
vcr: { cassette_name: 'v4/rockets/one' } do
|
|
15
|
+
subject { SPACEX::Rockets.info('5e9d0d95eda69955f709d1eb') }
|
|
122
16
|
|
|
123
|
-
it 'returns
|
|
124
|
-
expect(subject.id).to eq 1
|
|
17
|
+
it 'returns specific rocket details' do
|
|
125
18
|
expect(subject.active).to eq false
|
|
126
|
-
expect(subject.stages).to eq 2
|
|
127
19
|
expect(subject.boosters).to eq 0
|
|
20
|
+
expect(subject.company).to eq 'SpaceX'
|
|
128
21
|
expect(subject.cost_per_launch).to eq 6_700_000
|
|
129
|
-
expect(subject.success_rate_pct).to eq 40
|
|
130
|
-
expect(subject.first_flight).to eq '2006-03-24'
|
|
131
22
|
expect(subject.country).to eq 'Republic of the Marshall Islands'
|
|
132
|
-
expect(subject.
|
|
133
|
-
expect(subject.
|
|
134
|
-
expect(subject.
|
|
135
|
-
expect(subject.
|
|
136
|
-
expect(subject.
|
|
137
|
-
'id' => 'leo',
|
|
138
|
-
'name' => 'Low Earth Orbit',
|
|
139
|
-
'kg' => 450,
|
|
140
|
-
'lb' => 992
|
|
141
|
-
}]
|
|
142
|
-
expect(subject.first_stage).to eq(
|
|
143
|
-
'reusable' => false,
|
|
144
|
-
'engines' => 1,
|
|
145
|
-
'fuel_amount_tons' => 44.3,
|
|
146
|
-
'burn_time_sec' => 169,
|
|
147
|
-
'thrust_sea_level' => {
|
|
148
|
-
'kN' => 420,
|
|
149
|
-
'lbf' => 94_000
|
|
150
|
-
},
|
|
151
|
-
'thrust_vacuum' => {
|
|
152
|
-
'kN' => 480,
|
|
153
|
-
'lbf' => 110_000
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
expect(subject.second_stage).to eq(
|
|
157
|
-
'engines' => 1,
|
|
158
|
-
'fuel_amount_tons' => 3.38,
|
|
159
|
-
'burn_time_sec' => 378,
|
|
160
|
-
'thrust' => {
|
|
161
|
-
'kN' => 31,
|
|
162
|
-
'lbf' => 7000
|
|
163
|
-
},
|
|
164
|
-
'payloads' => {
|
|
165
|
-
'option_1' => 'composite fairing',
|
|
166
|
-
'composite_fairing' => {
|
|
167
|
-
'height' => {
|
|
168
|
-
'meters' => 3.5,
|
|
169
|
-
'feet' => 11.5
|
|
170
|
-
},
|
|
171
|
-
'diameter' => {
|
|
172
|
-
'meters' => 1.5,
|
|
173
|
-
'feet' => 4.9
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
)
|
|
178
|
-
expect(subject.engines).to eq(
|
|
179
|
-
'number' => 1,
|
|
180
|
-
'type' => 'merlin',
|
|
181
|
-
'version' => '1C',
|
|
182
|
-
'layout' => 'single',
|
|
183
|
-
'engine_loss_max' => 0,
|
|
184
|
-
'propellant_1' => 'liquid oxygen',
|
|
185
|
-
'propellant_2' => 'RP-1 kerosene',
|
|
186
|
-
'thrust_sea_level' => {
|
|
187
|
-
'kN' => 420,
|
|
188
|
-
'lbf' => 94_000
|
|
189
|
-
},
|
|
190
|
-
'thrust_vacuum' => {
|
|
191
|
-
'kN' => 480,
|
|
192
|
-
'lbf' => 110_000
|
|
193
|
-
},
|
|
194
|
-
'thrust_to_weight' => 96
|
|
195
|
-
)
|
|
196
|
-
expect(subject.landing_legs).to eq('number' => 0, 'material' => nil)
|
|
23
|
+
expect(subject.id).to eq '5e9d0d95eda69955f709d1eb'
|
|
24
|
+
expect(subject.name).to eq 'Falcon 1'
|
|
25
|
+
expect(subject.stages).to eq 2
|
|
26
|
+
expect(subject.success_rate_pct).to eq 40
|
|
27
|
+
expect(subject.type).to eq 'rocket'
|
|
197
28
|
expect(subject.wikipedia).to eq 'https://en.wikipedia.org/wiki/Falcon_1'
|
|
198
|
-
expect(subject.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
)
|
|
205
|
-
expect(subject.
|
|
206
|
-
expect(subject.
|
|
207
|
-
expect(subject.
|
|
29
|
+
expect(subject.first_flight).to eq '2006-03-24'
|
|
30
|
+
expect(subject.flickr_images).to be_an Array
|
|
31
|
+
expect(subject.engines).to be_a Hash
|
|
32
|
+
expect(subject.height).to be_a Hash
|
|
33
|
+
expect(subject.mass).to be_a Hash
|
|
34
|
+
expect(subject.diameter).to be_a Hash
|
|
35
|
+
expect(subject.first_stage).to be_a Hash
|
|
36
|
+
expect(subject.second_stage).to be_a Hash
|
|
37
|
+
expect(subject.landing_legs).to be_a Hash
|
|
38
|
+
expect(subject.payload_weights).to be_an Array
|
|
39
|
+
expect(subject.description).not_to be_nil
|
|
208
40
|
end
|
|
209
41
|
end
|
|
210
42
|
end
|
data/spec/spacex/ships_spec.rb
CHANGED
|
@@ -1,65 +1,34 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe SPACEX::Ships do
|
|
4
|
-
context '#info', vcr: { cassette_name: 'ships/
|
|
5
|
-
subject
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
expect(subject.first.ship_id).to eq 'AMERICANCHAMPION'
|
|
10
|
-
expect(subject.first.ship_name).to eq 'American Champion'
|
|
11
|
-
expect(subject.first.ship_model).to eq nil
|
|
12
|
-
expect(subject.first.ship_type).to eq 'Tug'
|
|
13
|
-
expect(subject.first.roles).to eq ['Support Ship', 'Barge Tug']
|
|
14
|
-
expect(subject.first.active).to eq false
|
|
15
|
-
expect(subject.first.imo).to eq 7_434_016
|
|
16
|
-
expect(subject.first.mmsi).to eq 367_020_820
|
|
17
|
-
expect(subject.first.abs).to eq 571_252
|
|
18
|
-
expect(subject.first.ship_class).to eq 7_604_342 # Call as array since "class" is a method in Ruby
|
|
19
|
-
expect(subject.first.weight_lbs).to eq 588_000
|
|
20
|
-
expect(subject.first.weight_kg).to eq 266_712
|
|
21
|
-
expect(subject.first.year_built).to eq 1976
|
|
22
|
-
expect(subject.first.home_port).to eq 'Port of Los Angeles'
|
|
23
|
-
expect(subject.first.status).to eq 'Stopped'
|
|
24
|
-
expect(subject.first.speed_kn).to eq 0
|
|
25
|
-
expect(subject.first.course_deg).to eq nil
|
|
26
|
-
expect(subject.first.position).to eq ({ 'latitude' => 30.5276, 'longitude' => -88.10261 })
|
|
27
|
-
expect(subject.first.successful_landings).to eq nil
|
|
28
|
-
expect(subject.first.attempted_landings).to eq nil
|
|
29
|
-
expect(subject.first.missions).to eq [{ 'flight' => 7, 'name' => 'COTS 1' }, { 'flight' => 8, 'name' => 'COTS 2' }]
|
|
30
|
-
expect(subject.first.url).to eq 'https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION'
|
|
31
|
-
expect(subject.first.image).to eq 'https://i.imgur.com/woCxpkj.jpg'
|
|
4
|
+
context '#info', vcr: { cassette_name: 'v4/ships/all' } do
|
|
5
|
+
subject { SPACEX::Ships.info }
|
|
6
|
+
it 'returns an array of SPACEX::Ships' do
|
|
7
|
+
expect(subject).to be_an Array
|
|
8
|
+
expect(subject.first).to be_a SPACEX::Ships
|
|
32
9
|
end
|
|
33
10
|
end
|
|
34
11
|
|
|
35
|
-
context "#info('
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
it 'returns
|
|
40
|
-
expect(subject
|
|
41
|
-
expect(subject.
|
|
42
|
-
expect(subject.
|
|
43
|
-
expect(subject.
|
|
44
|
-
expect(subject.
|
|
45
|
-
expect(subject.
|
|
12
|
+
context "#info('5ea6ed2d080df4000697c901')",
|
|
13
|
+
vcr: { cassette_name: 'v4/ships/one' } do
|
|
14
|
+
subject { SPACEX::Ships.info('5ea6ed2d080df4000697c901') }
|
|
15
|
+
|
|
16
|
+
it 'returns a specific ship with all properties' do
|
|
17
|
+
expect(subject).to be_a SPACEX::Ships
|
|
18
|
+
expect(subject.id).to eq '5ea6ed2d080df4000697c901'
|
|
19
|
+
expect(subject.name).to eq 'American Champion'
|
|
20
|
+
expect(subject.legacy_id).to eq 'AMERICANCHAMPION'
|
|
21
|
+
expect(subject.type).to eq 'Tug'
|
|
22
|
+
expect(subject.roles).to be_an Array
|
|
46
23
|
expect(subject.imo).to eq 7_434_016
|
|
47
24
|
expect(subject.mmsi).to eq 367_020_820
|
|
48
25
|
expect(subject.abs).to eq 571_252
|
|
49
|
-
expect(subject.
|
|
50
|
-
expect(subject.
|
|
51
|
-
expect(subject.weight_kg).to eq 266_712
|
|
26
|
+
expect(subject.mass_kg).to eq 266_712
|
|
27
|
+
expect(subject.mass_lbs).to eq 588_000
|
|
52
28
|
expect(subject.year_built).to eq 1976
|
|
53
29
|
expect(subject.home_port).to eq 'Port of Los Angeles'
|
|
54
|
-
expect(subject.
|
|
55
|
-
expect(subject.
|
|
56
|
-
expect(subject.course_deg).to eq nil
|
|
57
|
-
expect(subject.position).to eq ({ 'latitude' => 30.52852, 'longitude' => -88.09869 })
|
|
58
|
-
expect(subject.successful_landings).to eq nil
|
|
59
|
-
expect(subject.attempted_landings).to eq nil
|
|
60
|
-
expect(subject.missions).to eq [{ 'flight' => 7, 'name' => 'COTS 1' }, { 'flight' => 8, 'name' => 'COTS 2' }]
|
|
61
|
-
expect(subject.url).to eq 'https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION'
|
|
62
|
-
expect(subject.image).to eq 'https://i.imgur.com/woCxpkj.jpg'
|
|
30
|
+
expect(subject.active).to eq false
|
|
31
|
+
expect(subject.launches).to be_an Array
|
|
63
32
|
end
|
|
64
33
|
end
|
|
65
34
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe SPACEX::Starlink do
|
|
4
|
+
context '#info', vcr: { cassette_name: 'v4/starlink/all' } do
|
|
5
|
+
subject { SPACEX::Starlink.info }
|
|
6
|
+
it 'returns an array of SPACEX::Starlink' do
|
|
7
|
+
expect(subject).to be_an Array
|
|
8
|
+
expect(subject.first).to be_a SPACEX::Starlink
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context "#info('5eed770f096e59000698560d')",
|
|
13
|
+
vcr: { cassette_name: 'v4/starlink/one' } do
|
|
14
|
+
subject { SPACEX::Starlink.info('5eed770f096e59000698560d') }
|
|
15
|
+
|
|
16
|
+
it 'returns a specific starlink satellite with all properties' do
|
|
17
|
+
expect(subject).to be_a SPACEX::Starlink
|
|
18
|
+
expect(subject.id).to eq '5eed770f096e59000698560d'
|
|
19
|
+
expect(subject.launch).to eq '5eb87d30ffd86e000604b378'
|
|
20
|
+
expect(subject.version).to eq 'v0.9'
|
|
21
|
+
expect(subject.height_km).to be_nil
|
|
22
|
+
expect(subject.latitude).to be_nil
|
|
23
|
+
expect(subject.longitude).to be_nil
|
|
24
|
+
expect(subject.velocity_kms).to be_nil
|
|
25
|
+
expect(subject.spaceTrack).to be_a Hash
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/spec/spacex/version_spec.rb
CHANGED
|
@@ -4,4 +4,16 @@ describe SPACEX::VERSION do
|
|
|
4
4
|
it 'has a version' do
|
|
5
5
|
expect(SPACEX::VERSION).to_not be nil
|
|
6
6
|
end
|
|
7
|
+
|
|
8
|
+
it 'is a semantic version string' do
|
|
9
|
+
expect(SPACEX::VERSION).to match(/\A\d+\.\d+\.\d+\z/)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe SPACEX do
|
|
14
|
+
describe '.help' do
|
|
15
|
+
it 'prints the GitHub URL' do
|
|
16
|
+
expect { SPACEX.help }.to output("https://github.com/rodolfobandeira/spacex\n").to_stdout
|
|
17
|
+
end
|
|
18
|
+
end
|
|
7
19
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -2,19 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Coveralls.wear!
|
|
8
|
-
else
|
|
9
|
-
require 'pry'
|
|
10
|
-
require 'simplecov'
|
|
11
|
-
SimpleCov.start
|
|
12
|
-
end
|
|
5
|
+
require 'coverage_helper'
|
|
6
|
+
require 'pry' unless ENV['CI']
|
|
13
7
|
|
|
14
8
|
require 'rubygems'
|
|
15
9
|
require 'rspec'
|
|
16
10
|
require 'spacex'
|
|
17
11
|
|
|
18
|
-
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each do |file|
|
|
12
|
+
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].sort.each do |file|
|
|
19
13
|
require file
|
|
20
14
|
end
|