spacex 0.0.5 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +7 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +6 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +9 -23
- data/.ruby-version +1 -1
- data/.travis.yml +18 -3
- data/CHANGELOG.md +61 -0
- data/CONTRIBUTING.md +37 -0
- data/Gemfile +4 -2
- data/README.md +458 -25
- data/lib/spacex.rb +15 -4
- data/lib/spacex/api_info.rb +7 -0
- data/lib/spacex/base_request.rb +51 -13
- data/lib/spacex/capsules.rb +19 -0
- data/lib/spacex/company_info.rb +1 -3
- data/lib/spacex/cores.rb +22 -0
- data/lib/spacex/dragon_capsules.rb +33 -0
- data/lib/spacex/endpoint.rb +1 -3
- data/lib/spacex/history.rb +7 -0
- data/lib/spacex/landing_pads.rb +11 -0
- data/lib/spacex/launch_pads.rb +11 -0
- data/lib/spacex/launches.rb +21 -3
- data/lib/spacex/missions.rb +18 -0
- data/lib/spacex/payloads.rb +7 -0
- data/lib/spacex/resource.rb +5 -0
- data/lib/spacex/roadster.rb +7 -0
- data/lib/spacex/rockets.rb +7 -0
- data/lib/spacex/ships.rb +33 -0
- data/lib/spacex/version.rb +1 -4
- data/spacex.gemspec +8 -8
- data/spec/fixtures/spacex/api_info/info.yml +65 -0
- data/spec/fixtures/spacex/capsules.yml +83 -0
- data/spec/fixtures/spacex/capsules/C202.yml +123 -0
- data/spec/fixtures/spacex/company_info/info.yml +75 -14
- data/spec/fixtures/spacex/cores.yml +62 -0
- data/spec/fixtures/spacex/cores/B1041.yml +123 -0
- data/spec/fixtures/spacex/dragon_capsules/info.yml +77 -0
- data/spec/fixtures/spacex/dragon_capsules/info/dragon1.yml +131 -0
- data/spec/fixtures/spacex/history/info.yml +62 -0
- data/spec/fixtures/spacex/history/info/4.yml +62 -0
- data/spec/fixtures/spacex/landing_pads/info.yml +68 -0
- data/spec/fixtures/spacex/landing_pads/info/LZ-4.yml +70 -0
- data/spec/fixtures/spacex/launch_pads/info.yml +104 -0
- data/spec/fixtures/spacex/launch_pads/info/vafb_slc_4e.yml +71 -0
- data/spec/fixtures/spacex/launches.yml +62 -0
- data/spec/fixtures/spacex/launches/68.yml +69 -0
- data/spec/fixtures/spacex/launches/all.yml +62 -0
- data/spec/fixtures/spacex/launches/info.yml +62 -0
- data/spec/fixtures/spacex/launches/latest.yml +8 -8
- data/spec/fixtures/spacex/launches/next.yml +123 -0
- data/spec/fixtures/spacex/launches/past.yml +62 -0
- data/spec/fixtures/spacex/launches/upcoming.yml +64 -0
- data/spec/fixtures/spacex/missions/F3364BF.yml +157 -0
- data/spec/fixtures/spacex/missions/info.yml +62 -0
- data/spec/fixtures/spacex/payloads/RatSat.yml +62 -0
- data/spec/fixtures/spacex/payloads/info.yml +62 -0
- data/spec/fixtures/spacex/roadster/info.yml +133 -0
- data/spec/fixtures/spacex/rockets/info.yml +105 -0
- data/spec/fixtures/spacex/rockets/info/falcon1.yml +139 -0
- data/spec/fixtures/spacex/rockets/info/invalid.yml +61 -0
- data/spec/fixtures/spacex/ships/info.yml +139 -0
- data/spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml +125 -0
- data/spec/spacex/api_info_spec.rb +16 -0
- data/spec/spacex/capsules_spec.rb +38 -0
- data/spec/spacex/company_info_spec.rb +3 -5
- data/spec/spacex/cores_spec.rb +45 -0
- data/spec/spacex/dragon_capsules_spec.rb +107 -0
- data/spec/spacex/endpoint_spec.rb +9 -0
- data/spec/spacex/history_spec.rb +50 -0
- data/spec/spacex/landing_pads_spec.rb +72 -0
- data/spec/spacex/launch_pads_spec.rb +77 -0
- data/spec/spacex/launches_spec.rb +580 -16
- data/spec/spacex/missions_spec.rb +35 -0
- data/spec/spacex/payloads_spec.rb +62 -0
- data/spec/spacex/roadster_spec.rb +36 -0
- data/spec/spacex/rockets_spec.rb +210 -0
- data/spec/spacex/ships_spec.rb +65 -0
- data/spec/spacex/version_spec.rb +1 -3
- data/spec/spec_helper.rb +9 -0
- metadata +140 -23
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SPACEX::Missions do
|
4
|
+
context '#info', vcr: { cassette_name: 'missions/info' } do
|
5
|
+
subject do
|
6
|
+
SPACEX::Missions.info
|
7
|
+
end
|
8
|
+
it 'returns missions info' do
|
9
|
+
expect(subject.first.mission_id).to eq 'F3364BF'
|
10
|
+
expect(subject.first.mission_name).to eq 'Iridium NEXT'
|
11
|
+
expect(subject.first.manufacturers).to eq ['Orbital ATK']
|
12
|
+
expect(subject.first.payload_ids).to eq ['Iridium NEXT 1', 'Iridium NEXT 2', 'Iridium NEXT 3', 'Iridium NEXT 4', 'Iridium NEXT 5', 'Iridium NEXT 6', 'Iridium NEXT 7']
|
13
|
+
expect(subject.first.wikipedia).to eq 'https://en.wikipedia.org/wiki/Iridium_satellite_constellation'
|
14
|
+
expect(subject.first.website).to eq 'https://www.iridiumnext.com/'
|
15
|
+
expect(subject.first.twitter).to eq 'https://twitter.com/IridiumBoss?lang=en'
|
16
|
+
expect(subject.first.description).to start_with 'In 2017, Iridium began launching Iridium NEXT'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "#info('F3364BF')", vcr: { cassette_name: 'missions/F3364BF' } do
|
21
|
+
subject do
|
22
|
+
SPACEX::Missions.info('F3364BF')
|
23
|
+
end
|
24
|
+
it 'return specific mission info' do
|
25
|
+
expect(subject.mission_id).to eq 'F3364BF'
|
26
|
+
expect(subject.mission_name).to eq 'Iridium NEXT'
|
27
|
+
expect(subject.manufacturers).to eq ['Orbital ATK']
|
28
|
+
expect(subject.payload_ids).to eq ['Iridium NEXT 1', 'Iridium NEXT 2', 'Iridium NEXT 3', 'Iridium NEXT 4', 'Iridium NEXT 5', 'Iridium NEXT 6', 'Iridium NEXT 7']
|
29
|
+
expect(subject.wikipedia).to eq 'https://en.wikipedia.org/wiki/Iridium_satellite_constellation'
|
30
|
+
expect(subject.website).to eq 'https://www.iridiumnext.com/'
|
31
|
+
expect(subject.twitter).to eq 'https://twitter.com/IridiumBoss?lang=en'
|
32
|
+
expect(subject.description).to start_with '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.'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SPACEX::Payloads do
|
4
|
+
context '#info', vcr: { cassette_name: 'payloads/info' } do
|
5
|
+
subject do
|
6
|
+
SPACEX::Payloads.info
|
7
|
+
end
|
8
|
+
it 'returns payloads info' do
|
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
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "#info('RatSat')", vcr: { cassette_name: 'payloads/RatSat' } do
|
32
|
+
subject do
|
33
|
+
SPACEX::Payloads.info('RatSat')
|
34
|
+
end
|
35
|
+
it 'return specific payload info' do
|
36
|
+
expect(subject.payload_id).to eq 'RatSat'
|
37
|
+
expect(subject.reused).to eq false
|
38
|
+
expect(subject.customers).to eq ['SpaceX']
|
39
|
+
expect(subject.nationality).to eq 'United States'
|
40
|
+
expect(subject.manufacturer).to eq 'SpaceX'
|
41
|
+
expect(subject.payload_type).to eq 'Satellite'
|
42
|
+
expect(subject.payload_mass_kg).to eq 165
|
43
|
+
expect(subject.payload_mass_lbs).to eq 363
|
44
|
+
expect(subject.orbit).to eq 'LEO'
|
45
|
+
expect(subject.orbit_params.apoapsis_km).to eq 638.145
|
46
|
+
expect(subject.orbit_params.arg_of_pericenter).to eq 262.0542
|
47
|
+
expect(subject.orbit_params.eccentricity).to eq 0.0009194
|
48
|
+
expect(subject.orbit_params.epoch).to eq '2008-09-28T22:51:02.000Z'
|
49
|
+
expect(subject.orbit_params.inclination_deg).to eq 9.3329
|
50
|
+
expect(subject.orbit_params.lifespan_years).to eq nil
|
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
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe SPACEX::Roadster do
|
6
|
+
context '#info', vcr: { cassette_name: 'roadster/info' } do
|
7
|
+
subject do
|
8
|
+
SPACEX::Roadster.info
|
9
|
+
end
|
10
|
+
it 'returns Roadster launch info' do
|
11
|
+
expect(subject.name).to eq "Elon Musk's Tesla Roadster"
|
12
|
+
expect(subject.launch_date_utc).to eq '2018-02-06T20:45:00.000Z'
|
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"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,210 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SPACEX::Rockets do
|
4
|
+
context '#info', vcr: { cassette_name: 'rockets/info' } do
|
5
|
+
subject do
|
6
|
+
SPACEX::Rockets.info
|
7
|
+
end
|
8
|
+
|
9
|
+
it "returns all Rockets' when no id is passed info" do
|
10
|
+
first_subject = subject.first
|
11
|
+
expect(first_subject.id).to eq 1
|
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
|
+
)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "#info('falcon1')", vcr: { cassette_name: 'rockets/info/falcon1' } do
|
119
|
+
subject do
|
120
|
+
SPACEX::Rockets.info('falcon1')
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'returns Rocket info for "falcon1"' do
|
124
|
+
expect(subject.id).to eq 1
|
125
|
+
expect(subject.active).to eq false
|
126
|
+
expect(subject.stages).to eq 2
|
127
|
+
expect(subject.boosters).to eq 0
|
128
|
+
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
|
+
expect(subject.country).to eq 'Republic of the Marshall Islands'
|
132
|
+
expect(subject.company).to eq 'SpaceX'
|
133
|
+
expect(subject.height).to eq('meters' => 22.25, 'feet' => 73)
|
134
|
+
expect(subject.diameter).to eq('meters' => 1.68, 'feet' => 5.5)
|
135
|
+
expect(subject.mass).to eq('kg' => 30_146, 'lb' => 66_460)
|
136
|
+
expect(subject.payload_weights).to eq [{
|
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)
|
197
|
+
expect(subject.wikipedia).to eq 'https://en.wikipedia.org/wiki/Falcon_1'
|
198
|
+
expect(subject.description).to eq(
|
199
|
+
'The Falcon 1 was an expendable launch system '\
|
200
|
+
'privately developed and manufactured by SpaceX during 2006-2009. '\
|
201
|
+
'On 28 September 2008, Falcon 1 became the first '\
|
202
|
+
'privately-developed liquid-fuel launch vehicle to '\
|
203
|
+
'go into orbit around the Earth.'
|
204
|
+
)
|
205
|
+
expect(subject.rocket_id).to eq 'falcon1'
|
206
|
+
expect(subject.rocket_name).to eq 'Falcon 1'
|
207
|
+
expect(subject.rocket_type).to eq 'rocket'
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SPACEX::Ships do
|
4
|
+
context '#info', vcr: { cassette_name: 'ships/info' } do
|
5
|
+
subject do
|
6
|
+
SPACEX::Ships.info
|
7
|
+
end
|
8
|
+
it 'returns Ships info' do
|
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'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "#info('AMERICANCHAMPION')", vcr: { cassette_name: 'ships/info/AMERICANCHAMPION' } do
|
36
|
+
subject do
|
37
|
+
SPACEX::Ships.info('AMERICANCHAMPION')
|
38
|
+
end
|
39
|
+
it 'returns Ship info for "AMERICANCHAMPION"' do
|
40
|
+
expect(subject.ship_id).to eq 'AMERICANCHAMPION'
|
41
|
+
expect(subject.ship_name).to eq 'American Champion'
|
42
|
+
expect(subject.ship_model).to eq nil
|
43
|
+
expect(subject.ship_type).to eq 'Tug'
|
44
|
+
expect(subject.roles).to eq ['Support Ship', 'Barge Tug']
|
45
|
+
expect(subject.active).to eq false
|
46
|
+
expect(subject.imo).to eq 7_434_016
|
47
|
+
expect(subject.mmsi).to eq 367_020_820
|
48
|
+
expect(subject.abs).to eq 571_252
|
49
|
+
expect(subject.ship_class).to eq 7_604_342 # Call as array since "class" is a method in Ruby
|
50
|
+
expect(subject.weight_lbs).to eq 588_000
|
51
|
+
expect(subject.weight_kg).to eq 266_712
|
52
|
+
expect(subject.year_built).to eq 1976
|
53
|
+
expect(subject.home_port).to eq 'Port of Los Angeles'
|
54
|
+
expect(subject.status).to eq 'Stopped'
|
55
|
+
expect(subject.speed_kn).to eq 0
|
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'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/spec/spacex/version_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
|
4
4
|
|
5
|
+
if ENV['CI']
|
6
|
+
require 'coveralls'
|
7
|
+
Coveralls.wear!
|
8
|
+
else
|
9
|
+
require 'pry'
|
10
|
+
require 'simplecov'
|
11
|
+
SimpleCov.start
|
12
|
+
end
|
13
|
+
|
5
14
|
require 'rubygems'
|
6
15
|
require 'rspec'
|
7
16
|
require 'spacex'
|
metadata
CHANGED
@@ -1,51 +1,65 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spacex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodolfo Bandeira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.12'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '0.12'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.6.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.6.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
|
-
type: :
|
62
|
+
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
@@ -70,16 +84,16 @@ dependencies:
|
|
70
84
|
name: rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '3.8'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '3.8'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rubocop
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,58 +112,118 @@ dependencies:
|
|
98
112
|
name: vcr
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
117
|
+
version: '4'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - "
|
122
|
+
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
124
|
+
version: '4'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: webmock
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- - "
|
129
|
+
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
131
|
+
version: '3.4'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- - "
|
136
|
+
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
138
|
+
version: '3.4'
|
125
139
|
description: Ruby library to consume SpaceX launch data
|
126
140
|
email: rodolfobandeira@protonmail.com
|
127
141
|
executables: []
|
128
142
|
extensions: []
|
129
143
|
extra_rdoc_files: []
|
130
144
|
files:
|
145
|
+
- ".github/ISSUE_TEMPLATE.md"
|
146
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
131
147
|
- ".gitignore"
|
132
148
|
- ".rspec"
|
133
149
|
- ".rubocop.yml"
|
134
150
|
- ".rubocop_todo.yml"
|
135
151
|
- ".ruby-version"
|
136
152
|
- ".travis.yml"
|
153
|
+
- CHANGELOG.md
|
154
|
+
- CONTRIBUTING.md
|
137
155
|
- Gemfile
|
138
156
|
- LICENSE
|
139
157
|
- README.md
|
140
158
|
- Rakefile
|
141
159
|
- lib/spacex.rb
|
160
|
+
- lib/spacex/api_info.rb
|
142
161
|
- lib/spacex/base_request.rb
|
162
|
+
- lib/spacex/capsules.rb
|
143
163
|
- lib/spacex/company_info.rb
|
164
|
+
- lib/spacex/cores.rb
|
165
|
+
- lib/spacex/dragon_capsules.rb
|
144
166
|
- lib/spacex/endpoint.rb
|
167
|
+
- lib/spacex/history.rb
|
168
|
+
- lib/spacex/landing_pads.rb
|
169
|
+
- lib/spacex/launch_pads.rb
|
145
170
|
- lib/spacex/launches.rb
|
171
|
+
- lib/spacex/missions.rb
|
172
|
+
- lib/spacex/payloads.rb
|
173
|
+
- lib/spacex/resource.rb
|
174
|
+
- lib/spacex/roadster.rb
|
175
|
+
- lib/spacex/rockets.rb
|
176
|
+
- lib/spacex/ships.rb
|
146
177
|
- lib/spacex/version.rb
|
147
178
|
- rubocop.yml
|
148
179
|
- spacex.gemspec
|
180
|
+
- spec/fixtures/spacex/api_info/info.yml
|
181
|
+
- spec/fixtures/spacex/capsules.yml
|
182
|
+
- spec/fixtures/spacex/capsules/C202.yml
|
149
183
|
- spec/fixtures/spacex/company_info/info.yml
|
184
|
+
- spec/fixtures/spacex/cores.yml
|
185
|
+
- spec/fixtures/spacex/cores/B1041.yml
|
186
|
+
- spec/fixtures/spacex/dragon_capsules/info.yml
|
187
|
+
- spec/fixtures/spacex/dragon_capsules/info/dragon1.yml
|
188
|
+
- spec/fixtures/spacex/history/info.yml
|
189
|
+
- spec/fixtures/spacex/history/info/4.yml
|
190
|
+
- spec/fixtures/spacex/landing_pads/info.yml
|
191
|
+
- spec/fixtures/spacex/landing_pads/info/LZ-4.yml
|
192
|
+
- spec/fixtures/spacex/launch_pads/info.yml
|
193
|
+
- spec/fixtures/spacex/launch_pads/info/vafb_slc_4e.yml
|
194
|
+
- spec/fixtures/spacex/launches.yml
|
195
|
+
- spec/fixtures/spacex/launches/68.yml
|
196
|
+
- spec/fixtures/spacex/launches/all.yml
|
197
|
+
- spec/fixtures/spacex/launches/info.yml
|
150
198
|
- spec/fixtures/spacex/launches/latest.yml
|
199
|
+
- spec/fixtures/spacex/launches/next.yml
|
200
|
+
- spec/fixtures/spacex/launches/past.yml
|
201
|
+
- spec/fixtures/spacex/launches/upcoming.yml
|
202
|
+
- spec/fixtures/spacex/missions/F3364BF.yml
|
203
|
+
- spec/fixtures/spacex/missions/info.yml
|
204
|
+
- spec/fixtures/spacex/payloads/RatSat.yml
|
205
|
+
- spec/fixtures/spacex/payloads/info.yml
|
206
|
+
- spec/fixtures/spacex/roadster/info.yml
|
207
|
+
- spec/fixtures/spacex/rockets/info.yml
|
208
|
+
- spec/fixtures/spacex/rockets/info/falcon1.yml
|
209
|
+
- spec/fixtures/spacex/rockets/info/invalid.yml
|
210
|
+
- spec/fixtures/spacex/ships/info.yml
|
211
|
+
- spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml
|
212
|
+
- spec/spacex/api_info_spec.rb
|
213
|
+
- spec/spacex/capsules_spec.rb
|
151
214
|
- spec/spacex/company_info_spec.rb
|
215
|
+
- spec/spacex/cores_spec.rb
|
216
|
+
- spec/spacex/dragon_capsules_spec.rb
|
217
|
+
- spec/spacex/endpoint_spec.rb
|
218
|
+
- spec/spacex/history_spec.rb
|
219
|
+
- spec/spacex/landing_pads_spec.rb
|
220
|
+
- spec/spacex/launch_pads_spec.rb
|
152
221
|
- spec/spacex/launches_spec.rb
|
222
|
+
- spec/spacex/missions_spec.rb
|
223
|
+
- spec/spacex/payloads_spec.rb
|
224
|
+
- spec/spacex/roadster_spec.rb
|
225
|
+
- spec/spacex/rockets_spec.rb
|
226
|
+
- spec/spacex/ships_spec.rb
|
153
227
|
- spec/spacex/version_spec.rb
|
154
228
|
- spec/spec_helper.rb
|
155
229
|
- spec/support/vcr.rb
|
@@ -173,15 +247,58 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
247
|
version: '0'
|
174
248
|
requirements: []
|
175
249
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.6.
|
250
|
+
rubygems_version: 2.6.14.1
|
177
251
|
signing_key:
|
178
252
|
specification_version: 4
|
179
|
-
summary:
|
253
|
+
summary: SpaceX API with Ruby
|
180
254
|
test_files:
|
255
|
+
- spec/fixtures/spacex/api_info/info.yml
|
256
|
+
- spec/fixtures/spacex/capsules.yml
|
257
|
+
- spec/fixtures/spacex/capsules/C202.yml
|
181
258
|
- spec/fixtures/spacex/company_info/info.yml
|
259
|
+
- spec/fixtures/spacex/cores.yml
|
260
|
+
- spec/fixtures/spacex/cores/B1041.yml
|
261
|
+
- spec/fixtures/spacex/dragon_capsules/info.yml
|
262
|
+
- spec/fixtures/spacex/dragon_capsules/info/dragon1.yml
|
263
|
+
- spec/fixtures/spacex/history/info.yml
|
264
|
+
- spec/fixtures/spacex/history/info/4.yml
|
265
|
+
- spec/fixtures/spacex/landing_pads/info.yml
|
266
|
+
- spec/fixtures/spacex/landing_pads/info/LZ-4.yml
|
267
|
+
- spec/fixtures/spacex/launch_pads/info.yml
|
268
|
+
- spec/fixtures/spacex/launch_pads/info/vafb_slc_4e.yml
|
269
|
+
- spec/fixtures/spacex/launches.yml
|
270
|
+
- spec/fixtures/spacex/launches/68.yml
|
271
|
+
- spec/fixtures/spacex/launches/all.yml
|
272
|
+
- spec/fixtures/spacex/launches/info.yml
|
182
273
|
- spec/fixtures/spacex/launches/latest.yml
|
274
|
+
- spec/fixtures/spacex/launches/next.yml
|
275
|
+
- spec/fixtures/spacex/launches/past.yml
|
276
|
+
- spec/fixtures/spacex/launches/upcoming.yml
|
277
|
+
- spec/fixtures/spacex/missions/F3364BF.yml
|
278
|
+
- spec/fixtures/spacex/missions/info.yml
|
279
|
+
- spec/fixtures/spacex/payloads/RatSat.yml
|
280
|
+
- spec/fixtures/spacex/payloads/info.yml
|
281
|
+
- spec/fixtures/spacex/roadster/info.yml
|
282
|
+
- spec/fixtures/spacex/rockets/info.yml
|
283
|
+
- spec/fixtures/spacex/rockets/info/falcon1.yml
|
284
|
+
- spec/fixtures/spacex/rockets/info/invalid.yml
|
285
|
+
- spec/fixtures/spacex/ships/info.yml
|
286
|
+
- spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml
|
287
|
+
- spec/spacex/api_info_spec.rb
|
288
|
+
- spec/spacex/capsules_spec.rb
|
183
289
|
- spec/spacex/company_info_spec.rb
|
290
|
+
- spec/spacex/cores_spec.rb
|
291
|
+
- spec/spacex/dragon_capsules_spec.rb
|
292
|
+
- spec/spacex/endpoint_spec.rb
|
293
|
+
- spec/spacex/history_spec.rb
|
294
|
+
- spec/spacex/landing_pads_spec.rb
|
295
|
+
- spec/spacex/launch_pads_spec.rb
|
184
296
|
- spec/spacex/launches_spec.rb
|
297
|
+
- spec/spacex/missions_spec.rb
|
298
|
+
- spec/spacex/payloads_spec.rb
|
299
|
+
- spec/spacex/roadster_spec.rb
|
300
|
+
- spec/spacex/rockets_spec.rb
|
301
|
+
- spec/spacex/ships_spec.rb
|
185
302
|
- spec/spacex/version_spec.rb
|
186
303
|
- spec/spec_helper.rb
|
187
304
|
- spec/support/vcr.rb
|