spacex 0.0.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +5 -5
  3. data/CHANGELOG.md +18 -2
  4. data/CONTRIBUTING.md +7 -7
  5. data/Gemfile +2 -0
  6. data/README.md +207 -98
  7. data/lib/spacex.rb +3 -0
  8. data/lib/spacex/base_request.rb +45 -20
  9. data/lib/spacex/capsules.rb +19 -0
  10. data/lib/spacex/company_info.rb +1 -1
  11. data/lib/spacex/cores.rb +22 -0
  12. data/lib/spacex/dragon_capsules.rb +2 -16
  13. data/lib/spacex/launches.rb +13 -1
  14. data/lib/spacex/missions.rb +2 -16
  15. data/lib/spacex/roadster.rb +1 -1
  16. data/lib/spacex/rockets.rb +7 -0
  17. data/lib/spacex/ships.rb +2 -16
  18. data/lib/spacex/version.rb +1 -1
  19. data/spacex.gemspec +6 -5
  20. data/spec/fixtures/spacex/capsules.yml +83 -0
  21. data/spec/fixtures/spacex/capsules/C202.yml +123 -0
  22. data/spec/fixtures/spacex/company_info/info.yml +63 -0
  23. data/spec/fixtures/spacex/cores.yml +62 -0
  24. data/spec/fixtures/spacex/cores/B1041.yml +123 -0
  25. data/spec/fixtures/spacex/dragon_capsules/info.yml +6 -6
  26. data/spec/fixtures/spacex/dragon_capsules/info/dragon1.yml +64 -0
  27. data/spec/fixtures/spacex/launches.yml +62 -0
  28. data/spec/fixtures/spacex/launches/all.yml +62 -0
  29. data/spec/fixtures/spacex/launches/next.yml +123 -0
  30. data/spec/fixtures/spacex/missions/F3364BF.yml +77 -0
  31. data/spec/fixtures/spacex/missions/info.yml +7 -7
  32. data/spec/fixtures/spacex/roadster/info.yml +64 -0
  33. data/spec/fixtures/spacex/rockets/info.yml +105 -0
  34. data/spec/fixtures/spacex/rockets/info/falcon1.yml +139 -0
  35. data/spec/fixtures/spacex/rockets/info/invalid.yml +61 -0
  36. data/spec/fixtures/spacex/ships/info.yml +20 -20
  37. data/spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml +61 -0
  38. data/spec/spacex/capsules_spec.rb +38 -0
  39. data/spec/spacex/company_info_spec.rb +2 -4
  40. data/spec/spacex/cores_spec.rb +45 -0
  41. data/spec/spacex/dragon_capsules_spec.rb +6 -6
  42. data/spec/spacex/launches_spec.rb +205 -15
  43. data/spec/spacex/missions_spec.rb +3 -5
  44. data/spec/spacex/roadster_spec.rb +3 -3
  45. data/spec/spacex/rockets_spec.rb +210 -0
  46. data/spec/spacex/ships_spec.rb +4 -4
  47. data/spec/spacex/version_spec.rb +1 -3
  48. data/spec/spec_helper.rb +9 -0
  49. metadata +63 -20
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.spacexdata.com/v3/rockets/invalid
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.3
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 404
19
+ message: Not Found
20
+ headers:
21
+ Date:
22
+ - Fri, 12 Oct 2018 02:59:50 GMT
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=d64b40402217803e462c3cd3b6aad69261539313190; expires=Sat, 12-Oct-19
31
+ 02:59:50 GMT; path=/; domain=.spacexdata.com; HttpOnly; Secure
32
+ Vary:
33
+ - Accept-Encoding, Origin
34
+ X-Dns-Prefetch-Control:
35
+ - 'off'
36
+ X-Frame-Options:
37
+ - SAMEORIGIN
38
+ Strict-Transport-Security:
39
+ - max-age=15552000; includeSubDomains
40
+ X-Download-Options:
41
+ - noopen
42
+ X-Content-Type-Options:
43
+ - nosniff
44
+ X-Xss-Protection:
45
+ - 1; mode=block
46
+ Access-Control-Allow-Origin:
47
+ - "*"
48
+ X-Response-Time:
49
+ - 42ms
50
+ Expect-Ct:
51
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
52
+ Server:
53
+ - cloudflare
54
+ Cf-Ray:
55
+ - 46865010ac54c181-IAD
56
+ body:
57
+ encoding: ASCII-8BIT
58
+ string: '{"error":"Not Found"}'
59
+ http_version:
60
+ recorded_at: Fri, 12 Oct 2018 02:59:50 GMT
61
+ recorded_with: VCR 4.0.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.spacexdata.com/v3/ships
5
+ uri: https://api.spacexdata.com/v3/ships/
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -19,7 +19,7 @@ http_interactions:
19
19
  message: OK
20
20
  headers:
21
21
  Date:
22
- - Fri, 05 Oct 2018 19:00:12 GMT
22
+ - Mon, 15 Oct 2018 03:46:32 GMT
23
23
  Content-Type:
24
24
  - application/json; charset=utf-8
25
25
  Transfer-Encoding:
@@ -27,8 +27,8 @@ http_interactions:
27
27
  Connection:
28
28
  - keep-alive
29
29
  Set-Cookie:
30
- - __cfduid=d753f30f0fae606a308bbf1bdeb7664b11538766011; expires=Sat, 05-Oct-19
31
- 19:00:11 GMT; path=/; domain=.spacexdata.com; HttpOnly; Secure
30
+ - __cfduid=de80892177236026a57f27564aa9dfdaa1539575191; expires=Tue, 15-Oct-19
31
+ 03:46:31 GMT; path=/; domain=.spacexdata.com; HttpOnly; Secure
32
32
  Vary:
33
33
  - Accept-Encoding, Origin
34
34
  X-Dns-Prefetch-Control:
@@ -46,18 +46,18 @@ http_interactions:
46
46
  Access-Control-Allow-Origin:
47
47
  - "*"
48
48
  X-Response-Time:
49
- - 69ms
49
+ - 79ms
50
50
  Expect-Ct:
51
51
  - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
52
52
  Server:
53
53
  - cloudflare
54
54
  Cf-Ray:
55
- - 46522136aa735564-ORD
55
+ - 469f4c957a655747-IAD
56
56
  body:
57
57
  encoding: ASCII-8BIT
58
58
  string: '[{"ship_id":"AMERICANCHAMPION","ship_name":"American Champion","ship_model":null,"ship_type":"Tug","roles":["Support
