spacex 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +53 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +14 -0
  5. data/.rubocop_todo.yml +24 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +6 -0
  8. data/CHANGELOG.md +53 -0
  9. data/CONTRIBUTING.md +35 -0
  10. data/Gemfile +7 -0
  11. data/LICENSE +21 -0
  12. data/README.md +495 -0
  13. data/Rakefile +19 -0
  14. data/lib/spacex.rb +19 -0
  15. data/lib/spacex/base_request.rb +57 -0
  16. data/lib/spacex/capsules.rb +19 -0
  17. data/lib/spacex/company_info.rb +7 -0
  18. data/lib/spacex/cores.rb +22 -0
  19. data/lib/spacex/dragon_capsules.rb +33 -0
  20. data/lib/spacex/endpoint.rb +3 -0
  21. data/lib/spacex/history.rb +7 -0
  22. data/lib/spacex/launches.rb +27 -0
  23. data/lib/spacex/missions.rb +18 -0
  24. data/lib/spacex/payloads.rb +7 -0
  25. data/lib/spacex/resource.rb +5 -0
  26. data/lib/spacex/roadster.rb +7 -0
  27. data/lib/spacex/rockets.rb +7 -0
  28. data/lib/spacex/ships.rb +33 -0
  29. data/lib/spacex/version.rb +7 -0
  30. data/rubocop.yml +8 -0
  31. data/spacex.gemspec +29 -0
  32. data/spec/fixtures/spacex/capsules.yml +83 -0
  33. data/spec/fixtures/spacex/capsules/C202.yml +123 -0
  34. data/spec/fixtures/spacex/company_info/info.yml +129 -0
  35. data/spec/fixtures/spacex/cores.yml +62 -0
  36. data/spec/fixtures/spacex/cores/B1041.yml +123 -0
  37. data/spec/fixtures/spacex/dragon_capsules/info.yml +77 -0
  38. data/spec/fixtures/spacex/dragon_capsules/info/dragon1.yml +131 -0
  39. data/spec/fixtures/spacex/history/info.yml +62 -0
  40. data/spec/fixtures/spacex/history/info/4.yml +62 -0
  41. data/spec/fixtures/spacex/launches.yml +62 -0
  42. data/spec/fixtures/spacex/launches/68.yml +69 -0
  43. data/spec/fixtures/spacex/launches/all.yml +62 -0
  44. data/spec/fixtures/spacex/launches/info.yml +62 -0
  45. data/spec/fixtures/spacex/launches/latest.yml +245 -0
  46. data/spec/fixtures/spacex/launches/next.yml +123 -0
  47. data/spec/fixtures/spacex/launches/past.yml +62 -0
  48. data/spec/fixtures/spacex/launches/upcoming.yml +64 -0
  49. data/spec/fixtures/spacex/missions/F3364BF.yml +157 -0
  50. data/spec/fixtures/spacex/missions/info.yml +62 -0
  51. data/spec/fixtures/spacex/payloads/RatSat.yml +62 -0
  52. data/spec/fixtures/spacex/payloads/info.yml +62 -0
  53. data/spec/fixtures/spacex/roadster/info.yml +133 -0
  54. data/spec/fixtures/spacex/rockets/info.yml +105 -0
  55. data/spec/fixtures/spacex/rockets/info/falcon1.yml +139 -0
  56. data/spec/fixtures/spacex/rockets/info/invalid.yml +61 -0
  57. data/spec/fixtures/spacex/ships/info.yml +139 -0
  58. data/spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml +125 -0
  59. data/spec/spacex/capsules_spec.rb +38 -0
  60. data/spec/spacex/company_info_spec.rb +27 -0
  61. data/spec/spacex/cores_spec.rb +45 -0
  62. data/spec/spacex/dragon_capsules_spec.rb +107 -0
  63. data/spec/spacex/endpoint_spec.rb +9 -0
  64. data/spec/spacex/history_spec.rb +50 -0
  65. data/spec/spacex/launches_spec.rb +652 -0
  66. data/spec/spacex/missions_spec.rb +35 -0
  67. data/spec/spacex/payloads_spec.rb +62 -0
  68. data/spec/spacex/roadster_spec.rb +36 -0
  69. data/spec/spacex/rockets_spec.rb +210 -0
  70. data/spec/spacex/ships_spec.rb +65 -0
  71. data/spec/spacex/version_spec.rb +7 -0
  72. data/spec/spec_helper.rb +20 -0
  73. data/spec/support/vcr.rb +11 -0
  74. metadata +283 -0
@@ -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
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe SPACEX::VERSION do
4
+ it 'has a version' do
5
+ expect(SPACEX::VERSION).to_not be nil
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
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
+
14
+ require 'rubygems'
15
+ require 'rspec'
16
+ require 'spacex'
17
+
18
+ Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each do |file|
19
+ require file
20
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcr'
4
+ require 'webmock/rspec'
5
+
6
+ VCR.configure do |config|
7
+ config.cassette_library_dir = 'spec/fixtures/spacex'
8
+ config.hook_into :webmock
9
+ # config.default_cassette_options = { record: :new_episodes }
10
+ config.configure_rspec_metadata!
11
+ end