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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34d0f69775d8b88dc1ae18095c0f0bdb56b26d79
4
+ data.tar.gz: 572954573b7371c0bc4d7b90f686d23be4a9da9f
5
+ SHA512:
6
+ metadata.gz: 1474c8fb7d0fa7a9bc182b5031cf42ab5b81e9da553e2a9a71c114043cef62fcb6d3b0d5bd369dc68902a9c748a7f84b5328f04f0cda44a5f6aafcc7a0562d15
7
+ data.tar.gz: c46d6c09a8848cd5d19168ff70af8a1048945d730debf141e8e1da7cabd21861fbd0aefaaa43d1f34e12bb91cc7d9956858ab3b0e777a4dc7c3c495eff5e3221
@@ -0,0 +1,53 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ *.gem
53
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,14 @@
1
+ AllCops:
2
+ Exclude:
3
+ - vendor/**/*
4
+
5
+ Naming/MethodName:
6
+ Enabled: false
7
+
8
+ Style/FrozenStringLiteralComment:
9
+ Enabled: false
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ inherit_from: .rubocop_todo.yml
@@ -0,0 +1,24 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-11-01 20:09:44 -0400 using RuboCop version 0.51.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 4
10
+ Lint/ParenthesesAsGroupedExpression:
11
+ Exclude:
12
+ - 'spec/spacex/dragon_capsules_spec.rb'
13
+ - 'spec/spacex/ships_spec.rb'
14
+
15
+ # Offense count: 36
16
+ # Configuration parameters: CountComments, ExcludedMethods.
17
+ Metrics/BlockLength:
18
+ Max: 625
19
+
20
+ # Offense count: 136
21
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
22
+ # URISchemes: http, https
23
+ Metrics/LineLength:
24
+ Max: 264
@@ -0,0 +1 @@
1
+ 2.4.1
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+
3
+ cache: bundler
4
+
5
+ rvm:
6
+ - 2.4.1
@@ -0,0 +1,53 @@
1
+ ### 1.0.2 (next)
2
+
3
+ * Your contribution here.
4
+
5
+
6
+ ### 1.0.1
7
+
8
+ * [#45](https://github.com/rodolfobandeira/spacex/pull/45): Implement History endpoint [@invacuo](http://github.com/invacuo).
9
+ * [#48](https://github.com/rodolfobandeira/spacex/pull/48): Add ability to query specific Launch via `.info('flight_number')` - [@mtking2](http://github.com/mtking2).
10
+ * [#51](https://github.com/rodolfobandeira/spacex/pull/51): Added payloads endpoint [@maiafernando](http://github.com/maiafernando).
11
+ * [#52](https://github.com/rodolfobandeira/spacex/pull/52): Add ability to query Past Launches - [@mtking2](http://github.com/mtking2).
12
+ * [#54](https://github.com/rodolfobandeira/spacex/pull/54): Refactor ENDPOINT_URI - [@ludamillion](http://github.com/ludamillion).
13
+ * [#56](https://github.com/rodolfobandeira/spacex/pull/56): Add ability to query upcoming launches - [@mtking2](http://github.com/mtking2).
14
+
15
+
16
+ ### 1.0.0 (2018/10/15)
17
+
18
+ * [#41](https://github.com/rodolfobandeira/spacex/pull/41): General Refactor cleaning endpoint classes [@invacuo](http://github.com/invacuo).
19
+ * [#44](https://github.com/rodolfobandeira/spacex/pull/44): Add flickr_images key into rockets endpoint [@Dfenniak](https://github.com/Dfenniak).
20
+ * [#42](https://github.com/rodolfobandeira/spacex/pull/42): Add pry gem to debug - [@Dfenniak](https://github.com/Dfenniak).
21
+ * [#40](https://github.com/rodolfobandeira/spacex/pull/40): Update and clarify information in README - [@annawinkler](https://github.com/annawinkler).
22
+ * [#34](https://github.com/rodolfobandeira/spacex/pull/34): Implement Capsules endpoint - [@efl7a](https://github.com/efl7a).
23
+ * [#34](https://github.com/rodolfobandeira/spacex/pull/34): Implement Cores endpoint - [@efl7a](https://github.com/efl7a).
24
+ * [#35](https://github.com/rodolfobandeira/spacex/pull/35): Implement Rockets endpoint - [@invacuo](https://github.com/invacuo).
25
+ * [#28](https://github.com/rodolfobandeira/spacex/pull/28): Add ability to query all launches - [@ludamillion](https://github.com/ludamillion).
26
+ * [#26](https://github.com/rodolfobandeira/spacex/pull/26): Fix dependencies - [@harman28](https://github.com/harman28).
27
+ * [#25](https://github.com/rodolfobandeira/spacex/pull/25): Add code coverage tools - [@harman28](https://github.com/harman28).
28
+ * [#27](https://github.com/rodolfobandeira/spacex/pull/27): Add ability to query next launch - [@Andrey-Raspopov](https://github.com/Andrey-Raspopov)
29
+
30
+
31
+ ### 0.0.7 (2018/10/07)
32
+
33
+ * Refactor responses getting multiple objects like Ships, Capsules to wrap a specific object. This helps translating specific properties like `id` and `class` to `ship_id`, `ship_class` - [@rodolfobandeira](https://github.com/rodolfobandeira).
34
+ * Add ability to retrieve specific Ship via `.info('ship_id')` - [@rodolfobandeira](https://github.com/rodolfobandeira).
35
+ * Add ability to retrieve specific Dragon Capsule via `.info('dragon_id')` - [@rodolfobandeira](https://github.com/rodolfobandeira).
36
+ * [#10](https://github.com/rodolfobandeira/spacex/pull/10): Added Ships information - [@zainalmustofa](https://github.com/zainalmustofa).
37
+ * [#9](https://github.com/rodolfobandeira/spacex/pull/9): Added Dragon Capsules information - [@JackieCalapristi](https://github.com/JackieCalapristi).
38
+ * [#16](https://github.com/rodolfobandeira/spacex/pull/16): Added missions information - [@maiafernando](https://github.com/maiafernando).
39
+
40
+
41
+ ### 0.0.6 (2018/08/22)
42
+
43
+ * Added Roadster information - [@rodolfobandeira](https://github.com/rodolfobandeira).
44
+
45
+
46
+ ### 0.0.5 (2018/08/21)
47
+
48
+ * Added Company information and General Refactors - [@rodolfobandeira](https://github.com/rodolfobandeira).
49
+
50
+
51
+ ### 0.0.4 (2018/08/21)
52
+
53
+ * Initial public release - [@rodolfobandeira](https://github.com/rodolfobandeira).
@@ -0,0 +1,35 @@
1
+ ## How to Contribute to the SpaceX gem?
2
+
3
+ ### Fork the repository
4
+
5
+ ```
6
+ git clone https://github.com/rodolfobandeira/spacex.git
7
+ cd spacex
8
+ git remote add upstream https://github.com/rodolfobandeira/spacex.git
9
+ bundle install
10
+ ```
11
+
12
+ ### Write test
13
+
14
+ We use `rspec`. After writing your tests, you can run tests with the following command:
15
+
16
+ `bundle exec rspec`
17
+
18
+
19
+ ### Write your code
20
+
21
+ Write your code to make your tests pass. After that, make sure you run `Rubocop` like this:
22
+
23
+ `bundle exec rubocop`
24
+
25
+ Sometimes errors can be fixed by running:
26
+
27
+ `bundle exec rubocop -a`
28
+
29
+ ### Update the CHANGELOG with the description of your code and your name
30
+
31
+ Update the CHANGELOG with the description of your code and your name on the line after `"* Your contribution here"`.
32
+
33
+ ### Push your change and open a pull request
34
+
35
+ Thank you!
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+ group :test do
3
+ gem 'byebug'
4
+ gem 'pry'
5
+ end
6
+
7
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Rodolfo Bandeira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,495 @@
1
+ SpaceX Ruby Client
2
+ ===============
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/spacex.svg)](https://badge.fury.io/rb/spacex)
5
+ [![Build Status](https://travis-ci.com/rodolfobandeira/spacex.svg?branch=master)](https://travis-ci.org/rodolfobandeira/spacex)
6
+ [![Coverage Status](https://coveralls.io/repos/github/rodolfobandeira/spacex/badge.svg?branch=master)](https://coveralls.io/github/rodolfobandeira/spacex?branch=master)
7
+
8
+ A Ruby library that consumes the [SpaceX API](https://github.com/r-spacex/SpaceX-API).
9
+
10
+
11
+ ## Table of Contents
12
+
13
+ - [Installation](#installation)
14
+ - [Usage](#usage)
15
+ - [Capsules](#capsules)
16
+ - `SPACEX::Capsules.info`
17
+ - `SPACEX::Capsules.info('capsule_serial')`
18
+ - [Company Info](#company-info)
19
+ - `SPACEX::CompanyInfo.info`
20
+ - [Cores](#cores)
21
+ - `SPACEX::Cores.info`
22
+ - `SPACEX::Cores.info('core_serial')`
23
+ - [Dragon Capsules](#dragon-capsules)
24
+ - `SPACEX::DragonCapsules.info`
25
+ - `SPACEX::DragonCapsules.info('dragon_id')`
26
+ - [History](#history)
27
+ - `SPACEX::History.info`
28
+ - `SPACEX::History.info(4)`
29
+ - [Launches](#launches)
30
+ - `SPACEX::Launches.all`
31
+ - `SPACEX::Launches.info`
32
+ - `SPACEX::Launches.info('flight_number')`
33
+ - `SPACEX::Launches.latest`
34
+ - `SPACEX::Launches.next`
35
+ - `SPACEX::Launches.past`
36
+ - [Missions](#missions)
37
+ - `SPACEX::Missions.info`
38
+ - `SPACEX::Missions.info('mission_id')`
39
+ - [Payloads](#payloads)
40
+ - `SPACEX::Payloads.info`
41
+ - `SPACEX::Payloads.info('payload_id')`
42
+ - [Roadster](#roadster)
43
+ - `SPACEX::Roadster.info`
44
+ - [Rockets](#rockets)
45
+ - `SPACEX::Rockets.info`
46
+ - `SPACEX::Rockets.info('falcon1')`
47
+ - [Ships](#ships)
48
+ - `SPACEX::Ships.info`
49
+ - `SPACEX::Ships.info('ship_id')`
50
+ - [Contributing](#contributing)
51
+ - [Copyright](#copyright)
52
+
53
+
54
+ ## Installation
55
+
56
+ Add the gem to your Gemfile:
57
+
58
+ ```
59
+ gem 'spacex'
60
+ ```
61
+
62
+ Then run `bundle install`.
63
+
64
+
65
+ ## Usage
66
+
67
+ ### Capsules
68
+
69
+ - Get information for all capsules: `SPACEX::Capsules.info`
70
+ - Get information about a specific capsule: `SPACEX::Capsules.info('capsule_serial')`
71
+
72
+ This example shows how to get capsule information and what the data fields are for that object:
73
+
74
+ ```ruby
75
+ capsules_info = SPACEX::Capsules.info
76
+
77
+ capsules_info.first.capsule_id # 'dragon2'
78
+ capsules_info.first.capsule_serial # 'C201'
79
+ capsules_info.first.details # 'Pressure vessel used for Dragon 2 structural testing. Rumored to be repurposed for first Red Dragon Mission'
80
+ capsules_info.first.landings # 0
81
+ capsules_info.first.missions # []
82
+ capsules_info.first.original_launch # nil capsules_info.first.original_launch_unix # nil
83
+ capsules_info.first.status # 'active'
84
+ capsules_info.first.type # 'Dragon 2.0'
85
+ ```
86
+
87
+ ### Company Info
88
+
89
+ - Get information about the company: `SPACEX::CompanyInfo.info`
90
+
91
+ Here is an example of the company information:
92
+
93
+ ```ruby
94
+ company_info = SPACEX::CompanyInfo.info
95
+
96
+ company_info.name # 'SpaceX'
97
+ company_info.founder # 'Elon Musk'
98
+ company_info.founded # 2002
99
+ company_info.employees # 7000
100
+ company_info.vehicles # 3
101
+ company_info.launche_sites # nil
102
+ company_info.test_sites # 1
103
+ company_info.ceo # 'Elon Musk'
104
+ company_info.cto # 'Elon Musk'
105
+ company_info.coo # 'Gwynne Shotwell'
106
+ company_info.cto_propulsion # 'Tom Mueller'
107
+ company_info.valuation # 15_000_000_000
108
+ company_info.headquarters.address # 'Rocket Road'
109
+ company_info.headquarters.city # 'Hawthorne'
110
+ company_info.headquarters.state # 'California'
111
+ company_info.summary # 'SpaceX designs, manufactures and launches advanced rockets and spacecraft. The company was founded in 2002 to revolutionize space technology, with the ultimate goal of enabling people to live on other planets.'
112
+ ```
113
+
114
+ ### Cores
115
+
116
+ - Get information for all cores: `SPACEX::Cores.info`
117
+ - Get information about a specific core: `SPACEX::Cores.info('core_serial')`
118
+
119
+ The following code snippet shows how to get the cores information and what the data fields are for a single core:
120
+
121
+ ```ruby
122
+ cores_info = SPACEX::Cores.info
123
+
124
+ cores_info.first.asds_attempts # 0
125
+ cores_info.first.asds_landings # 0
126
+ cores_info.first.block # 5
127
+ cores_info.first.core_serial # 'B1052'
128
+ cores_info.first.details # 'On test stand at McGregor'
129
+ cores_info.first.missions # []
130
+ cores_info.first.original_launch # nil
131
+ cores_info.first.original_launch_unix # nil
132
+ cores_info.first.rtls_attempts # 0
133
+ cores_info.first.rtls_landings # 0
134
+ cores_info.first.status # 'active'
135
+ cores_info.first.water_landing # false
136
+ ```
137
+
138
+ ### Dragon Capsules
139
+
140
+ - Get information for all dragon capsules: `SPACEX::DragonCapsules.info`
141
+ - Get information about a specific dragon capsule: `SPACEX::DragonCapsules.info('dragon_id')`
142
+
143
+ This code snippet shows the `dragon1` dragon capsule information:
144
+
145
+ ```ruby
146
+ dragon_capsules = SPACEX::DragonCapsules.info
147
+
148
+ dragon_capsules.first.capsule_id # "dragon1"
149
+ dragon_capsules.first.name # "Dragon 1"
150
+ dragon_capsules.first.type # "capsule"
151
+ dragon_capsules.first.active # true
152
+ dragon_capsules.first.crew_capacity # 0
153
+ dragon_capsules.first.sidewall_angle_deg # 15
154
+ dragon_capsules.first.orbit_duration_yr # 2
155
+ dragon_capsules.first.dry_mass_kg # 4200
156
+ dragon_capsules.first.dry_mass_lb # 9300
157
+ dragon_capsules.first.first_flight # "2010-12-08"
158
+ dragon_capsules.first.heat_shield['material'] # "PICA-X"
159
+ dragon_capsules.first.heat_shield['size_meters'] # 3.6
160
+ dragon_capsules.first.heat_shield['temp_degrees'] # 3000
161
+ dragon_capsules.first.heat_shield['dev_partner'] # "NASA"
162
+ dragon_capsules.first.thrusters[0]['type'] # "Draco"
163
+ dragon_capsules.first.thrusters[0]['amount'] # 18
164
+ dragon_capsules.first.thrusters[0]['pods'] # 4
165
+ dragon_capsules.first.thrusters[0]['fuel_1'] # "nitrogen tetroxide"
166
+ dragon_capsules.first.thrusters[0]['fuel_2'] # "monomethylhydrazine"
167
+ dragon_capsules.first.thrusters[0]['thrust']['kN'] # 0.4
168
+ dragon_capsules.first.thrusters[0]['thrust']['lbf'] # 90
169
+ dragon_capsules.first.launch_payload_mass['kg'] # 6000
170
+ dragon_capsules.first.launch_payload_mass['lb'] # 13228
171
+ dragon_capsules.first.launch_payload_vol['cubic_meters'] # 25
172
+ dragon_capsules.first.launch_payload_vol['cubic_feet'] # 883
173
+ dragon_capsules.first.return_payload_mass['kg'] # 3000
174
+ dragon_capsules.first.return_payload_mass['lb'] # 6614
175
+ dragon_capsules.first.return_payload_vol['cubic_meters'] # 11
176
+ dragon_capsules.first.return_payload_vol['cubic_feet'] # 388
177
+ dragon_capsules.first.pressurized_capsule['payload_volume']['cubic_meters']) # 11
178
+ dragon_capsules.first.pressurized_capsule['payload_volume']['cubic_feet'] # 388
179
+ dragon_capsules.first.trunk['trunk_volume['cubic_meters'] # 14
180
+ dragon_capsules.first.trunk['trunk_volume['cubic_feet'] # 494
181
+ dragon_capsules.first.trunk['cargo']['solar_array'] # 2
182
+ dragon_capsules.first.trunk['cargo']['unpressurized_cargo'] # true
183
+ dragon_capsules.first.height_w_trunk['meters'] # 7.2
184
+ dragon_capsules.first.height_w_trunk['feet'] # 23.6
185
+ dragon_capsules.first.diameter['meters'] # 3.7
186
+ dragon_capsules.first.diameter['feet'] # 12
187
+ dragon_capsules.first.wikipedia # "https://en.wikipedia.org/wiki/SpaceX_Dragon"
188
+ dragon_capsules.first.description # "Dragon is a reusable spacecraft developed by SpaceX, an American private space transportation company based in Hawthorne, California. Dragon is launched into space by the SpaceX Falcon 9 two-stage-to-orbit launch vehicle. The Dragon spacecraft was originally designed for human travel, but so far has only been used to deliver cargo to the International Space Station (ISS)."
189
+ ```
190
+
191
+ ### History
192
+
193
+ - Get information for all historical events: `SPACEX::History.info`
194
+ - Get information about a specific historical event: `SPACEX::History.info('4')`
195
+
196
+ ```ruby
197
+ require 'spacex'
198
+ historical_events = SPACEX::History.info
199
+
200
+ first_event = historical_events.first
201
+ first_event.id # 1
202
+ first_event.title # Falcon 1 Makes History
203
+ first_event.event_date_utc # 2008-09-28T23:15:00Z
204
+ first_event.event_date_unix # 1222643700
205
+ first_event.flight_number # 4
206
+ first_event.details # Falcon 1 becomes the first privately developed liquid fuel rocket to reach Earth orbit.
207
+ first_event.links['reddit'] # nil
208
+ first_event.links['article'] # http://www.spacex.com/news/2013/02/11/flight-4-launch-update-0
209
+ first_event.links['wikipedia'] # https://en.wikipedia.org/wiki/Falcon_1
210
+ ```
211
+
212
+ ### Launches
213
+
214
+ - Get information for all launches: `SPACEX::Launches.all` or `SPACEX::Launches.info`
215
+ - Get information about a specific launch: `SPACEX::Launches.info('flight_number')`
216
+ - Get information on past launches: `SPACEX::Launches.past`
217
+ - Get information on the next launch: `SPACEX::Launches.next`
218
+ - Get the latest launch information: `SPACEX::Launches.latest`
219
+ - Get information on upcoming launches: `SPACEX::Launches.upcoming`
220
+
221
+ This code snippet shows how to get information for a specific launch by flight number and list the fields:
222
+
223
+ ```ruby
224
+ require 'spacex'
225
+ launch_68 = SPACEX::Launches.info(68)
226
+
227
+ launch_68.flight_number # 68
228
+ launch_68.mission_name # 'Telstar 18V'
229
+ launch_68.rocket.rocket_name # 'Falcon 9'
230
+ launch_68.rocket.first_stage.cores.first.land_success # true
231
+ ```
232
+
233
+ This code snippet shows how to get information on past launches:
234
+ ```ruby
235
+ past_launches = SPACEX::Launches.past
236
+
237
+ past_launches.first.flight_number # 1
238
+ past_launches.first.mission_name # 'FalconSat'
239
+ past_launches.first.rocket.rocket_name # 'Falcon 1'
240
+ past_launches.first.launch_success # false
241
+
242
+ past_launches.last.flight_number # 69
243
+ past_launches.last.mission_name # 'SAOCOM 1A'
244
+ past_launches.last.rocket.rocket_name # 'Falcon 9'
245
+ past_launches.last.rocket.first_stage.cores.first.land_success # true
246
+ past_launches.last.launch_success # true
247
+ ```
248
+
249
+
250
+
251
+ The following code snippet shows the latest launch information and the data fields available on the Launch object:
252
+
253
+ ```ruby
254
+ require 'spacex'
255
+ latest_launch = SPACEX::Launches.latest
256
+
257
+ latest_launch.flight_number # 67
258
+ latest_launch.mission_name # 'Merah Putih'
259
+ latest_launch.launch_year # '2018'
260
+ latest_launch.launch_date_unix # 1_533_619_080
261
+ latest_launch.launch_date_utc # '2018-08-07T05:18:00.000Z'
262
+ latest_launch.launch_date_local # '2018-08-07T01:18:00-04:00'
263
+ latest_launch.launch_success # true
264
+ latest_launch.rocket.rocket_id # 'falcon9'
265
+ latest_launch.rocket.rocket_name # 'Falcon 9'
266
+ latest_launch.rocket.rocket_type # 'FT'
267
+ latest_launch.rocket.first_stage.cores.first.core_serial # 'B1046'
268
+ latest_launch.rocket.first_stage.cores.first.flight # 2
269
+ latest_launch.rocket.first_stage.cores.first.block # 5
270
+ latest_launch.rocket.first_stage.cores.first.reused # true
271
+ latest_launch.rocket.first_stage.cores.first.land_success # true
272
+ latest_launch.rocket.first_stage.cores.first.landing_type # 'ASDS'
273
+ latest_launch.rocket.first_stage.cores.first.landing_vehicle # 'OCISLY'
274
+ latest_launch.rocket.second_stage.block # 5
275
+ latest_launch.rocket.second_stage.payloads.first.payload_id # 'Telkom-4'
276
+ latest_launch.rocket.second_stage.payloads.first.norad_id.first # 43_587
277
+ latest_launch.rocket.second_stage.payloads.first.reused # false
278
+ latest_launch.rocket.second_stage.payloads.first.customers.first # 'Telkom'
279
+ latest_launch.rocket.second_stage.payloads.first.nationality # 'Indonesia'
280
+ latest_launch.rocket.second_stage.payloads.first.manufacturer # 'SSL'
281
+ latest_launch.rocket.second_stage.payloads.first.payload_type # 'Satellite'
282
+ latest_launch.rocket.second_stage.payloads.first.payload_mass_kg # 5800
283
+ latest_launch.rocket.second_stage.payloads.first.payload_mass_lbs # 12_786.81
284
+ latest_launch.rocket.second_stage.payloads.first.orbit # 'GTO'
285
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.reference_system # 'geocentric'
286
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.regime # 'geostationary'
287
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.longitude # -108
288
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.semi_major_axis_km # 21_226.178
289
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.eccentricity # 0.6904141
290
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.periapsis_km # 193.19
291
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.apoapsis_km # 29_502.896
292
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.inclination_deg # 27.0648
293
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.period_min # 512.941
294
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.lifespan_years # 15
295
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.epoch # '2018-08-07T06:57:16.000Z'
296
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.mean_motion # 2.80734018
297
+ latest_launch.rocket.second_stage.payloads.first.orbit_params.raan # 227.0228
298
+ latest_launch.telemetry.flight_club # nil
299
+ latest_launch.reuse.core # true
300
+ latest_launch.reuse.sire_core1 # nil
301
+ latest_launch.reuse.side_core2 # false
302
+ latest_launch.reuse.fairings # false
303
+ latest_launch.reuse.capsule # false
304
+ latest_launch.launch_site.site_id # 'ccafs_slc_40'
305
+ latest_launch.launch_site.site_name # 'CCAFS SLC 40'
306
+ latest_launch.launch_site.site_name_long # 'Cape Canaveral Air Force Station Space Launch Complex 40'
307
+ latest_launch.launch_success # true
308
+ latest_launch.links.mission_patch # 'https://images2.imgbox.com/a8/f5/ZgdsrbqW_o.png'
309
+ latest_launch.links.mision_patch_small # nil
310
+ latest_launch.links.reddit_campaign # 'https://www.reddit.com/r/spacex/comments/91gwfg/merah_putih_telkom4_launch_campaign_thread/'
311
+ latest_launch.links.reddit_launch # 'https://www.reddit.com/r/spacex/comments/9539nr/rspacex_merah_putih_telkom4_official_launch/'
312
+ latest_launch.links.reddit_recovery # nil
313
+ latest_launch.links.reddit_media # 'https://www.reddit.com/r/spacex/comments/94zr0b/rspacex_merah_putih_media_thread_videos_images/'
314
+ latest_launch.links.presskit # 'https://www.spacex.com/sites/spacex/files/merahputihpresskit.pdf'
315
+ latest_launch.links.article_link # 'https://spaceflightnow.com/2018/08/07/indonesian-communications-satellite-deployed-in-orbit-by-spacex/'
316
+ latest_launch.links.wikipedia # 'https://en.wikipedia.org/wiki/Telkom_Indonesia'
317
+ latest_launch.links.video_link # 'https://www.youtube.com/watch?v=FjfQNBYv2IY'
318
+ latest_launch.details # 'Indonesian comsat intended to replace the aging Telkom 1 at 108° E. First reflight of a Block 5-version booster.'
319
+ latest_launch.upcoming # false
320
+ latest_launch.static_fire_date_utc # '2018-08-02T15:53:00.000Z'
321
+ ```
322
+
323
+ This code snippet shows how to get information on upcoming launches:
324
+ ```ruby
325
+ upcoming_launches = SPACEX::Launches.upcoming
326
+
327
+ upcoming_launches.first.flight_number # 70
328
+ upcoming_launches.first.mission_name # 'Es’hail 2'
329
+ upcoming_launches.first.launch_date_utc # '2018-11-14T20:46:00.000Z'
330
+
331
+ upcoming_launches.last.flight_number # 91
332
+ upcoming_launches.last.mission_name # 'GPS IIIA-3'
333
+ upcoming_launches.last.launch_date_utc # '2019-10-01T00:00:00.000Z'
334
+ ```
335
+
336
+ ### Missions
337
+
338
+ - Get information for all mission: `SPACEX::Missions.info`
339
+ - Get information about a specific mission: `SPACEX::Missions.info('mission_id')`
340
+
341
+ This code shows how to get the first mission information and lists the fields:
342
+
343
+ ```ruby
344
+ missions = SPACEX::Missions.info
345
+
346
+ missions.first.mission_id # "F3364BF"
347
+ missions.first.mission_name # "Iridium NEXT"
348
+ missions.first.manufacturers # ["Orbital ATK"]
349
+ missions.first.payload_ids # ["Iridium NEXT 1", "Iridium NEXT 2", "Iridium NEXT 3", "Iridium NEXT 4", "Iridium NEXT 5", "Iridium NEXT 6", "Iridium NEXT 7"]
350
+ missions.first.wikipedia # "https://en.wikipedia.org/wiki/Iridium_satellite_constellation"
351
+ missions.first.website # "https://www.iridiumnext.com/"
352
+ missions.first.twitter # "https://twitter.com/IridiumBoss?lang=en"
353
+ missions.first.description # "In 2017, Iridium began launching Iridium NEXT, a second-generation worldwide network of telecommunications satellites, consisting of 66 active satellites, with another nine in-orbit spares and six on-ground spares. These satellites will incorporate features such as data transmission that were not emphasized in the original design. The constellation will provide L-band data speeds of up to 128 kbit/s to mobile terminals, up to 1.5 Mbit/s to Iridium Pilot marine terminals, and high-speed Ka-band service of up to 8 Mbit/s to fixed/transportable terminals. The next-generation terminals and service are expected to be commercially available by the end of 2018. However, Iridium's proposed use of its next-generation satellites has raised concerns the service will harmfully interfere with GPS devices. The satellites will incorporate a secondary payload for Aireon, a space-qualified ADS-B data receiver. This is for use by air traffic control and, via FlightAware, for use by airlines. A tertiary payload on 58 satellites is a marine AIS ship-tracker receiver, for Canadian company exactEarth Ltd. Iridium can also be used to provide a data link to other satellites in space, enabling command and control of other space assets regardless of the position of ground stations and gateways."
354
+ ```
355
+
356
+ ### Payloads
357
+
358
+ - Get information for all payloads: `SPACEX::Payloads.info`
359
+ - Get information about a specific payload: `SPACEX::Payloads.info('payload_id')`
360
+
361
+ The following code shows how to get information about a specific payload and lists the payload data fields:
362
+
363
+ ```ruby
364
+ payload = SPACEX::Payloads.info('FalconSAT-2')
365
+
366
+ payload.payload_id # 'FalconSAT-2'
367
+ payload.reused # false
368
+ payload.customers # ['DARPA']
369
+ payload.nationality # 'United States'
370
+ payload.manufacturer # 'SSTL'
371
+ payload.payload_type # 'Satellite'
372
+ payload.payload_mass_kg # 20
373
+ payload.payload_mass_lbs # 43
374
+ payload.orbit # 'LEO'
375
+ payload.orbit_params # {"reference_system"=>"geocentric", "regime"=>"low-earth", "longitude"=>nil, "semi_major_axis_km"=>nil, "eccentricity"=>nil, "periapsis_km"=>400, "apoapsis_km"=>500, "inclination_deg"=>39, "period_min"=>nil, "lifespan_years"=>nil, "epoch"=>nil, "mean_motion"=>nil, "raan"=>nil, "arg_of_pericenter"=>nil, "mean_anomaly"=>nil}
376
+ ```
377
+
378
+ ### Roadster
379
+
380
+ - Get roadster orbital data: `SPACEX::Roadster.info`
381
+
382
+ The following code shows how to get information about the Roadster:
383
+
384
+ ```ruby
385
+ roadster = SPACEX::Roadster.info
386
+
387
+ roadster.name # "Elon Musk's Tesla Roadster"
388
+ roadster.launch_date_utc # '2018-02-06T20:45:00.000Z'
389
+ roadster.launch_date_unix # 1_517_949_900
390
+ roadster.launch_date_kg # nil
391
+ roadster.launch_date_lbs # nil
392
+ roadster.norad_id # 43_205
393
+ roadster.epoch_jd # 2_458_353.027800926
394
+ roadster.orbit_type # 'heliocentric'
395
+ roadster.apoapsis_au # 1.663757412460597
396
+ roadster.periapsis_au # 0.9860953641129515
397
+ roadster.semo_major_axis_au # nil
398
+ roadster.eccentricity # 0.2557357353354217
399
+ roadster.inclination # 1.077474057737451
400
+ roadster.longitude # 317.0962040947829
401
+ roadster.periapsis_arg # 177.491390597234
402
+ roadster.speed_kph # 76_703.72399999999
403
+ roadster.speed_mph # 47_661.469685603995
404
+ roadster.earth_distance_km # 172_954_806.23899576
405
+ roadster.earth_distance_mi # 107_469_100.90753104
406
+ roadster.mars_distance_km # 147_648_108.6344399
407
+ roadster.mars_distance_mi # 91_744_252.91029055
408
+ roadster.wikipedia # 'https://en.wikipedia.org/wiki/Elon_Musk%27s_Tesla_Roadster'
409
+ roadster.details # "Elon Musk's Tesla Roadster is an electric sports car that served as the dummy payload for the February 2018 Falcon Heavy test flight and is now an artificial satellite of the Sun. Starman, a mannequin dressed in a spacesuit, occupies the driver's seat. The car and rocket are products of Tesla and SpaceX, both companies founded by Elon Musk. This 2008-model Roadster was previously used by Musk for commuting, and is the only consumer car sent into space."
410
+ ```
411
+
412
+ ### Rockets
413
+
414
+ - Get information for all rockets: `SPACEX::Rockets.info`
415
+ - Get information about a specific rocket: `SPACEX::Rockets.info('rocket_id')`
416
+
417
+ This example shows a single rocket and its data fields:
418
+
419
+ ```
420
+ rockets = SPACEX::Rockets.info
421
+ first_rocket = rockets.first
422
+
423
+ first_rocket.id # 1
424
+ first_rocket.active # false
425
+ first_rocket.stages # 2
426
+ first_rocket.boosters # 0
427
+ first_rocket.cost_per_launch # 6700000
428
+ first_rocket.success_rate_pct # 40
429
+ first_rocket.first_flight # "2006-03-24"
430
+ first_rocket.country # "Republic of the Marshall Islands"
431
+ first_rocket.company # "SpaceX"
432
+ first_rocket.height # {"meters"=>22.25, "feet"=>73}
433
+ first_rocket.diameter # {"meters"=>1.68, "feet"=>5.5}
434
+ first_rocket.mass # {"kg"=>30146, "lb"=>66460}
435
+ first_rocket.payload_weights # [{"id"=>"leo", "name"=>"Low Earth Orbit", "kg"=>450, "lb"=>992}]
436
+ first_rocket.first_stage # {"reusable"=>false, "engines"=>1, "fuel_amount_tons"=>44.3, "burn_time_sec"=>169, "thrust_sea_level"=>{"kN"=>420, "lbf"=>94000}, "thrust_vacuum"=>{"kN"=>480, "lbf"=>110000}}
437
+ first_rocket.second_stage # {"engines"=>1, "fuel_amount_tons"=>3.38, "burn_time_sec"=>378, "thrust"=>{"kN"=>31, "lbf"=>7000}, "payloads"=>{"option_1"=>"composite fairing", "composite_fairing"=>{"height"=>{"meters"=>3.5, "feet"=>11.5}, "diameter"=>{"meters"=>1.5, "feet"=>4.9}}}}
438
+ first_rocket.engines # {"number"=>1, "type"=>"merlin", "version"=>"1C", "layout"=>"single", "engine_loss_max"=>0, "propellant_1"=>"liquid oxygen", "propellant_2"=>"RP-1 kerosene", "thrust_sea_level"=>{"kN"=>420, "lbf"=>94000}, "thrust_vacuum"=>{"kN"=>480, "lbf"=>110000}, "thrust_to_weight"=>96}
439
+ first_rocket.landing_legs # {"number"=>0, "material"=>nil}
440
+ first_rocket.wikipedia # "https://en.wikipedia.org/wiki/Falcon_1"
441
+ first_rocket.description # "The Falcon 1 was an expendable launch system privately developed and manufactured by SpaceX during 2006-2009. On 28 September 2008, Falcon 1 became the first privately-developed liquid-fuel launch vehicle to go into orbit around the Earth."
442
+ first_rocket.rocket_id # "falcon1"
443
+ first_rocket.rocket_name # "Falcon 1"
444
+ first_rocket.rocket_type # "rocket"
445
+ first_rocket.flickr_images # ["https://www.spacex.com/sites/spacex/files/styles/media_gallery_large/public/2009_-_01_liftoff_south_full_wide_ro8a1280_edit.jpg?itok=8loiSGt1", "https://www.spacex.com/sites/spacex/files/styles/media_gallery_large/public/2009_-_02_default_liftoff_west_full_wide_nn6p2062_xl.jpg?itok=p776nHsM"]
446
+ ```
447
+
448
+ ### Ships
449
+
450
+ - Get information for all ships: `SPACEX::Ships.info`
451
+ - Get information about a specific ship: `SPACEX::Ships.info('ship_id')`
452
+
453
+ The following code shows how to get information about a specific ship and lists the ship data fields:
454
+
455
+ ```ruby
456
+ ship = SPACEX::Ships.info('AMERICANCHAMPION')
457
+
458
+ ship.ship_id # 'AMERICANCHAMPION'
459
+ ship.ship_name # 'American Champion'
460
+ ship.ship_model # nil
461
+ ship.ship_type # 'Tug'
462
+ ship.roles # ['Support Ship', 'Barge Tug']
463
+ ship.active # false
464
+ ship.imo # 7_434_016
465
+ ship.mmsi # 367_020_820
466
+ ship.abs # 571_252
467
+ ship.ship_class # 7_604_342 # Call as array since "class" is a method in Ruby
468
+ ship.weight_lbs # 588_000
469
+ ship.weight_kg # 266_712
470
+ ship.year_built # 1976
471
+ ship.home_port # 'Port of Los Angeles'
472
+ ship.status # 'Stopped'
473
+ ship.speed_kn # 0
474
+ ship.course_deg # nil
475
+ ship.position # ({ 'latitude' => 30.52852, 'longitude' => -88.09869 })
476
+ ship.successful_landings # nil
477
+ ship.attempted_landings # nil
478
+ ship.missions # [{ 'flight' => 7, 'name' => 'COTS 1' }, { 'flight' => 8, 'name' => 'COTS 2' }]
479
+ ship.url # 'https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION'
480
+ ship.image # 'https://i.imgur.com/woCxpkj.jpg'
481
+ ```
482
+
483
+
484
+ ## Contributing
485
+
486
+ See [CONTRIBUTING](CONTRIBUTING.md).
487
+
488
+ [List of awesome people that already helped this project](CHANGELOG.md).
489
+
490
+
491
+ ## Copyright
492
+
493
+ Copyright (c) 2018, [Rodolfo Bandeira](https://twitter.com/rodolfobandeira) and [Contributors](CHANGELOG.md).
494
+
495
+ MIT License, see [LICENSE](https://github.com/rodolfobandeira/spacex/blob/master/LICENSE) for details.