59
59
  Ship","Barge Tug"],"active":false,"imo":7434016,"mmsi":367020820,"abs":571252,"class":7604342,"weight_lbs":588000,"weight_kg":266712,"year_built":1976,"home_port":"Port
60
- of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":30.52852,"longitude":-88.09869},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"COTS
60
+ of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":30.5276,"longitude":-88.10261},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"COTS
61
61
  1","flight":7},{"name":"COTS 2","flight":8}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION","image":"https://i.imgur.com/woCxpkj.jpg"},{"ship_id":"AMERICANISLANDER","ship_name":"American
62
62
  Islander","ship_model":null,"ship_type":"Cargo","roles":["Dragon Recovery"],"active":false,"imo":null,"mmsi":367035570,"abs":null,"class":null,"weight_lbs":null,"weight_kg":null,"year_built":null,"home_port":"Port
63
63
  of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":33.73421,"longitude":-118.2635},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-1","flight":9},{"name":"CRS-2","flight":10},{"name":"CRS-3","flight":14},{"name":"CRS-4","flight":18}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:435112/vessel:AMERICAN%20ISLANDER","image":"https://i.imgur.com/jmj8Sh2.jpg"},{"ship_id":"AMERICANSPIRIT","ship_name":"American
@@ -70,29 +70,29 @@ http_interactions:
70
70
  of Los Angeles","status":"Towing Astern","speed_kn":0,"course_deg":null,"position":{"latitude":33.77161,"longitude":-118.2121},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"FormoSat-5","flight":46},{"name":"Iridium
