spacex 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +26 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +54 -1
- data/CLAUDE.md +55 -0
- data/Dangerfile +28 -0
- data/Gemfile +12 -1
- data/README.md +52 -510
- data/docs/v3.md +525 -0
- data/docs/v4.md +179 -0
- data/lib/spacex/base_request.rb +8 -8
- data/lib/spacex/capsules.rb +10 -12
- data/lib/spacex/company.rb +7 -0
- data/lib/spacex/cores.rb +11 -14
- data/lib/spacex/crew.rb +15 -0
- data/lib/spacex/{dragon_capsules.rb → dragons.rb} +14 -16
- data/lib/spacex/history.rb +9 -2
- data/lib/spacex/landpads.rb +23 -0
- data/lib/spacex/launches.rb +35 -11
- data/lib/spacex/launchpads.rb +23 -0
- data/lib/spacex/models.rb +16 -0
- data/lib/spacex/payloads.rb +31 -2
- data/lib/spacex/rockets.rb +26 -3
- data/lib/spacex/ships.rb +22 -24
- data/lib/spacex/starlink.rb +16 -0
- data/lib/spacex/version.rb +1 -1
- data/lib/spacex.rb +2 -17
- data/spacex.gemspec +6 -9
- data/spec/coverage_helper.rb +5 -0
- data/spec/fixtures/spacex/v4/capsules/all.yml +122 -0
- data/spec/fixtures/spacex/v4/capsules/one.yml +89 -0
- data/spec/fixtures/spacex/v4/company.yml +80 -0
- data/spec/fixtures/spacex/v4/cores/all.yml +76 -0
- data/spec/fixtures/spacex/v4/cores/one.yml +75 -0
- data/spec/fixtures/spacex/v4/crew/all.yml +92 -0
- data/spec/fixtures/spacex/v4/crew/one.yml +74 -0
- data/spec/fixtures/spacex/v4/dragons/all.yml +101 -0
- data/spec/fixtures/spacex/v4/dragons/one.yml +189 -0
- data/spec/fixtures/spacex/v4/history/all.yml +85 -0
- data/spec/fixtures/spacex/v4/history/one.yml +168 -0
- data/spec/fixtures/spacex/v4/landpads/all.yml +85 -0
- data/spec/fixtures/spacex/v4/landpads/one.yml +172 -0
- data/spec/fixtures/spacex/v4/launches/all.yml +85 -0
- data/spec/fixtures/spacex/v4/launches/latest.yml +84 -0
- data/spec/fixtures/spacex/v4/launches/next.yml +84 -0
- data/spec/fixtures/spacex/v4/launches/one.yml +167 -0
- data/spec/fixtures/spacex/v4/launches/past.yml +85 -0
- data/spec/fixtures/spacex/v4/launches/upcoming.yml +97 -0
- data/spec/fixtures/spacex/v4/launchpads/all.yml +139 -0
- data/spec/fixtures/spacex/v4/launchpads/one.yml +225 -0
- data/spec/fixtures/spacex/v4/payloads/all.yml +85 -0
- data/spec/fixtures/spacex/v4/payloads/one.yml +167 -0
- data/spec/fixtures/spacex/v4/roadster.yml +90 -0
- data/spec/fixtures/spacex/v4/rockets/all.yml +76 -0
- data/spec/fixtures/spacex/v4/rockets/one.yml +84 -0
- data/spec/fixtures/spacex/v4/ships/all.yml +164 -0
- data/spec/fixtures/spacex/v4/ships/one.yml +248 -0
- data/spec/fixtures/spacex/v4/starlink/all.yml +17713 -0
- data/spec/fixtures/spacex/v4/starlink/one.yml +17798 -0
- data/spec/spacex/base_request_spec.rb +112 -0
- data/spec/spacex/capsules_spec.rb +19 -28
- data/spec/spacex/company_spec.rb +26 -0
- data/spec/spacex/cores_spec.rb +18 -31
- data/spec/spacex/crew_spec.rb +27 -0
- data/spec/spacex/dragons_spec.rb +39 -0
- data/spec/spacex/history_spec.rb +16 -40
- data/spec/spacex/landpads_spec.rb +35 -0
- data/spec/spacex/launches_spec.rb +28 -628
- data/spec/spacex/launchpads_spec.rb +34 -0
- data/spec/spacex/payloads_spec.rb +27 -51
- data/spec/spacex/roadster_spec.rb +5 -29
- data/spec/spacex/rockets_spec.rb +26 -194
- data/spec/spacex/ships_spec.rb +20 -51
- data/spec/spacex/starlink_spec.rb +28 -0
- data/spec/spacex/version_spec.rb +12 -0
- data/spec/spec_helper.rb +3 -9
- metadata +106 -137
- data/.ruby-version +0 -1
- data/.travis.yml +0 -21
- data/lib/spacex/api_info.rb +0 -7
- data/lib/spacex/company_info.rb +0 -7
- data/lib/spacex/endpoint.rb +0 -3
- data/lib/spacex/landing_pads.rb +0 -11
- data/lib/spacex/launch_pads.rb +0 -11
- data/lib/spacex/missions.rb +0 -18
- data/spec/fixtures/spacex/api_info/info.yml +0 -65
- data/spec/fixtures/spacex/capsules/C202.yml +0 -123
- data/spec/fixtures/spacex/capsules.yml +0 -83
- data/spec/fixtures/spacex/company_info/info.yml +0 -129
- data/spec/fixtures/spacex/cores/B1041.yml +0 -123
- data/spec/fixtures/spacex/cores.yml +0 -62
- data/spec/fixtures/spacex/dragon_capsules/info/dragon1.yml +0 -131
- data/spec/fixtures/spacex/dragon_capsules/info.yml +0 -77
- data/spec/fixtures/spacex/history/info/4.yml +0 -62
- data/spec/fixtures/spacex/history/info.yml +0 -62
- data/spec/fixtures/spacex/landing_pads/info/LZ-4.yml +0 -70
- data/spec/fixtures/spacex/landing_pads/info.yml +0 -68
- data/spec/fixtures/spacex/launch_pads/info/vafb_slc_4e.yml +0 -71
- data/spec/fixtures/spacex/launch_pads/info.yml +0 -104
- data/spec/fixtures/spacex/launches/68.yml +0 -69
- data/spec/fixtures/spacex/launches/all.yml +0 -62
- data/spec/fixtures/spacex/launches/info.yml +0 -62
- data/spec/fixtures/spacex/launches/latest.yml +0 -245
- data/spec/fixtures/spacex/launches/next.yml +0 -123
- data/spec/fixtures/spacex/launches/past.yml +0 -62
- data/spec/fixtures/spacex/launches/upcoming.yml +0 -64
- data/spec/fixtures/spacex/launches.yml +0 -62
- data/spec/fixtures/spacex/missions/F3364BF.yml +0 -157
- data/spec/fixtures/spacex/missions/info.yml +0 -62
- data/spec/fixtures/spacex/payloads/RatSat.yml +0 -62
- data/spec/fixtures/spacex/payloads/info.yml +0 -62
- data/spec/fixtures/spacex/roadster/info.yml +0 -133
- data/spec/fixtures/spacex/rockets/info/falcon1.yml +0 -139
- data/spec/fixtures/spacex/rockets/info/invalid.yml +0 -61
- data/spec/fixtures/spacex/rockets/info.yml +0 -105
- data/spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml +0 -125
- data/spec/fixtures/spacex/ships/info.yml +0 -139
- data/spec/spacex/api_info_spec.rb +0 -16
- data/spec/spacex/company_info_spec.rb +0 -27
- data/spec/spacex/dragon_capsules_spec.rb +0 -107
- data/spec/spacex/endpoint_spec.rb +0 -9
- data/spec/spacex/landing_pads_spec.rb +0 -72
- data/spec/spacex/launch_pads_spec.rb +0 -77
- data/spec/spacex/missions_spec.rb +0 -35
data/docs/v4.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# V4 Usage
|
|
2
|
+
- [Capsules](#capsules)
|
|
3
|
+
- `SPACEX::V4::Capsules.info`
|
|
4
|
+
- `SPACEX::V4::Capsules.info('id')`
|
|
5
|
+
- [Cores](#cores)
|
|
6
|
+
- `SPACEX::V4::Cores.info`
|
|
7
|
+
- `SPACEX::V4::Cores.info('id')`
|
|
8
|
+
- [Company](#company)
|
|
9
|
+
- `SPACEX::V4::Company.info`
|
|
10
|
+
- [Crew](#crew)
|
|
11
|
+
- `SPACEX::V4::Crew.info`
|
|
12
|
+
- `SPACEX::V4::Crew.info('id')`
|
|
13
|
+
- [Rockets](#rockets)
|
|
14
|
+
- `SPACEX::V4::Rockets.info`
|
|
15
|
+
- `SPACEX::V4::Rockets.info('id')`
|
|
16
|
+
|
|
17
|
+
**Note:**
|
|
18
|
+
Return values encapsulated in `SPACEX::Response` are accessible as attribute methods e.g.
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
first_rocket.diameter # #<SPACEX::Response feet=5.5 meters=1.68>
|
|
22
|
+
first_rocket.diameter.feet # 5.5
|
|
23
|
+
first_rocket.diameter.meters # 1.68
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Return values encapsulated in `Hashie::Array` are accessible as regular arrays e.g.
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
first_rocket.flickr_images # #<Hashie::Array ["https://imgur.com/DaCfMsj.jpg", "https://imgur.com/azYafd8.jpg"]>
|
|
30
|
+
first_rocket.flickr_images[0] # "https://imgur.com/DaCfMsj.jpg"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Note:**
|
|
34
|
+
Return values encapsulated in `SPACEX::Response` are accessible as attribute methods e.g.
|
|
35
|
+
```ruby
|
|
36
|
+
first_rocket.diameter # #<SPACEX::Response feet=5.5 meters=1.68>
|
|
37
|
+
first_rocket.diameter.feet # 5.5
|
|
38
|
+
first_rocket.diameter.meters # 1.68
|
|
39
|
+
```
|
|
40
|
+
Return values encapsulated in `Hashie::Array` are accessible as regular arrays e.g.
|
|
41
|
+
```ruby
|
|
42
|
+
first_rocket.flickr_images # #<Hashie::Array ["https://imgur.com/DaCfMsj.jpg", "https://imgur.com/azYafd8.jpg"]>
|
|
43
|
+
first_rocket.flickr_images[0] # "https://imgur.com/DaCfMsj.jpg"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Capsules
|
|
47
|
+
|
|
48
|
+
- Get information for all capsules: `SPACEX::V4::Capsules.info`
|
|
49
|
+
- Get information about a specific capsule: `SPACEX::V4::Capsules.info('id')`
|
|
50
|
+
|
|
51
|
+
**NOTE:** As of v4, the capsules.info uses the capsule's `id` and not `serial` as it did in v3.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
This example shows how to get capsules information and what the data fields are for that object:
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
capsules_info = SPACEX::V4::Capsules.info
|
|
58
|
+
|
|
59
|
+
capsules_info.first.id # '5e9e2c5bf35918ed873b2664'
|
|
60
|
+
capsules_info.first.land_landings # 0
|
|
61
|
+
capsules_info.first.last_update # 'Reentered after three weeks in orbit'
|
|
62
|
+
capsules_info.first.launches # #<Hashie::Array ["5eb87cdeffd86e000604b330"]>
|
|
63
|
+
capsules_info.first.launches.first # '5eb87cdeffd86e000604b330'
|
|
64
|
+
capsules_info.first.reuse_count # 1
|
|
65
|
+
capsules_info.first.serial # 'C101'
|
|
66
|
+
capsules_info.first.status # 'retired'
|
|
67
|
+
capsules_info.first.type # 'Dragon 1.0'
|
|
68
|
+
capsules_info.first.water_landings # 1
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Cores
|
|
72
|
+
|
|
73
|
+
- Get information for all cores: `SPACEX::V4::Cores.info`
|
|
74
|
+
- Get information about a specific core: `SPACEX::V4::Cores.info('id')`
|
|
75
|
+
|
|
76
|
+
This example shows how to get cores information and what the data fields are for that object:
|
|
77
|
+
|
|
78
|
+
```ruby
|
|
79
|
+
cores_info = SPACEX::V4::Cores.info
|
|
80
|
+
cores_info.last.block # 5
|
|
81
|
+
cores_info.last.reuse_count # 0
|
|
82
|
+
cores_info.last.rtls_attempts # 0
|
|
83
|
+
cores_info.last.rtls_landings # 0
|
|
84
|
+
cores_info.last.asds_attempts # 1
|
|
85
|
+
cores_info.last.asds_landings # 1
|
|
86
|
+
cores_info.last.last_update # 'Landed on OCISLY* as of June 3, 2021 '
|
|
87
|
+
cores_info.last.launches # #<Hashie::Array ["5fe3af84b3467846b3242161"]>
|
|
88
|
+
cores_info.last.launches.first # '5fe3af84b3467846b3242161'
|
|
89
|
+
cores_info.last.serial # B1067
|
|
90
|
+
cores_info.last.id # '60b800111f83cc1e59f16438'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Company
|
|
94
|
+
|
|
95
|
+
- Get SpaceX company information: `SPACEX::V4::Company.info`
|
|
96
|
+
|
|
97
|
+
This example shows how to get company information and what the data fields are for that object:
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
company_info = SPACEX::V4::Company.info
|
|
101
|
+
company_info.name # 'SpaceX'
|
|
102
|
+
company_info.founder # 'Elon Musk'
|
|
103
|
+
company_info.founded # 2002
|
|
104
|
+
company_info.employees # 9500
|
|
105
|
+
company_info.vehicles # 4
|
|
106
|
+
company_info.launch_sites # 3
|
|
107
|
+
company_info.test_sites # 3
|
|
108
|
+
company_info.ceo # 'Elon Musk'
|
|
109
|
+
company_info.cto # 'Elon Musk'
|
|
110
|
+
company_info.coo # 'Gwynne Shotwell'
|
|
111
|
+
company_info.cto_propulsion # 'Tom Mueller'
|
|
112
|
+
company_info.valuation # 74_000_000_000
|
|
113
|
+
company_info.headquarters.address # 'Rocket Road'
|
|
114
|
+
company_info.headquarters.city # 'Hawthorne'
|
|
115
|
+
company_info.headquarters.state # 'California'
|
|
116
|
+
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.'
|
|
117
|
+
company_info.links.website # 'https://www.spacex.com/'
|
|
118
|
+
company_info.links.flickr # 'https://www.flickr.com/photos/spacex/'
|
|
119
|
+
company_info.links.twitter # 'https://twitter.com/SpaceX'
|
|
120
|
+
company_info.links.elon_twitter # 'https://twitter.com/elonmusk'
|
|
121
|
+
company_info.id # '5eb75edc42fea42237d7f3ed'
|
|
122
|
+
### Rockets
|
|
123
|
+
|
|
124
|
+
- Get information for all rockets: `SPACEX::V4::Rockets.info`
|
|
125
|
+
- Get information about a specific rocket: `SPACEX::V4::Rockets.info('id')`
|
|
126
|
+
|
|
127
|
+
**NOTE:** As of v4, the rockets.info uses the rocket's `id` and not `rocket_id` as it did in v3.
|
|
128
|
+
|
|
129
|
+
This example shows how to get rockets information and what the data fields are for that object:
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
```ruby
|
|
133
|
+
rockets = SPACEX::V4::Rockets.info
|
|
134
|
+
first_rocket = rockets.first
|
|
135
|
+
|
|
136
|
+
first_rocket.active # false
|
|
137
|
+
first_rocket.boosters # 0
|
|
138
|
+
first_rocket.company # "SpaceX"
|
|
139
|
+
first_rocket.cost_per_launch # 6700000
|
|
140
|
+
first_rocket.country # "Republic of the Marshall Islands"
|
|
141
|
+
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."
|
|
142
|
+
first_rocket.diameter # #<SPACEX::Response feet=5.5 meters=1.68>
|
|
143
|
+
first_rocket.diameter.feet # 5.5
|
|
144
|
+
first_rocket.diameter.meters # 1.68
|
|
145
|
+
first_rocket.engines # #<SPACEX::Response engine_loss_max=0 isp=#<SPACEX::Response sea_level=267 vacuum=304> layout="single" number=1 propellant_1="liquid oxygen" propellant_2="RP-1 kerosene" thrust_sea_level=#<SPACEX::Response kN=420 lbf=94000> thrust_to_weight=96 thrust_vacuum=#<SPACEX::Response kN=480 lbf=110000> type="merlin" version="1C">
|
|
146
|
+
first_rocket.first_flight # "2006-03-24"
|
|
147
|
+
first_rocket.first_stage # #<SPACEX::Response burn_time_sec=169 engines=1 fuel_amount_tons=44.3 reusable=false thrust_sea_level=#<SPACEX::Response kN=420 lbf=94000> thrust_vacuum=#<SPACEX::Response kN=480 lbf=110000>>
|
|
148
|
+
first_rocket.flickr_images # #<Hashie::Array ["https://imgur.com/DaCfMsj.jpg", "https://imgur.com/azYafd8.jpg"]>
|
|
149
|
+
first_rocket.height # #<SPACEX::Response feet=73 meters=22.25>
|
|
150
|
+
first_rocket.id # "5e9d0d95eda69955f709d1eb"
|
|
151
|
+
first_rocket.landing_legs # #<SPACEX::Response material=nil number=0>
|
|
152
|
+
first_rocket.mass # #<SPACEX::Response kg=30146 lb=66460>
|
|
153
|
+
first_rocket.name # "Falcon 1"
|
|
154
|
+
first_rocket.payload_weights # #<Hashie::Array [#<SPACEX::Response id="leo" kg=450 lb=992 name="Low Earth Orbit">]>
|
|
155
|
+
first_rocket.second_stage # #<SPACEX::Response burn_time_sec=378 engines=1 fuel_amount_tons=3.38 payloads=#<SPACEX::Response composite_fairing=#<SPACEX::Response diameter=#<SPACEX::Response feet=4.9 meters=1.5> height=#<SPACEX::Response feet=11.5 meters=3.5>> option_1="composite fairing"> reusable=false thrust=#<SPACEX::Response kN=31 lbf=7000>>
|
|
156
|
+
first_rocket.stages # 2
|
|
157
|
+
first_rocket.success_rate_pct # 40
|
|
158
|
+
first_rocket.type # "rocket"
|
|
159
|
+
first_rocket.wikipedia # "https://en.wikipedia.org/wiki/Falcon_1"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Crew
|
|
163
|
+
- Get information for all crew: `SPACEX::V4::Crew.info`
|
|
164
|
+
- Get information about a specific crew member: `SPACEX::V4::Crew.info('id')`
|
|
165
|
+
|
|
166
|
+
This example shows how to get crew members information and what the data fields are for that object:
|
|
167
|
+
|
|
168
|
+
```ruby
|
|
169
|
+
crew_members = SPACEX::V4::Crew.info
|
|
170
|
+
first_crew_member = crew_members.first
|
|
171
|
+
|
|
172
|
+
first_crew_member.agency # "NASA"
|
|
173
|
+
first_crew_member.id # "5ebf1a6e23a9a60006e03a7a"
|
|
174
|
+
first_crew_member.image # "https://imgur.com/0smMgMH.png"
|
|
175
|
+
first_crew_member.launches # #<Hashie::Array ["5eb87d46ffd86e000604b388"]>
|
|
176
|
+
first_crew_member.name # "Robert Behnken"
|
|
177
|
+
first_crew_member.status # "active"
|
|
178
|
+
first_crew_member.wikipedia # "https://en.wikipedia.org/wiki/Robert_L._Behnken"
|
|
179
|
+
```
|
data/lib/spacex/base_request.rb
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
+
BASE_URI = 'https://api.spacexdata.com'.freeze
|
|
3
|
+
|
|
2
4
|
class Response < Hashie::Mash
|
|
3
5
|
disable_warnings
|
|
4
6
|
end
|
|
5
7
|
|
|
6
8
|
module BaseRequest
|
|
7
9
|
class << self
|
|
8
|
-
def info(path, klass = nil
|
|
9
|
-
response_body = get(path
|
|
10
|
+
def info(path, klass = nil)
|
|
11
|
+
response_body = get(path).body
|
|
10
12
|
process(response_body, klass)
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
private
|
|
14
16
|
|
|
15
|
-
def get(path
|
|
16
|
-
conn(path).get
|
|
17
|
-
req.params = params
|
|
18
|
-
end
|
|
17
|
+
def get(path)
|
|
18
|
+
conn(path).get
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def process(response_body, klass)
|
|
@@ -42,12 +42,12 @@ module SPACEX
|
|
|
42
42
|
|
|
43
43
|
def conn(path)
|
|
44
44
|
Faraday.new(
|
|
45
|
-
url: "#{SPACEX::
|
|
45
|
+
url: "#{SPACEX::BASE_URI}/v4/#{path}",
|
|
46
46
|
request: {
|
|
47
47
|
params_encoder: Faraday::FlatParamsEncoder
|
|
48
48
|
}
|
|
49
49
|
) do |connection|
|
|
50
|
-
connection.
|
|
50
|
+
connection.response :json
|
|
51
51
|
connection.use Faraday::Response::RaiseError
|
|
52
52
|
connection.adapter ::Faraday.default_adapter
|
|
53
53
|
end
|
data/lib/spacex/capsules.rb
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
-
class Capsules <
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
property '
|
|
6
|
-
property '
|
|
2
|
+
class Capsules < SPACEX::Resource
|
|
3
|
+
property 'id'
|
|
4
|
+
property 'land_landings'
|
|
5
|
+
property 'last_update'
|
|
6
|
+
property 'launches'
|
|
7
|
+
property 'reuse_count'
|
|
8
|
+
property 'serial'
|
|
7
9
|
property 'status'
|
|
8
|
-
property 'original_launch'
|
|
9
|
-
property 'original_launch_unix'
|
|
10
|
-
property 'missions'
|
|
11
|
-
property 'landings'
|
|
12
10
|
property 'type'
|
|
13
|
-
property '
|
|
11
|
+
property 'water_landings'
|
|
14
12
|
|
|
15
|
-
def self.info(
|
|
16
|
-
SPACEX::BaseRequest.info("capsules/#{
|
|
13
|
+
def self.info(id = nil)
|
|
14
|
+
SPACEX::BaseRequest.info("capsules/#{id}", SPACEX::Capsules)
|
|
17
15
|
end
|
|
18
16
|
end
|
|
19
17
|
end
|
data/lib/spacex/cores.rb
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
-
class Cores <
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
property 'core_serial'
|
|
2
|
+
class Cores < SPACEX::Resource
|
|
3
|
+
property 'asds_attempts'
|
|
4
|
+
property 'asds_landings'
|
|
6
5
|
property 'block'
|
|
7
|
-
property '
|
|
8
|
-
property '
|
|
9
|
-
property '
|
|
10
|
-
property '
|
|
6
|
+
property 'id'
|
|
7
|
+
property 'last_update'
|
|
8
|
+
property 'launches'
|
|
9
|
+
property 'reuse_count'
|
|
11
10
|
property 'rtls_attempts'
|
|
12
11
|
property 'rtls_landings'
|
|
13
|
-
property '
|
|
14
|
-
property '
|
|
15
|
-
property 'water_landing'
|
|
16
|
-
property 'details'
|
|
12
|
+
property 'serial'
|
|
13
|
+
property 'status'
|
|
17
14
|
|
|
18
|
-
def self.info(
|
|
19
|
-
SPACEX::BaseRequest.info("cores/#{
|
|
15
|
+
def self.info(id = nil)
|
|
16
|
+
SPACEX::BaseRequest.info("cores/#{id}", SPACEX::Cores)
|
|
20
17
|
end
|
|
21
18
|
end
|
|
22
19
|
end
|
data/lib/spacex/crew.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module SPACEX
|
|
2
|
+
class Crew < SPACEX::Resource
|
|
3
|
+
property 'agency'
|
|
4
|
+
property 'id'
|
|
5
|
+
property 'image'
|
|
6
|
+
property 'launches'
|
|
7
|
+
property 'name'
|
|
8
|
+
property 'status'
|
|
9
|
+
property 'wikipedia'
|
|
10
|
+
|
|
11
|
+
def self.info(id = nil)
|
|
12
|
+
SPACEX::BaseRequest.info("crew/#{id}", SPACEX::Crew)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
-
class
|
|
3
|
-
include Hashie::Extensions::IgnoreUndeclared
|
|
4
|
-
|
|
5
|
-
property 'capsule_id', from: 'id'
|
|
6
|
-
property 'name'
|
|
7
|
-
property 'type'
|
|
2
|
+
class Dragons < SPACEX::Resource
|
|
8
3
|
property 'active'
|
|
9
4
|
property 'crew_capacity'
|
|
10
|
-
property '
|
|
11
|
-
property '
|
|
5
|
+
property 'description'
|
|
6
|
+
property 'diameter'
|
|
12
7
|
property 'dry_mass_kg'
|
|
13
8
|
property 'dry_mass_lb'
|
|
14
9
|
property 'first_flight'
|
|
10
|
+
property 'flickr_images'
|
|
15
11
|
property 'heat_shield'
|
|
16
|
-
property '
|
|
12
|
+
property 'height_w_trunk'
|
|
13
|
+
property 'id'
|
|
17
14
|
property 'launch_payload_mass'
|
|
18
15
|
property 'launch_payload_vol'
|
|
16
|
+
property 'name'
|
|
17
|
+
property 'orbit_duration_yr'
|
|
18
|
+
property 'pressurized_capsule'
|
|
19
19
|
property 'return_payload_mass'
|
|
20
20
|
property 'return_payload_vol'
|
|
21
|
-
property '
|
|
21
|
+
property 'sidewall_angle_deg'
|
|
22
|
+
property 'thrusters'
|
|
22
23
|
property 'trunk'
|
|
23
|
-
property '
|
|
24
|
-
property 'diameter'
|
|
25
|
-
property 'flickr_images'
|
|
24
|
+
property 'type'
|
|
26
25
|
property 'wikipedia'
|
|
27
|
-
property 'description'
|
|
28
26
|
|
|
29
|
-
def self.info(
|
|
30
|
-
SPACEX::BaseRequest.info("dragons/#{
|
|
27
|
+
def self.info(id = nil)
|
|
28
|
+
SPACEX::BaseRequest.info("dragons/#{id}", SPACEX::Dragons)
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
end
|
data/lib/spacex/history.rb
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
-
|
|
2
|
+
class History < SPACEX::Resource
|
|
3
|
+
property 'details'
|
|
4
|
+
property 'event_date_unix'
|
|
5
|
+
property 'event_date_utc'
|
|
6
|
+
property 'id'
|
|
7
|
+
property 'links'
|
|
8
|
+
property 'title'
|
|
9
|
+
|
|
3
10
|
def self.info(id = nil)
|
|
4
|
-
SPACEX::BaseRequest.info("history/#{id}")
|
|
11
|
+
SPACEX::BaseRequest.info("history/#{id}", SPACEX::History)
|
|
5
12
|
end
|
|
6
13
|
end
|
|
7
14
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module SPACEX
|
|
2
|
+
class Landpads < SPACEX::Resource
|
|
3
|
+
property 'details'
|
|
4
|
+
property 'full_name'
|
|
5
|
+
property 'id'
|
|
6
|
+
property 'images'
|
|
7
|
+
property 'landing_attempts'
|
|
8
|
+
property 'landing_successes'
|
|
9
|
+
property 'latitude'
|
|
10
|
+
property 'launches'
|
|
11
|
+
property 'locality'
|
|
12
|
+
property 'longitude'
|
|
13
|
+
property 'name'
|
|
14
|
+
property 'region'
|
|
15
|
+
property 'status'
|
|
16
|
+
property 'type'
|
|
17
|
+
property 'wikipedia'
|
|
18
|
+
|
|
19
|
+
def self.info(id = nil)
|
|
20
|
+
SPACEX::BaseRequest.info("landpads/#{id}", SPACEX::Landpads)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/spacex/launches.rb
CHANGED
|
@@ -1,27 +1,51 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
class Launches < SPACEX::Resource
|
|
3
|
+
property 'auto_update'
|
|
4
|
+
property 'capsules'
|
|
5
|
+
property 'cores'
|
|
6
|
+
property 'crew'
|
|
7
|
+
property 'date_local'
|
|
8
|
+
property 'date_precision'
|
|
9
|
+
property 'date_unix'
|
|
10
|
+
property 'date_utc'
|
|
11
|
+
property 'details'
|
|
12
|
+
property 'failures'
|
|
13
|
+
property 'fairings'
|
|
14
|
+
property 'flight_number'
|
|
15
|
+
property 'id'
|
|
16
|
+
property 'launch_library_id'
|
|
17
|
+
property 'launchpad'
|
|
18
|
+
property 'links'
|
|
19
|
+
property 'name'
|
|
20
|
+
property 'net'
|
|
21
|
+
property 'payloads'
|
|
22
|
+
property 'rocket'
|
|
23
|
+
property 'ships'
|
|
24
|
+
property 'static_fire_date_unix'
|
|
25
|
+
property 'static_fire_date_utc'
|
|
26
|
+
property 'success'
|
|
27
|
+
property 'tbd'
|
|
28
|
+
property 'upcoming'
|
|
29
|
+
property 'window'
|
|
30
|
+
|
|
31
|
+
def self.info(id = nil)
|
|
32
|
+
SPACEX::BaseRequest.info("launches/#{id}", SPACEX::Launches)
|
|
5
33
|
end
|
|
6
34
|
|
|
7
35
|
def self.latest
|
|
8
|
-
SPACEX::BaseRequest.info('launches/latest')
|
|
36
|
+
SPACEX::BaseRequest.info('launches/latest', SPACEX::Launches)
|
|
9
37
|
end
|
|
10
38
|
|
|
11
39
|
def self.next
|
|
12
|
-
SPACEX::BaseRequest.info('launches/next')
|
|
40
|
+
SPACEX::BaseRequest.info('launches/next', SPACEX::Launches)
|
|
13
41
|
end
|
|
14
42
|
|
|
15
43
|
def self.past
|
|
16
|
-
SPACEX::BaseRequest.info('launches/past')
|
|
44
|
+
SPACEX::BaseRequest.info('launches/past', SPACEX::Launches)
|
|
17
45
|
end
|
|
18
46
|
|
|
19
47
|
def self.upcoming
|
|
20
|
-
SPACEX::BaseRequest.info('launches/upcoming')
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def self.all
|
|
24
|
-
info
|
|
48
|
+
SPACEX::BaseRequest.info('launches/upcoming', SPACEX::Launches)
|
|
25
49
|
end
|
|
26
50
|
end
|
|
27
51
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module SPACEX
|
|
2
|
+
class Launchpads < SPACEX::Resource
|
|
3
|
+
property 'details'
|
|
4
|
+
property 'full_name'
|
|
5
|
+
property 'id'
|
|
6
|
+
property 'images'
|
|
7
|
+
property 'latitude'
|
|
8
|
+
property 'launch_attempts'
|
|
9
|
+
property 'launch_successes'
|
|
10
|
+
property 'launches'
|
|
11
|
+
property 'locality'
|
|
12
|
+
property 'longitude'
|
|
13
|
+
property 'name'
|
|
14
|
+
property 'region'
|
|
15
|
+
property 'rockets'
|
|
16
|
+
property 'status'
|
|
17
|
+
property 'timezone'
|
|
18
|
+
|
|
19
|
+
def self.info(id = nil)
|
|
20
|
+
SPACEX::BaseRequest.info("launchpads/#{id}", SPACEX::Launchpads)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module SPACEX
|
|
2
|
+
autoload :Capsules, 'spacex/capsules'
|
|
3
|
+
autoload :Company, 'spacex/company'
|
|
4
|
+
autoload :Cores, 'spacex/cores'
|
|
5
|
+
autoload :Crew, 'spacex/crew'
|
|
6
|
+
autoload :Dragons, 'spacex/dragons'
|
|
7
|
+
autoload :History, 'spacex/history'
|
|
8
|
+
autoload :Landpads, 'spacex/landpads'
|
|
9
|
+
autoload :Launches, 'spacex/launches'
|
|
10
|
+
autoload :Launchpads, 'spacex/launchpads'
|
|
11
|
+
autoload :Payloads, 'spacex/payloads'
|
|
12
|
+
autoload :Roadster, 'spacex/roadster'
|
|
13
|
+
autoload :Rockets, 'spacex/rockets'
|
|
14
|
+
autoload :Ships, 'spacex/ships'
|
|
15
|
+
autoload :Starlink, 'spacex/starlink'
|
|
16
|
+
end
|
data/lib/spacex/payloads.rb
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
-
|
|
2
|
+
class Payloads < SPACEX::Resource
|
|
3
|
+
property 'apoapsis_km'
|
|
4
|
+
property 'arg_of_pericenter'
|
|
5
|
+
property 'customers'
|
|
6
|
+
property 'dragon'
|
|
7
|
+
property 'eccentricity'
|
|
8
|
+
property 'epoch'
|
|
9
|
+
property 'id'
|
|
10
|
+
property 'inclination_deg'
|
|
11
|
+
property 'launch'
|
|
12
|
+
property 'lifespan_years'
|
|
13
|
+
property 'longitude'
|
|
14
|
+
property 'manufacturers'
|
|
15
|
+
property 'mass_kg'
|
|
16
|
+
property 'mass_lbs'
|
|
17
|
+
property 'mean_anomaly'
|
|
18
|
+
property 'mean_motion'
|
|
19
|
+
property 'name'
|
|
20
|
+
property 'nationalities'
|
|
21
|
+
property 'norad_ids'
|
|
22
|
+
property 'orbit'
|
|
23
|
+
property 'periapsis_km'
|
|
24
|
+
property 'period_min'
|
|
25
|
+
property 'raan'
|
|
26
|
+
property 'reference_system'
|
|
27
|
+
property 'regime'
|
|
28
|
+
property 'reused'
|
|
29
|
+
property 'semi_major_axis_km'
|
|
30
|
+
property 'type'
|
|
31
|
+
|
|
3
32
|
def self.info(id = nil)
|
|
4
|
-
SPACEX::BaseRequest.info("payloads/#{id}")
|
|
33
|
+
SPACEX::BaseRequest.info("payloads/#{id}", SPACEX::Payloads)
|
|
5
34
|
end
|
|
6
35
|
end
|
|
7
36
|
end
|
data/lib/spacex/rockets.rb
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
class Rockets < SPACEX::Resource
|
|
3
|
+
property 'active'
|
|
4
|
+
property 'boosters'
|
|
5
|
+
property 'company'
|
|
6
|
+
property 'cost_per_launch'
|
|
7
|
+
property 'country'
|
|
8
|
+
property 'description'
|
|
9
|
+
property 'diameter'
|
|
10
|
+
property 'engines'
|
|
11
|
+
property 'first_flight'
|
|
12
|
+
property 'first_stage'
|
|
13
|
+
property 'flickr_images'
|
|
14
|
+
property 'height'
|
|
15
|
+
property 'id'
|
|
16
|
+
property 'landing_legs'
|
|
17
|
+
property 'mass'
|
|
18
|
+
property 'name'
|
|
19
|
+
property 'payload_weights'
|
|
20
|
+
property 'second_stage'
|
|
21
|
+
property 'stages'
|
|
22
|
+
property 'success_rate_pct'
|
|
23
|
+
property 'type'
|
|
24
|
+
property 'wikipedia'
|
|
25
|
+
|
|
26
|
+
def self.info(id = nil)
|
|
27
|
+
SPACEX::BaseRequest.info("rockets/#{id}", SPACEX::Rockets)
|
|
5
28
|
end
|
|
6
29
|
end
|
|
7
30
|
end
|
data/lib/spacex/ships.rb
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
module SPACEX
|
|
2
|
-
class Ships <
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
property 'ship_id', from: 'id'
|
|
6
|
-
property 'ship_name'
|
|
7
|
-
property 'ship_model'
|
|
8
|
-
property 'ship_type'
|
|
9
|
-
property 'roles'
|
|
2
|
+
class Ships < SPACEX::Resource
|
|
3
|
+
property 'abs'
|
|
10
4
|
property 'active'
|
|
5
|
+
property 'course_deg'
|
|
6
|
+
property 'home_port'
|
|
7
|
+
property 'id'
|
|
8
|
+
property 'image'
|
|
11
9
|
property 'imo'
|
|
10
|
+
property 'last_ais_update'
|
|
11
|
+
property 'latitude'
|
|
12
|
+
property 'launches'
|
|
13
|
+
property 'legacy_id'
|
|
14
|
+
property 'link'
|
|
15
|
+
property 'longitude'
|
|
16
|
+
property 'mass_kg'
|
|
17
|
+
property 'mass_lbs'
|
|
12
18
|
property 'mmsi'
|
|
13
|
-
property '
|
|
14
|
-
property '
|
|
15
|
-
property '
|
|
16
|
-
property 'weight_kg'
|
|
17
|
-
property 'year_built'
|
|
18
|
-
property 'home_port'
|
|
19
|
-
property 'status'
|
|
19
|
+
property 'model'
|
|
20
|
+
property 'name'
|
|
21
|
+
property 'roles'
|
|
20
22
|
property 'speed_kn'
|
|
21
|
-
property '
|
|
22
|
-
property '
|
|
23
|
-
property '
|
|
24
|
-
property 'attempted_landings'
|
|
25
|
-
property 'missions'
|
|
26
|
-
property 'url'
|
|
27
|
-
property 'image'
|
|
23
|
+
property 'status'
|
|
24
|
+
property 'type'
|
|
25
|
+
property 'year_built'
|
|
28
26
|
|
|
29
|
-
def self.info(
|
|
30
|
-
SPACEX::BaseRequest.info("ships/#{
|
|
27
|
+
def self.info(id = nil)
|
|
28
|
+
SPACEX::BaseRequest.info("ships/#{id}", SPACEX::Ships)
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module SPACEX
|
|
2
|
+
class Starlink < SPACEX::Resource
|
|
3
|
+
property 'height_km'
|
|
4
|
+
property 'id'
|
|
5
|
+
property 'latitude'
|
|
6
|
+
property 'launch'
|
|
7
|
+
property 'longitude'
|
|
8
|
+
property 'spaceTrack'
|
|
9
|
+
property 'velocity_kms'
|
|
10
|
+
property 'version'
|
|
11
|
+
|
|
12
|
+
def self.info(id = nil)
|
|
13
|
+
SPACEX::BaseRequest.info("starlink/#{id}", SPACEX::Starlink)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/spacex/version.rb
CHANGED