71
71
  NEXT Mission 3","flight":48}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:428415/vessel:BETTY%20R%20GAMBARELLA","image":"https://i.imgur.com/ngYgFnn.jpg"},{"ship_id":"ELSBETH3","ship_name":"Elsbeth
72
72
  III","ship_model":null,"ship_type":"Tug","roles":["ASDS Tug"],"active":false,"imo":8983375,"mmsi":367017460,"abs":null,"class":null,"weight_lbs":602000,"weight_kg":273063,"year_built":1999,"home_port":"Port
73
- Canaveral","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":29.6613,"longitude":-91.09889},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-5","flight":19},{"name":"DSCOVR","flight":20},{"name":"CRS-6","flight":22},{"name":"CRS-7","flight":24},{"name":"SES-9","flight":27},{"name":"CRS-8","flight":28},{"name":"JCSAT-2B","flight":29},{"name":"Thaicom
73
+ Canaveral","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":29.6608,"longitude":-91.09957},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-5","flight":19},{"name":"DSCOVR","flight":20},{"name":"CRS-6","flight":22},{"name":"CRS-7","flight":24},{"name":"SES-9","flight":27},{"name":"CRS-8","flight":28},{"name":"JCSAT-2B","flight":29},{"name":"Thaicom
74
74
  8","flight":30},{"name":"ABS-2A / Eutelsat 117W B","flight":31},{"name":"CRS-9","flight":32},{"name":"JCSAT-16","flight":33},{"name":"SES-10","flight":38},{"name":"BulgariaSat-1","flight":42},{"name":"Boeing
75
75
  X-37B OTV 5","flight":47}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:434560/vessel:ELSBETH%20III","image":"https://i.imgur.com/1s5DUbJ.jpg"},{"ship_id":"GONAVIGATOR","ship_name":"GO
76
76
  Navigator","ship_model":null,"ship_type":"Cargo","roles":["Support Ship","Fairing
77
77
  Recovery"],"active":true,"imo":9566887,"mmsi":367550000,"abs":1221524,"class":9204358,"weight_lbs":996000,"weight_kg":451778,"year_built":2009,"home_port":"Port
78
- Canaveral","status":"Moored","speed_kn":0,"course_deg":null,"position":{"latitude":28.41342,"longitude":-80.62096},"successful_landings":null,"attempted_landings":null,"missions":[],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:452540/vessel:GO%20NAVIGATOR","image":"https://i.imgur.com/MjNWzhO.jpg"},{"ship_id":"GOPURSUIT","ship_name":"GO
78
+ Canaveral","status":"Moored","speed_kn":0,"course_deg":null,"position":{"latitude":28.41315,"longitude":-80.62064},"successful_landings":null,"attempted_landings":null,"missions":[],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:452540/vessel:GO%20NAVIGATOR","image":"https://i.imgur.com/MjNWzhO.jpg"},{"ship_id":"GOPURSUIT","ship_name":"GO
79
79
  Pursuit","ship_model":null,"ship_type":"Cargo","roles":["Support Ship","Fairing
80
80
  Recovery"],"active":false,"imo":9458884,"mmsi":367191410,"abs":1201189,"class":7174230,"weight_lbs":1108925,"weight_kg":502999,"year_built":2007,"home_port":"Port
81
- Canaveral","status":"Moored","speed_kn":0,"course_deg":null,"position":{"latitude":29.11538,"longitude":-90.20948},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"TESS","flight":60},{"name":"Bangabandhu-1","flight":61},{"name":"SES-12","flight":63},{"name":"Telstar
81
+ Canaveral","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":29.11541,"longitude":-90.20965},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"TESS","flight":60},{"name":"Bangabandhu-1","flight":61},{"name":"SES-12","flight":63},{"name":"Telstar
82
82
  19V","flight":65}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:439594/vessel:GO%20PURSUIT","image":"https://i.imgur.com/5w1ZWre.jpg"},{"ship_id":"GOQUEST","ship_name":"GO
83
83
  Quest","ship_model":null,"ship_type":"Cargo","roles":["Support Ship"],"active":true,"imo":1155515,"mmsi":367564890,"abs":null,"class":null,"weight_lbs":null,"weight_kg":null,"year_built":2014,"home_port":"Port
84
- Canaveral","status":"Stopped","speed_kn":0.1,"course_deg":null,"position":{"latitude":28.41374,"longitude":-80.62157},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-5","flight":19},{"name":"DSCOVR","flight":20},{"name":"CRS-6","flight":22},{"name":"CRS-7","flight":24},{"name":"SES-9","flight":27},{"name":"CRS-8","flight":28},{"name":"JCSAT-2B","flight":29},{"name":"Thaicom
84
+ Canaveral","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":28.40891,"longitude":-80.61788},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-5","flight":19},{"name":"DSCOVR","flight":20},{"name":"CRS-6","flight":22},{"name":"CRS-7","flight":24},{"name":"SES-9","flight":27},{"name":"CRS-8","flight":28},{"name":"JCSAT-2B","flight":29},{"name":"Thaicom
85
85
  8","flight":30},{"name":"ABS-2A / Eutelsat 117W B","flight":31},{"name":"CRS-9","flight":32},{"name":"JCSAT-16","flight":33},{"name":"SES-10","flight":38},{"name":"BulgariaSat-1","flight":42},{"name":"Boeing
86
86
  X-37B OTV 5","flight":47},{"name":"SES-11 / Echostar 105","flight":49},{"name":"SES-16
87
87
  / GovSat-1","flight":54},{"name":"TESS","flight":60},{"name":"Bangabandhu-1","flight":61},{"name":"Telstar
88
88
  19V","flight":65},{"name":"Telstar 18V","flight":68}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:450521/vessel:GO%20QUEST","image":"https://i.imgur.com/ABXtHKa.jpg"},{"ship_id":"GOSEARCHER","ship_name":"GO
89
89
  Searcher","ship_model":null,"ship_type":"Cargo","roles":["Support Ship","Fairing
90
90
  Recovery"],"active":true,"imo":9591648,"mmsi":366584000,"abs":1226876,"class":10204360,"weight_lbs":994000,"weight_kg":450870,"year_built":2010,"home_port":"Port
91
- Canaveral","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":28.41307,"longitude":-80.62043},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-5","flight":19},{"name":"DSCOVR","flight":20},{"name":"CRS-6","flight":22},{"name":"CRS-7","flight":24},{"name":"SES-9","flight":27},{"name":"CRS-8","flight":28},{"name":"JCSAT-2B","flight":29},{"name":"Thaicom
91
+ Canaveral","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":28.41313,"longitude":-80.62058},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-5","flight":19},{"name":"DSCOVR","flight":20},{"name":"CRS-6","flight":22},{"name":"CRS-7","flight":24},{"name":"SES-9","flight":27},{"name":"CRS-8","flight":28},{"name":"JCSAT-2B","flight":29},{"name":"Thaicom
92
92
  8","flight":30},{"name":"ABS-2A / Eutelsat 117W B","flight":31},{"name":"CRS-9","flight":32},{"name":"JCSAT-16","flight":33},{"name":"SES-10","flight":38},{"name":"NROL-76","flight":39},{"name":"BulgariaSat-1","flight":42},{"name":"Falcon
93
93
  Heavy Test Flight","flight":55}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:426008/vessel:GO%20SEARCHER","image":"https://i.imgur.com/X4YQJZf.jpg"},{"ship_id":"HAWK","ship_name":"HAWK","ship_model":null,"ship_type":"Tug","roles":["ASDS
94
94
  Tug"],"active":true,"imo":9103295,"mmsi":366943250,"abs":1033239,"class":9523438,"weight_lbs":1120000,"weight_kg":508023,"year_built":1995,"home_port":"Port
95
- Canaveral","status":"Stopped","speed_kn":0.3,"course_deg":null,"position":{"latitude":27.95066,"longitude":-82.44254},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"SES-11
95
+ Canaveral","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":26.08241,"longitude":-80.11564},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"SES-11
96
96
  / Echostar 105","flight":49},{"name":"KoreaSat 5A","flight":50},{"name":"Falcon
97
97
  Heavy Test Flight","flight":55},{"name":"TESS","flight":60},{"name":"Telstar
98
98
  19V","flight":65},{"name":"Merah Putih","flight":67},{"name":"Telstar 18V","flight":68}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:430027/vessel:HAWK","image":"https://i.imgur.com/hGWWupT.jpg"},{"ship_id":"JRTI-1","ship_name":"Just
@@ -105,17 +105,17 @@ http_interactions:
105
105
  NEXT Mission 1","flight":35},{"name":"Iridium NEXT Mission 2","flight":43},{"name":"FormoSat-5","flight":46},{"name":"Iridium
106
106
  NEXT Mission 3","flight":48},{"name":"Iridium Next Mission 7","flight":66}],"url":null,"image":"https://i.imgur.com/7VMC0Gn.jpg"},{"ship_id":"KELLYC","ship_name":"Kelly
107
107
  C","ship_model":null,"ship_type":"Tug","roles":["ASDS Tug"],"active":false,"imo":null,"mmsi":367693690,"abs":null,"class":null,"weight_lbs":null,"weight_kg":null,"year_built":null,"home_port":"Port
108
- of Los Angeles","status":"Moored","speed_kn":0,"course_deg":null,"position":{"latitude":33.77139,"longitude":-118.2123},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"Iridium
108
+ of Los Angeles","status":"Moored","speed_kn":0,"course_deg":null,"position":{"latitude":33.77168,"longitude":-118.2117},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"Iridium
109
109
  NEXT Mission 2","flight":43}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:3718707/vessel:KELLY%20C","image":null},{"ship_id":"MRSTEVEN","ship_name":"MR
110
110
  STEVEN","ship_model":null,"ship_type":"High Speed Craft","roles":["Fairing
111
111
  Recovery"],"active":true,"imo":9744465,"mmsi":338358000,"abs":1249191,"class":15252765,"weight_lbs":992000,"weight_kg":449964,"year_built":2015,"home_port":"Port
112
- of Los Angeles","status":"Stopped","speed_kn":0.2,"course_deg":null,"position":{"latitude":33.73135,"longitude":-118.2712},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"KoreaSat
112
+ of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":33.73134,"longitude":-118.2712},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"KoreaSat
113
113
  5A","flight":50},{"name":"Paz / Starlink Demo","flight":56},{"name":"Iridium
114
114
  NEXT Mission 4","flight":52},{"name":"Iridium NEXT Mission 6","flight":62},{"name":"Iridium
115
115
  Next Mission 7","flight":66}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:3439091/vessel:MR%20STEVEN","image":"https://i.imgur.com/MtEgYbY.jpg"},{"ship_id":"NRCQUEST","ship_name":"NRC
116
116
  Quest","ship_model":null,"ship_type":"Cargo","roles":["Support Ship","Dragon
117
117
  Recovery"],"active":true,"imo":9271195,"mmsi":367486370,"abs":1134613,"class":2115909,"weight_lbs":972000,"weight_kg":440892,"year_built":2002,"home_port":"Port
118
- of Los Angeles","status":"Moored","speed_kn":0,"course_deg":null,"position":{"latitude":33.72164,"longitude":-118.2748},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-5","flight":19},{"name":"CRS-6","flight":22},{"name":"Jason-3","flight":26},{"name":"CRS-8","flight":28},{"name":"CRS-9","flight":32},{"name":"Iridium
118
+ of Los Angeles","status":"Moored","speed_kn":0,"course_deg":null,"position":{"latitude":33.72065,"longitude":-118.2744},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"CRS-5","flight":19},{"name":"CRS-6","flight":22},{"name":"Jason-3","flight":26},{"name":"CRS-8","flight":28},{"name":"CRS-9","flight":32},{"name":"Iridium
119
119
  NEXT Mission 1","flight":35},{"name":"CRS-10","flight":36},{"name":"Iridium
120
120
  NEXT Mission 2","flight":43},{"name":"CRS-11","flight":41},{"name":"CRS-12","flight":45},{"name":"CRS-13","flight":51},{"name":"CRS-14","flight":59},{"name":"Iridium
121
121
  Next Mission 7","flight":66},{"name":"CRS-15","flight":64}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:447294/vessel:NRC%20QUEST","image":"https://i.imgur.com/GvtuYUN.jpg"},{"ship_id":"OCISLY","ship_name":"Of
@@ -127,13 +127,13 @@ http_interactions:
127
127
  Heavy Test Flight","flight":55},{"name":"TESS","flight":60},{"name":"Bangabandhu-1","flight":61},{"name":"Telstar
128
128
  19V","flight":65},{"name":"Merah Putih","flight":67},{"name":"Telstar 18V","flight":68}],"url":null,"image":"https://i.imgur.com/28dCx6G.jpg"},{"ship_id":"PACIFICFREEDOM","ship_name":"Pacific
129
129
  Freeedom","ship_model":null,"ship_type":"Tug","roles":["ASDS Tug"],"active":true,"imo":null,"mmsi":367639830,"abs":570902,"class":7602544,"weight_lbs":198000,"weight_kg":89811,"year_built":1976,"home_port":"Port
130
- of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":32.69461,"longitude":-117.1512},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"Jason-3","flight":26},{"name":"Iridium
130
+ of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":32.69493,"longitude":-117.1509},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"Jason-3","flight":26},{"name":"Iridium
131
131
  Next Mission 7","flight":66}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:4249791/vessel:PACIFIC%20FREEDOM","image":"https://i.imgur.com/eJWx70Z.jpg"},{"ship_id":"PACIFICWARRIOR","ship_name":"Pacific
132
132
  Warrior","ship_model":null,"ship_type":"Tug","roles":["ASDS Tug"],"active":false,"imo":7641384,"mmsi":367008820,"abs":566282,"class":7434575,"weight_lbs":774000,"weight_kg":351080,"year_built":1974,"home_port":"Port
133
- of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":37.77478,"longitude":-122.3837},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"Iridium
133
+ of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":37.77477,"longitude":-122.3837},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"Iridium
134
134
  NEXT Mission 1","flight":35}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:434121/vessel:PACIFIC%20WARRIOR","image":"https://i.imgur.com/qdNDmYs.jpg"},{"ship_id":"RACHEL","ship_name":"RACHEL","ship_model":null,"ship_type":"Tug","roles":["ASDS
135
135
  Tug"],"active":false,"imo":7600378,"mmsi":367488370,"abs":576417,"class":7611785,"weight_lbs":688000,"weight_kg":312072,"year_built":1976,"home_port":"Port
136
- Canaveral","status":"Underway Using Engine","speed_kn":6.3,"course_deg":311,"position":{"latitude":9.895026,"longitude":-80.54215},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"Bangabandhu-1","flight":61}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:447352/vessel:RACHEL","image":"https://i.imgur.com/IpYJWUW.jpg"}]'
136
+ Canaveral","status":"Underway Using Engine","speed_kn":5.7,"course_deg":256,"position":{"latitude":29.67117,"longitude":-91.13429},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"Bangabandhu-1","flight":61}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:447352/vessel:RACHEL","image":"https://i.imgur.com/IpYJWUW.jpg"}]'
137
137
  http_version:
138
- recorded_at: Fri, 05 Oct 2018 19:00:12 GMT
138
+ recorded_at: Mon, 15 Oct 2018 03:46:32 GMT
139
139
  recorded_with: VCR 4.0.0
@@ -61,4 +61,65 @@ http_interactions:
61
61
  1","flight":7},{"name":"COTS 2","flight":8}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION","image":"https://i.imgur.com/woCxpkj.jpg"}'
62
62
  http_version:
63
63
  recorded_at: Fri, 05 Oct 2018 19:00:12 GMT
64
+ - request:
65
+ method: get
66
+ uri: https://api.spacexdata.com/v3/ships/AMERICANCHAMPION
67
+ body:
68
+ encoding: US-ASCII
69
+ string: ''
70
+ headers:
71
+ User-Agent:
72
+ - Faraday v0.15.3
73
+ Accept-Encoding:
74
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
75
+ Accept:
76
+ - "*/*"
77
+ response:
78
+ status:
79
+ code: 200
80
+ message: OK
81
+ headers:
82
+ Date:
83
+ - Thu, 11 Oct 2018 03:02:44 GMT
84
+ Content-Type:
85
+ - application/json; charset=utf-8
86
+ Transfer-Encoding:
87
+ - chunked
88
+ Connection:
89
+ - keep-alive
90
+ Set-Cookie:
91
+ - __cfduid=d437fef05110b7e6103aa3da28aa498611539226964; expires=Fri, 11-Oct-19
92
+ 03:02:44 GMT; path=/; domain=.spacexdata.com; HttpOnly; Secure
93
+ Vary:
94
+ - Accept-Encoding, Origin
95
+ X-Dns-Prefetch-Control:
96
+ - 'off'
97
+ X-Frame-Options:
98
+ - SAMEORIGIN
99
+ Strict-Transport-Security:
100
+ - max-age=15552000; includeSubDomains
101
+ X-Download-Options:
102
+ - noopen
103
+ X-Content-Type-Options:
104
+ - nosniff
105
+ X-Xss-Protection:
106
+ - 1; mode=block
107
+ Access-Control-Allow-Origin:
108
+ - "*"
109
+ X-Response-Time:
110
+ - 48ms
111
+ Expect-Ct:
112
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
113
+ Server:
114
+ - cloudflare
115
+ Cf-Ray:
116
+ - 467e16ede8d55a8c-BOS
117
+ body:
118
+ encoding: ASCII-8BIT
119
+ string: '{"ship_id":"AMERICANCHAMPION","ship_name":"American Champion","ship_model":null,"ship_type":"Tug","roles":["Support
120
+ Ship","Barge Tug"],"active":false,"imo":7434016,"mmsi":367020820,"abs":571252,"class":7604342,"weight_lbs":588000,"weight_kg":266712,"year_built":1976,"home_port":"Port
121
+ of Los Angeles","status":"Stopped","speed_kn":0,"course_deg":null,"position":{"latitude":30.52758,"longitude":-88.10258},"successful_landings":null,"attempted_landings":null,"missions":[{"name":"COTS
122
+ 1","flight":7},{"name":"COTS 2","flight":8}],"url":"https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION","image":"https://i.imgur.com/woCxpkj.jpg"}'
123
+ http_version:
124
+ recorded_at: Thu, 11 Oct 2018 03:02:44 GMT
64
125
  recorded_with: VCR 4.0.0
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe SPACEX::Capsules do
4
+ context '#info', vcr: { cassette_name: 'capsules' } do
5
+ subject do
6
+ SPACEX::Capsules.info
7
+ end
8
+ it 'returns an array of capsules ' do
9
+ expect(subject).to be_an Array
10
+ expect(subject.first.capsule_serial).to eq 'C201'
11
+ expect(subject.first.capsule_id).to eq 'dragon2'
12
+ expect(subject.first.status).to eq 'active'
13
+ expect(subject.first.original_launch).to eq nil
14
+ expect(subject.first.original_launch_unix).to eq nil
15
+ expect(subject.first.missions).to be_an(Array)
16
+ expect(subject.first.landings).to eq 0
17
+ expect(subject.first.type).to eq 'Dragon 2.0'
18
+ expect(subject.first.details).to start_with 'Pressure vessel used for Dragon 2 structural testing.'
19
+ end
20
+ end
21
+
22
+ context "#info('C202')", vcr: { cassette_name: 'capsules/C202' } do
23
+ subject do
24
+ SPACEX::Capsules.info('C202')
25
+ end
26
+ it 'return specific capsule details' do
27
+ expect(subject.capsule_serial).to eq 'C202'
28
+ expect(subject.capsule_id).to eq 'dragon2'
29
+ expect(subject.status).to eq 'active'
30
+ expect(subject.original_launch).to eq nil
31
+ expect(subject.original_launch_unix).to eq nil
32
+ expect(subject.missions).to be_an(Array)
33
+ expect(subject.landings).to eq 0
34
+ expect(subject.type).to eq 'Dragon 2.0'
35
+ expect(subject.details).to start_with "Capsule used to qualify Dragon 2's environmental control and life support systems."
36
+ end
37
+ end
38
+ end
@@ -1,9 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
1
  require 'spec_helper'
4
2
 
5
- describe SPACEX do
6
- context 'CompanyInfo', vcr: { cassette_name: 'company_info/info' } do
3
+ describe SPACEX::CompanyInfo do
4
+ context '#info', vcr: { cassette_name: 'company_info/info' } do
7
5
  subject do
8
6
  SPACEX::CompanyInfo.info
9
7
  end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe SPACEX::Cores do
4
+ context '#info', vcr: { cassette_name: 'cores' } do
5
+ subject do
6
+ SPACEX::Cores.info
7
+ end
8
+ it 'returns an array of cores ' do
9
+ expect(subject).to be_an Array
10
+ expect(subject.first.core_serial).to eq 'B1052'
11
+ expect(subject.first.block).to eq 5
12
+ expect(subject.first.status).to eq 'active'
13
+ expect(subject.first.original_launch).to eq nil
14
+ expect(subject.first.original_launch_unix).to eq nil
15
+ expect(subject.first.missions).to be_an(Array)
16
+ expect(subject.first.rtls_attempts).to eq 0
17
+ expect(subject.first.rtls_landings).to eq 0
18
+ expect(subject.first.asds_attempts).to eq 0
19
+ expect(subject.first.asds_landings).to eq 0
20
+ expect(subject.first.water_landing).to eq false
21
+ expect(subject.first.details).to start_with 'On test stand at McGregor.'
22
+ end
23
+ end
24
+
25
+ context "#info('B1041')", vcr: { cassette_name: 'cores/B1041' } do
26
+ subject do
27
+ SPACEX::Cores.info('B1041')
28
+ end
29
+ it 'returns details of core' do
30
+ expect(subject.core_serial).to eq 'B1041'
31
+ expect(subject.block).to eq 4
32
+ expect(subject.status).to eq 'expended'
33
+ expect(subject.original_launch).to eq '2017-10-09T12:37:00.000Z'
34
+ expect(subject.original_launch_unix).to eq 1_507_552_620
35
+ expect(subject.missions[1]['name']).to eq 'Iridium NEXT Mission 5'
36
+ expect(subject.missions[1]['flight']).to eq 58
37
+ expect(subject.rtls_attempts).to eq 0
38
+ expect(subject.rtls_landings).to eq 0
39
+ expect(subject.asds_attempts).to eq 1
40
+ expect(subject.asds_landings).to eq 1
41
+ expect(subject.water_landing).to eq false
42
+ expect(subject.details).to start_with 'Will fly expendable on Iridium NEXT Mission 5'
43
+ end
44
+ end
45
+ end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'byebug'
3
2
 
4
- describe SPACEX do
5
- context 'DragonCapsules', vcr: { cassette_name: 'dragon_capsules/info' } do
3
+ describe SPACEX::DragonCapsules do
4
+ context '#info', vcr: { cassette_name: 'dragon_capsules/info' } do
6
5
  subject do
7
6
  SPACEX::DragonCapsules.info
8
7
  end
@@ -48,17 +47,18 @@ describe SPACEX do
48
47
  expect(subject.first.diameter['meters']).to eq 3.7
49
48
  expect(subject.first.diameter['feet']).to eq 12
50
49
  expect(subject.first.wikipedia).to eq 'https://en.wikipedia.org/wiki/SpaceX_Dragon'
51
- expect(subject.first.description).to eq '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).'
50
+ expect(subject.first.description).to start_with 'Dragon is a reusable spacecraft developed'
52
51
 
53
52
  expect(subject[1].capsule_id).to eq 'dragon2'
54
53
  expect(subject[1].name).to eq 'Dragon 2'
55
54
  end
56
55
  end
57
56
 
58
- context 'Get specific Dragon Capsule', vcr: { cassette_name: 'dragon_capsules/info/dragon1' } do
57
+ context "#info('dragon1')", vcr: { cassette_name: 'dragon_capsules/info/dragon1' } do
59
58
  subject do
60
59
  SPACEX::DragonCapsules.info('dragon1')
61
60
  end
61
+
62
62
  it 'returns Dragon Capsule info for "dragon1"' do
63
63
  expect(subject.capsule_id).to eq 'dragon1'
64
64
  expect(subject.name).to eq 'Dragon 1'
@@ -101,7 +101,7 @@ describe SPACEX do
101
101
  expect(subject.diameter['meters']).to eq 3.7
102
102
  expect(subject.diameter['feet']).to eq 12
103
103
  expect(subject.wikipedia).to eq 'https://en.wikipedia.org/wiki/SpaceX_Dragon'
104
- expect(subject.description).to eq '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).'
104
+ expect(subject.description).to start_with 'Dragon is a reusable spacecraft developed by Space'
105
105
  end
106
106
  end
107
107
  end
@@ -1,12 +1,11 @@
1
- # frozen_string_literal: true
2
-
3
1
  require 'spec_helper'
4
2
 
5
- describe SPACEX do
6
- context 'Launches', vcr: { cassette_name: 'launches/latest' } do
3
+ describe SPACEX::Launches do
4
+ context '#latest', vcr: { cassette_name: 'launches/latest' } do
7
5
  subject do
8
6
  SPACEX::Launches.latest
9
7
  end
8
+
10
9
  it 'returns latest launch' do
11
10
  expect(subject.flight_number).to eq 67
12
11
  expect(subject.mission_name).to eq 'Merah Putih'
@@ -15,11 +14,9 @@ describe SPACEX do
15
14
  expect(subject.launch_date_utc).to eq '2018-08-07T05:18:00.000Z'
16
15
  expect(subject.launch_date_local).to eq '2018-08-07T01:18:00-04:00'
17
16
  expect(subject.launch_success).to eq true
18
-
19
17
  expect(subject.rocket.rocket_id).to eq 'falcon9'
20
18
  expect(subject.rocket.rocket_name).to eq 'Falcon 9'
21
19
  expect(subject.rocket.rocket_type).to eq 'FT'
22
-
23
20
  expect(subject.rocket.first_stage.cores.first.core_serial).to eq 'B1046'
24
21
  expect(subject.rocket.first_stage.cores.first.flight).to eq 2
25
22
  expect(subject.rocket.first_stage.cores.first.block).to eq 5
@@ -27,9 +24,7 @@ describe SPACEX do
27
24
  expect(subject.rocket.first_stage.cores.first.land_success).to eq true
28
25
  expect(subject.rocket.first_stage.cores.first.landing_type).to eq 'ASDS'
29
26
  expect(subject.rocket.first_stage.cores.first.landing_vehicle).to eq 'OCISLY'
30
-
31
27
  expect(subject.rocket.second_stage.block).to eq 5
32
-
33
28
  expect(subject.rocket.second_stage.payloads.first.payload_id).to eq 'Telkom-4'
34
29
  expect(subject.rocket.second_stage.payloads.first.norad_id.first).to eq 43_587
35
30
  expect(subject.rocket.second_stage.payloads.first.reused).to eq false
@@ -40,8 +35,6 @@ describe SPACEX do
40
35
  expect(subject.rocket.second_stage.payloads.first.payload_mass_kg).to eq 5800
41
36
  expect(subject.rocket.second_stage.payloads.first.payload_mass_lbs).to eq 12_786.81
42
37
  expect(subject.rocket.second_stage.payloads.first.orbit).to eq 'GTO'
43
-
44
- expect(subject.rocket.second_stage.payloads.first.orbit_params.reference_system).to eq 'geocentric'
45
38
  expect(subject.rocket.second_stage.payloads.first.orbit_params.regime).to eq 'geostationary'
46
39
  expect(subject.rocket.second_stage.payloads.first.orbit_params.longitude).to eq '-108'.to_i
47
40
  expect(subject.rocket.second_stage.payloads.first.orbit_params.semi_major_axis_km).to eq 21_226.178
@@ -54,20 +47,16 @@ describe SPACEX do
54
47
  expect(subject.rocket.second_stage.payloads.first.orbit_params.epoch).to eq '2018-08-07T06:57:16.000Z'
55
48
  expect(subject.rocket.second_stage.payloads.first.orbit_params.mean_motion).to eq 2.80734018
56
49
  expect(subject.rocket.second_stage.payloads.first.orbit_params.raan).to eq 227.0228
57
-
58
50
  expect(subject.telemetry.flight_club).to eq nil
59
51
  expect(subject.reuse.core).to eq true
60
52
  expect(subject.reuse.sire_core1).to eq nil
61
53
  expect(subject.reuse.side_core2).to eq false
62
54
  expect(subject.reuse.fairings).to eq false
63
55
  expect(subject.reuse.capsule).to eq false
64
-
65
56
  expect(subject.launch_site.site_id).to eq 'ccafs_slc_40'
66
57
  expect(subject.launch_site.site_name).to eq 'CCAFS SLC 40'
67
58
  expect(subject.launch_site.site_name_long).to eq 'Cape Canaveral Air Force Station Space Launch Complex 40'
68
-
69
59
  expect(subject.launch_success).to eq true
70
-
71
60
  expect(subject.links.mission_patch).to eq 'https://images2.imgbox.com/a8/f5/ZgdsrbqW_o.png'
72
61
  expect(subject.links.mision_patch_small).to eq nil
73
62
  expect(subject.links.reddit_campaign).to eq 'https://www.reddit.com/r/spacex/comments/91gwfg/merah_putih_telkom4_launch_campaign_thread/'
@@ -78,10 +67,211 @@ describe SPACEX do
78
67
  expect(subject.links.article_link).to eq 'https://spaceflightnow.com/2018/08/07/indonesian-communications-satellite-deployed-in-orbit-by-spacex/'
79
68
  expect(subject.links.wikipedia).to eq 'https://en.wikipedia.org/wiki/Telkom_Indonesia'
80
69
  expect(subject.links.video_link).to eq 'https://www.youtube.com/watch?v=FjfQNBYv2IY'
81
-
82
70
  expect(subject.details).to eq 'Indonesian comsat intended to replace the aging Telkom 1 at 108° E. First reflight of a Block 5-version booster.'
83
71
  expect(subject.upcoming).to eq false
84
72
  expect(subject.static_fire_date_utc).to eq '2018-08-02T15:53:00.000Z'
85
73
  end
86
74
  end
75
+
76
+ context '#info', vcr: { cassette_name: 'launches' } do
77
+ subject do
78
+ SPACEX::Launches.info
79
+ end
80
+
81
+ it 'returns and array of launch hashes' do
82
+ expect(subject).to be_an Array
83
+ expect(subject.first).to be_a Hash
84
+ end
85
+
86
+ it 'returns the correct number of launches' do
87
+ expect(subject.count).to eq 90
88
+ end
89
+
90
+ it 'returns the subject.first launch' do
91
+ expect(subject.first.flight_number).to eq 1
92
+ expect(subject.first.mission_name).to eq 'FalconSat'
93
+ expect(subject.first.launch_year).to eq '2006'
94
+ expect(subject.first.launch_date_unix).to eq 1_143_239_400
95
+ expect(subject.first.launch_date_utc).to eq '2006-03-24T22:30:00.000Z'
96
+ expect(subject.first.launch_date_local).to eq '2006-03-25T10:30:00+12:00'
97
+ expect(subject.first.launch_success).to eq false
98
+ expect(subject.first.rocket.rocket_id).to eq 'falcon1'
99
+ expect(subject.first.rocket.rocket_name).to eq 'Falcon 1'
100
+ expect(subject.first.rocket.rocket_type).to eq 'Merlin A'
101
+ expect(subject.first.rocket.first_stage.cores.first.core_serial).to eq 'Merlin1A'
102
+ expect(subject.first.rocket.first_stage.cores.first.flight).to eq 1
103
+ expect(subject.first.rocket.first_stage.cores.first.block).to eq nil
104
+ expect(subject.first.rocket.first_stage.cores.first.reused).to eq false
105
+ expect(subject.first.rocket.first_stage.cores.first.land_success).to eq nil
106
+ expect(subject.first.rocket.first_stage.cores.first.landing_type).to eq nil
107
+ expect(subject.first.rocket.first_stage.cores.first.landing_vehicle).to eq nil
108
+ expect(subject.first.rocket.second_stage.block).to eq 1
109
+ expect(subject.first.rocket.second_stage.payloads.first.payload_id).to eq 'FalconSAT-2'
110
+ expect(subject.first.rocket.second_stage.payloads.first.norad_id.first).to eq nil
111
+ expect(subject.first.rocket.second_stage.payloads.first.reused).to eq false
112
+ expect(subject.first.rocket.second_stage.payloads.first.customers.first).to eq 'DARPA'
113
+ expect(subject.first.rocket.second_stage.payloads.first.nationality).to eq 'United States'
114
+ expect(subject.first.rocket.second_stage.payloads.first.manufacturer).to eq 'SSTL'
115
+ expect(subject.first.rocket.second_stage.payloads.first.payload_type).to eq 'Satellite'
116
+ expect(subject.first.rocket.second_stage.payloads.first.payload_mass_kg).to eq 20
117
+ expect(subject.first.rocket.second_stage.payloads.first.payload_mass_lbs).to eq 43
118
+ expect(subject.first.rocket.second_stage.payloads.first.orbit).to eq 'LEO'
119
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.reference_system).to eq 'geocentric'
120
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.regime).to eq 'low-earth'
121
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.longitude).to eq nil
122
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.semi_major_axis_km).to eq nil
123
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.eccentricity).to eq nil
124
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.periapsis_km).to eq 400
125
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.apoapsis_km).to eq 500
126
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.inclination_deg).to eq 39
127
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.period_min).to eq nil
128
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.lifespan_years).to eq nil
129
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.epoch).to eq nil
130
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.mean_motion).to eq nil
131
+ expect(subject.first.rocket.second_stage.payloads.first.orbit_params.raan).to eq nil
132
+ expect(subject.first.telemetry.flight_club).to eq nil
133
+ expect(subject.first.reuse).to be_nil
134
+ expect(subject.first.launch_site.site_id).to eq 'kwajalein_atoll'
135
+ expect(subject.first.launch_site.site_name).to eq 'Kwajalein Atoll'
136
+ expect(subject.first.launch_site.site_name_long).to eq 'Kwajalein Atoll Omelek Island'
137
+ expect(subject.first.launch_success).to eq false
138
+ expect(subject.first.links.mission_patch).to eq 'https://images2.imgbox.com/40/e3/GypSkayF_o.png'
139
+ expect(subject.first.links.mision_patch_small).to eq nil
140
+ expect(subject.first.links.reddit_campaign).to eq nil
141
+ expect(subject.first.links.reddit_launch).to eq nil
142
+ expect(subject.first.links.reddit_recovery).to eq nil
143
+ expect(subject.first.links.reddit_media).to eq nil
144
+ expect(subject.first.links.presskit).to eq nil
145
+ expect(subject.first.links.article_link).to eq 'https://www.space.com/2196-spacex-inaugural-falcon-1-rocket-lost-launch.html'
146
+ expect(subject.first.links.wikipedia).to eq 'https://en.wikipedia.org/wiki/DemoSat'
147
+ expect(subject.first.links.video_link).to eq 'https://www.youtube.com/watch?v=0a_00nJ_Y88'
148
+ expect(subject.first.details).to eq 'Engine failure at 33 seconds and loss of vehicle'
149
+ expect(subject.first.upcoming).to eq false
150
+ expect(subject.first.static_fire_date_utc).to eq '2006-03-17T00:00:00.000Z'
151
+ end
152
+
153
+ it 'returns the subject.last scheduled launch' do
154
+ expect(subject.last.flight_number).to eq 90
155
+ expect(subject.last.mission_name).to eq 'GPS IIIA-3'
156
+ expect(subject.last.launch_year).to eq '2019'
157
+ expect(subject.last.launch_date_unix).to eq 1_569_888_000
158
+ expect(subject.last.launch_date_utc).to eq '2019-10-01T00:00:00.000Z'
159
+ expect(subject.last.launch_date_local).to eq '2019-09-30T20:00:00-04:00'
160
+ expect(subject.last.launch_success).to eq nil
161
+ expect(subject.last.rocket.rocket_id).to eq 'falcon9'
162
+ expect(subject.last.rocket.rocket_name).to eq 'Falcon 9'
163
+ expect(subject.last.rocket.rocket_type).to eq 'FT'
164
+ expect(subject.last.rocket.last_stage).to be_nil
165
+ expect(subject.last.rocket.second_stage.block).to eq nil
166
+ expect(subject.last.rocket.second_stage.payloads.last.payload_id).to eq 'GPS IIIA-3'
167
+ expect(subject.last.rocket.second_stage.payloads.last.norad_id.last).to eq nil
168
+ expect(subject.last.rocket.second_stage.payloads.last.reused).to eq false
169
+ expect(subject.last.rocket.second_stage.payloads.last.customers.last).to eq 'USAF'
170
+ expect(subject.last.rocket.second_stage.payloads.last.nationality).to eq 'United States'
171
+ expect(subject.last.rocket.second_stage.payloads.last.manufacturer).to eq 'Lockheed Martin'
172
+ expect(subject.last.rocket.second_stage.payloads.last.payload_type).to eq 'Satellite'
173
+ expect(subject.last.rocket.second_stage.payloads.last.payload_mass_kg).to eq 3880
174
+ expect(subject.last.rocket.second_stage.payloads.last.payload_mass_lbs).to eq 8553.94
175
+ expect(subject.last.rocket.second_stage.payloads.last.orbit).to eq 'MEO'
176
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.reference_system).to eq nil
177
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.regime).to eq nil
178
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.longitude).to eq nil
179
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.semi_major_axis_km).to eq nil
180
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.eccentricity).to eq nil
181
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.periapsis_km).to eq nil
182
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.apoapsis_km).to eq nil
183
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.inclination_deg).to eq nil
184
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.period_min).to eq nil
185
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.lifespan_years).to eq 15
186
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.epoch).to eq nil
187
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.mean_motion).to eq nil
188
+ expect(subject.last.rocket.second_stage.payloads.last.orbit_params.raan).to eq nil
189
+ expect(subject.last.telemetry.flight_club).to eq nil
190
+ expect(subject.last.reuse).to be_nil
191
+ expect(subject.last.launch_site.site_id).to eq 'ccafs_slc_40'
192
+ expect(subject.last.launch_site.site_name).to eq 'CCAFS SLC 40'
193
+ expect(subject.last.launch_site.site_name_long).to eq 'Cape Canaveral Air Force Station Space Launch Complex 40'
194
+ expect(subject.last.launch_success).to eq nil
195
+ expect(subject.last.links.mission_patch).to eq nil
196
+ expect(subject.last.links.mision_patch_small).to eq nil
197
+ expect(subject.last.links.reddit_campaign).to eq nil
198
+ expect(subject.last.links.reddit_launch).to eq nil
199
+ expect(subject.last.links.reddit_recovery).to eq nil
200
+ expect(subject.last.links.reddit_media).to eq nil
201
+ expect(subject.last.links.presskit).to eq nil
202
+ expect(subject.last.links.article_link).to eq nil
203
+ expect(subject.last.links.wikipedia).to eq nil
204
+ expect(subject.last.links.video_link).to eq nil
205
+ expect(subject.last.details).to eq nil
206
+ expect(subject.last.upcoming).to eq true
207
+ expect(subject.last.static_fire_date_utc).to eq nil
208
+ end
209
+ end
210
+
211
+ context '#next', vcr: { cassette_name: 'launches/next' } do
212
+ subject do
213
+ SPACEX::Launches.next
214
+ end
215
+
216
+ it 'returns next launch' do
217
+ expect(subject.flight_number).to eq 70
218
+ expect(subject.mission_name).to eq 'Es’hail 2'
219
+ expect(subject.launch_year).to eq '2018'
220
+ expect(subject.launch_date_unix).to eq 1_541_030_400
221
+ expect(subject.launch_date_utc).to eq '2018-11-01T00:00:00.000Z'
222
+ expect(subject.launch_date_local).to eq '2018-10-31T20:00:00-04:00'
223
+ expect(subject.launch_success).to eq nil
224
+ expect(subject.rocket.rocket_id).to eq 'falcon9'
225
+ expect(subject.rocket.rocket_name).to eq 'Falcon 9'
226
+ expect(subject.rocket.rocket_type).to eq 'FT'
227
+ expect(subject.rocket.first_stage.cores.first.core_serial).to eq nil
228
+ expect(subject.rocket.first_stage.cores.first.flight).to eq nil
229
+ expect(subject.rocket.first_stage.cores.first.block).to eq 5
230
+ expect(subject.rocket.first_stage.cores.first.reused).to eq false
231
+ expect(subject.rocket.first_stage.cores.first.land_success).to eq nil
232
+ expect(subject.rocket.first_stage.cores.first.landing_type).to eq nil
233
+ expect(subject.rocket.first_stage.cores.first.landing_vehicle).to eq nil
234
+ expect(subject.rocket.second_stage.block).to eq 5
235
+ expect(subject.rocket.second_stage.payloads.first.payload_id).to eq 'Es’hail 2'
236
+ expect(subject.rocket.second_stage.payloads.first.norad_id.first).to eq nil
237
+ expect(subject.rocket.second_stage.payloads.first.reused).to eq false
238
+ expect(subject.rocket.second_stage.payloads.first.customers.first).to eq 'Es’hailSat'
239
+ expect(subject.rocket.second_stage.payloads.first.nationality).to eq 'Qatar'
240
+ expect(subject.rocket.second_stage.payloads.first.manufacturer).to eq 'Mitsubishi Electric'
241
+ expect(subject.rocket.second_stage.payloads.first.payload_type).to eq 'Satellite'
242
+ expect(subject.rocket.second_stage.payloads.first.payload_mass_kg).to eq 3000
243
+ expect(subject.rocket.second_stage.payloads.first.payload_mass_lbs).to eq 6_613.868
244
+ expect(subject.rocket.second_stage.payloads.first.orbit).to eq 'GTO'
245
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.regime).to eq 'geostationary'
246
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.longitude).to eq 25.5
247
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.semi_major_axis_km).to eq nil
248
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.eccentricity).to eq nil
249
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.periapsis_km).to eq nil
250
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.apoapsis_km).to eq nil
251
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.inclination_deg).to eq nil
252
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.period_min).to eq nil
253
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.lifespan_years).to eq 15
254
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.epoch).to eq nil
255
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.mean_motion).to eq nil
256
+ expect(subject.rocket.second_stage.payloads.first.orbit_params.raan).to eq nil
257
+ expect(subject.telemetry.flight_club).to eq nil
258
+ expect(subject.launch_site.site_id).to eq 'ccafs_slc_40'
259
+ expect(subject.launch_site.site_name).to eq 'CCAFS SLC 40'
260
+ expect(subject.launch_site.site_name_long).to eq 'Cape Canaveral Air Force Station Space Launch Complex 40'
261
+ expect(subject.launch_success).to eq nil
262
+ expect(subject.links.mission_patch).to eq nil
263
+ expect(subject.links.mision_patch_small).to eq nil
264
+ expect(subject.links.reddit_campaign).to eq nil
265
+ expect(subject.links.reddit_launch).to eq nil
266
+ expect(subject.links.reddit_recovery).to eq nil
267
+ expect(subject.links.reddit_media).to eq nil
268
+ expect(subject.links.presskit).to eq nil
269
+ expect(subject.links.article_link).to eq nil
270
+ expect(subject.links.wikipedia).to eq nil
271
+ expect(subject.links.video_link).to eq nil
272
+ expect(subject.details).to eq nil
273
+ expect(subject.upcoming).to eq true
274
+ expect(subject.static_fire_date_utc).to eq nil
275
+ end
276
+ end
87
277
  end