spacex 0.0.5 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +7 -0
  3. data/.github/PULL_REQUEST_TEMPLATE.md +6 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +6 -0
  6. data/.rubocop_todo.yml +9 -23
  7. data/.ruby-version +1 -1
  8. data/.travis.yml +18 -3
  9. data/CHANGELOG.md +61 -0
  10. data/CONTRIBUTING.md +37 -0
  11. data/Gemfile +4 -2
  12. data/README.md +458 -25
  13. data/lib/spacex.rb +15 -4
  14. data/lib/spacex/api_info.rb +7 -0
  15. data/lib/spacex/base_request.rb +51 -13
  16. data/lib/spacex/capsules.rb +19 -0
  17. data/lib/spacex/company_info.rb +1 -3
  18. data/lib/spacex/cores.rb +22 -0
  19. data/lib/spacex/dragon_capsules.rb +33 -0
  20. data/lib/spacex/endpoint.rb +1 -3
  21. data/lib/spacex/history.rb +7 -0
  22. data/lib/spacex/landing_pads.rb +11 -0
  23. data/lib/spacex/launch_pads.rb +11 -0
  24. data/lib/spacex/launches.rb +21 -3
  25. data/lib/spacex/missions.rb +18 -0
  26. data/lib/spacex/payloads.rb +7 -0
  27. data/lib/spacex/resource.rb +5 -0
  28. data/lib/spacex/roadster.rb +7 -0
  29. data/lib/spacex/rockets.rb +7 -0
  30. data/lib/spacex/ships.rb +33 -0
  31. data/lib/spacex/version.rb +1 -4
  32. data/spacex.gemspec +8 -8
  33. data/spec/fixtures/spacex/api_info/info.yml +65 -0
  34. data/spec/fixtures/spacex/capsules.yml +83 -0
  35. data/spec/fixtures/spacex/capsules/C202.yml +123 -0
  36. data/spec/fixtures/spacex/company_info/info.yml +75 -14
  37. data/spec/fixtures/spacex/cores.yml +62 -0
  38. data/spec/fixtures/spacex/cores/B1041.yml +123 -0
  39. data/spec/fixtures/spacex/dragon_capsules/info.yml +77 -0
  40. data/spec/fixtures/spacex/dragon_capsules/info/dragon1.yml +131 -0
  41. data/spec/fixtures/spacex/history/info.yml +62 -0
  42. data/spec/fixtures/spacex/history/info/4.yml +62 -0
  43. data/spec/fixtures/spacex/landing_pads/info.yml +68 -0
  44. data/spec/fixtures/spacex/landing_pads/info/LZ-4.yml +70 -0
  45. data/spec/fixtures/spacex/launch_pads/info.yml +104 -0
  46. data/spec/fixtures/spacex/launch_pads/info/vafb_slc_4e.yml +71 -0
  47. data/spec/fixtures/spacex/launches.yml +62 -0
  48. data/spec/fixtures/spacex/launches/68.yml +69 -0
  49. data/spec/fixtures/spacex/launches/all.yml +62 -0
  50. data/spec/fixtures/spacex/launches/info.yml +62 -0
  51. data/spec/fixtures/spacex/launches/latest.yml +8 -8
  52. data/spec/fixtures/spacex/launches/next.yml +123 -0
  53. data/spec/fixtures/spacex/launches/past.yml +62 -0
  54. data/spec/fixtures/spacex/launches/upcoming.yml +64 -0
  55. data/spec/fixtures/spacex/missions/F3364BF.yml +157 -0
  56. data/spec/fixtures/spacex/missions/info.yml +62 -0
  57. data/spec/fixtures/spacex/payloads/RatSat.yml +62 -0
  58. data/spec/fixtures/spacex/payloads/info.yml +62 -0
  59. data/spec/fixtures/spacex/roadster/info.yml +133 -0
  60. data/spec/fixtures/spacex/rockets/info.yml +105 -0
  61. data/spec/fixtures/spacex/rockets/info/falcon1.yml +139 -0
  62. data/spec/fixtures/spacex/rockets/info/invalid.yml +61 -0
  63. data/spec/fixtures/spacex/ships/info.yml +139 -0
  64. data/spec/fixtures/spacex/ships/info/AMERICANCHAMPION.yml +125 -0
  65. data/spec/spacex/api_info_spec.rb +16 -0
  66. data/spec/spacex/capsules_spec.rb +38 -0
  67. data/spec/spacex/company_info_spec.rb +3 -5
  68. data/spec/spacex/cores_spec.rb +45 -0
  69. data/spec/spacex/dragon_capsules_spec.rb +107 -0
  70. data/spec/spacex/endpoint_spec.rb +9 -0
  71. data/spec/spacex/history_spec.rb +50 -0
  72. data/spec/spacex/landing_pads_spec.rb +72 -0
  73. data/spec/spacex/launch_pads_spec.rb +77 -0
  74. data/spec/spacex/launches_spec.rb +580 -16
  75. data/spec/spacex/missions_spec.rb +35 -0
  76. data/spec/spacex/payloads_spec.rb +62 -0
  77. data/spec/spacex/roadster_spec.rb +36 -0
  78. data/spec/spacex/rockets_spec.rb +210 -0
  79. data/spec/spacex/ships_spec.rb +65 -0
  80. data/spec/spacex/version_spec.rb +1 -3
  81. data/spec/spec_helper.rb +9 -0
  82. metadata +140 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26e5f1c2dfc3df1fb6474f11e1566fe3cc82193b
4
- data.tar.gz: 48f6adde1cc156854b828b88d51536d666adc419
3
+ metadata.gz: 5607f20bf6f57edb0ce7b939c89438e21807f29e
4
+ data.tar.gz: 6babf6b994bad5f9fcfa917efad871360485be28
5
5
  SHA512:
6
- metadata.gz: 2130be20a9251a4a431efdcb325215d9f862d7da3743c715b6f7c448cfd19cb3240607d428fe00bd6b69181b919852a6083d13cee8f4f5bbd515ff2d32ee2568
7
- data.tar.gz: 96e6677d0b36a332d172614d22b95d6b9a73192f232895c00693e0d19a8ea122ac6a8b90d1b9e2a087839160698189a6cb4dad1e852a8e3356e93e48c1a90866
6
+ metadata.gz: 80d2b5726d2e72e74885a54f69ac7e10919b6f882d2f834a86fd3e99513d6f7db1d142cdb00d35c882304ee8b393d0358321477bbebf10d6896c595f6328e762
7
+ data.tar.gz: 3ed27942335b8ce402da3141efd7fb0e34939ab8656b2da619864364321d971f4e3e61c91158a195f5020c315d2cc1411ac685ea38fce740365f0b2425843982
@@ -0,0 +1,7 @@
1
+ ### Purpose of the issue
2
+ - [ ] Bug report (encountered problems/errors)
3
+ - [ ] Feature request (request for new functionality)
4
+ - [ ] Question
5
+
6
+ ### Description of the issue
7
+
@@ -0,0 +1,6 @@
1
+ #### Why?
2
+
3
+
4
+ #### Description
5
+
6
+
data/.gitignore CHANGED
@@ -50,3 +50,4 @@ Gemfile.lock
50
50
  .rvmrc
51
51
 
52
52
  *.gem
53
+ .byebug_history
@@ -5,4 +5,10 @@ AllCops:
5
5
  Naming/MethodName:
6
6
  Enabled: false
7
7
 
8
+ Style/FrozenStringLiteralComment:
9
+ Enabled: false
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
8
14
  inherit_from: .rubocop_todo.yml
@@ -1,38 +1,24 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-08-21 21:48:44 -0400 using RuboCop version 0.51.0.
3
+ # on 2018-11-01 20:09:44 -0400 using RuboCop version 0.51.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- Lint/AmbiguousOperator:
9
+ # Offense count: 4
10
+ Lint/ParenthesesAsGroupedExpression:
11
11
  Exclude:
12
- - 'spec/spacex/launches_spec.rb'
12
+ - 'spec/spacex/dragon_capsules_spec.rb'
13
+ - 'spec/spacex/ships_spec.rb'
13
14
 
14
- # Offense count: 3
15
+ # Offense count: 36
15
16
  # Configuration parameters: CountComments, ExcludedMethods.
16
17
  Metrics/BlockLength:
17
- Max: 71
18
+ Max: 625
18
19
 
19
- # Offense count: 25
20
+ # Offense count: 136
20
21
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
21
22
  # URISchemes: http, https
22
23
  Metrics/LineLength:
23
- Max: 247
24
-
25
- # Offense count: 1
26
- # Configuration parameters: CountComments.
27
- Metrics/MethodLength:
28
- Max: 11
29
-
30
- # Offense count: 4
31
- Style/Documentation:
32
- Exclude:
33
- - 'spec/**/*'
34
- - 'test/**/*'
35
- - 'lib/spacex/base_request.rb'
36
- - 'lib/spacex/company_info.rb'
37
- - 'lib/spacex/launches.rb'
38
- - 'lib/spacex/version.rb'
24
+ Max: 264
@@ -1 +1 @@
1
- 2.4.1
1
+ 2.4.4
@@ -1,6 +1,21 @@
1
- language: ruby
1
+ env:
2
+ global:
3
+ - CC_TEST_REPORTER_ID=$CC_TEST_REPORTER_ID
2
4
 
5
+ language: ruby
6
+ rvm:
7
+ - 2.4.2
3
8
  cache: bundler
9
+ sudo: required
10
+
11
+ before_script:
12
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
13
+ - chmod +x ./cc-test-reporter
14
+ - ./cc-test-reporter before-build
15
+
16
+ script:
17
+ - bundle exec rspec
18
+
19
+ after_script:
20
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
4
21
 
5
- rvm:
6
- - 2.4.1
@@ -0,0 +1,61 @@
1
+ ### 1.0.3 (next)
2
+
3
+ * Your contribution here.
4
+
5
+ ### 1.0.2 (2019/10/06)
6
+
7
+ * [#73](https://github.com/rodolfobandeira/spacex/pull/73): Fix Faraday adaptor failing rspec locally [@rodolfobandeira](https://github.com/rodolfobandeira).
8
+ * [#71](https://github.com/rodolfobandeira/spacex/pull/71): Implement Landing Pads endpoint [@invacuo](https://github.com/invacuo).
9
+ * [#70](https://github.com/rodolfobandeira/spacex/pull/70): Implement Landing Pads endpoint [@invacuo](https://github.com/invacuo).
10
+ * [#69](https://github.com/rodolfobandeira/spacex/pull/69): Implement API Info endpoint [@fernandomaia](https://github.com/fernandomaia).
11
+ * [#65](https://github.com/rodolfobandeira/spacex/pull/65): Add CodeClimate test coverage [@rodolfobandeira](https://github.com/rodolfobandeira).
12
+ * [#64](https://github.com/rodolfobandeira/spacex/pull/64): Fix failing build on Travis-CI [@rodolfobandeira](https://github.com/rodolfobandeira).
13
+
14
+ ### 1.0.1 (2018/11/04)
15
+
16
+ * [#45](https://github.com/rodolfobandeira/spacex/pull/45): Implement History endpoint [@invacuo](https://github.com/invacuo).
17
+ * [#48](https://github.com/rodolfobandeira/spacex/pull/48): Add ability to query specific Launch via `.info('flight_number')` - [@mtking2](https://github.com/mtking2).
18
+ * [#51](https://github.com/rodolfobandeira/spacex/pull/51): Added payloads endpoint [@maiafernando](https://github.com/maiafernando).
19
+ * [#52](https://github.com/rodolfobandeira/spacex/pull/52): Add ability to query Past Launches - [@mtking2](https://github.com/mtking2).
20
+ * [#54](https://github.com/rodolfobandeira/spacex/pull/54): Refactor ENDPOINT_URI - [@ludamillion](https://github.com/ludamillion).
21
+ * [#56](https://github.com/rodolfobandeira/spacex/pull/56): Add ability to query upcoming launches - [@mtking2](https://github.com/mtking2).
22
+
23
+
24
+ ### 1.0.0 (2018/10/15)
25
+
26
+ * [#41](https://github.com/rodolfobandeira/spacex/pull/41): General Refactor cleaning endpoint classes [@invacuo](https://github.com/invacuo).
27
+ * [#44](https://github.com/rodolfobandeira/spacex/pull/44): Add flickr_images key into rockets endpoint [@Dfenniak](https://github.com/Dfenniak).
28
+ * [#42](https://github.com/rodolfobandeira/spacex/pull/42): Add pry gem to debug - [@Dfenniak](https://github.com/Dfenniak).
29
+ * [#40](https://github.com/rodolfobandeira/spacex/pull/40): Update and clarify information in README - [@annawinkler](https://github.com/annawinkler).
30
+ * [#34](https://github.com/rodolfobandeira/spacex/pull/34): Implement Capsules endpoint - [@efl7a](https://github.com/efl7a).
31
+ * [#34](https://github.com/rodolfobandeira/spacex/pull/34): Implement Cores endpoint - [@efl7a](https://github.com/efl7a).
32
+ * [#35](https://github.com/rodolfobandeira/spacex/pull/35): Implement Rockets endpoint - [@invacuo](https://github.com/invacuo).
33
+ * [#28](https://github.com/rodolfobandeira/spacex/pull/28): Add ability to query all launches - [@ludamillion](https://github.com/ludamillion).
34
+ * [#26](https://github.com/rodolfobandeira/spacex/pull/26): Fix dependencies - [@harman28](https://github.com/harman28).
35
+ * [#25](https://github.com/rodolfobandeira/spacex/pull/25): Add code coverage tools - [@harman28](https://github.com/harman28).
36
+ * [#27](https://github.com/rodolfobandeira/spacex/pull/27): Add ability to query next launch - [@Andrey-Raspopov](https://github.com/Andrey-Raspopov)
37
+
38
+
39
+ ### 0.0.7 (2018/10/07)
40
+
41
+ * 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).
42
+ * Add ability to retrieve specific Ship via `.info('ship_id')` - [@rodolfobandeira](https://github.com/rodolfobandeira).
43
+ * Add ability to retrieve specific Dragon Capsule via `.info('dragon_id')` - [@rodolfobandeira](https://github.com/rodolfobandeira).
44
+ * [#10](https://github.com/rodolfobandeira/spacex/pull/10): Added Ships information - [@zainalmustofa](https://github.com/zainalmustofa).
45
+ * [#9](https://github.com/rodolfobandeira/spacex/pull/9): Added Dragon Capsules information - [@JackieCalapristi](https://github.com/JackieCalapristi).
46
+ * [#16](https://github.com/rodolfobandeira/spacex/pull/16): Added missions information - [@maiafernando](https://github.com/maiafernando).
47
+
48
+
49
+ ### 0.0.6 (2018/08/22)
50
+
51
+ * Added Roadster information - [@rodolfobandeira](https://github.com/rodolfobandeira).
52
+
53
+
54
+ ### 0.0.5 (2018/08/21)
55
+
56
+ * Added Company information and General Refactors - [@rodolfobandeira](https://github.com/rodolfobandeira).
57
+
58
+
59
+ ### 0.0.4 (2018/08/21)
60
+
61
+ * Initial public release - [@rodolfobandeira](https://github.com/rodolfobandeira).
@@ -0,0 +1,37 @@
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
+ Use the pull request template to explaing why the PR is being made and give a brief description.
36
+
37
+ Thank you!
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
1
  source 'http://rubygems.org'
2
+ group :test do
3
+ gem 'byebug'
4
+ gem 'pry'
5
+ end
4
6
 
5
7
  gemspec
data/README.md CHANGED
@@ -3,34 +3,328 @@ SpaceX Ruby Client
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/spacex.svg)](https://badge.fury.io/rb/spacex)
5
5
  [![Build Status](https://travis-ci.com/rodolfobandeira/spacex.svg?branch=master)](https://travis-ci.org/rodolfobandeira/spacex)
6
+ [![Coverage Status - Coverall](https://coveralls.io/repos/github/rodolfobandeira/spacex/badge.svg?branch=master)](https://coveralls.io/github/rodolfobandeira/spacex?branch=master)
7
+ [![Maintainability](https://api.codeclimate.com/v1/badges/d125a8ff6d902eb48c8f/maintainability)](https://codeclimate.com/github/rodolfobandeira/spacex/maintainability)
8
+ [![Test Coverage - CodeClimate](https://api.codeclimate.com/v1/badges/d125a8ff6d902eb48c8f/test_coverage)](https://codeclimate.com/github/rodolfobandeira/spacex/test_coverage)
6
9
 
7
- Ruby library that consumes SpaceX API
10
+ A Ruby library that consumes the [SpaceX API](https://github.com/r-spacex/SpaceX-API).
8
11
 
9
12
 
10
13
  ## Table of Contents
11
14
 
12
15
  - [Installation](#installation)
13
16
  - [Usage](#usage)
14
- - [Latest Launch](#latest-launch)
17
+ - [API Info](#api-info)
18
+ - `SPACEX::ApiInfo.info`
19
+ - [Capsules](#capsules)
20
+ - `SPACEX::Capsules.info`
21
+ - `SPACEX::Capsules.info('capsule_serial')`
15
22
  - [Company Info](#company-info)
23
+ - `SPACEX::CompanyInfo.info`
24
+ - [Cores](#cores)
25
+ - `SPACEX::Cores.info`
26
+ - `SPACEX::Cores.info('core_serial')`
27
+ - [Dragon Capsules](#dragon-capsules)
28
+ - `SPACEX::DragonCapsules.info`
29
+ - `SPACEX::DragonCapsules.info('dragon_id')`
30
+ - [History](#history)
31
+ - `SPACEX::History.info`
32
+ - `SPACEX::History.info(4)`
33
+ - [LandingPads](#landing_pads)
34
+ - `SPACEX::LandingPads.info`
35
+ - `SPACEX::LandingPads.info('LZ-4')`
36
+ - [LaunchPads](#launch_pads)
37
+ - `SPACEX::LaunchPads.info`
38
+ - `SPACEX::LaunchPads.info('vafb_slc_4e')`
39
+ - [Launches](#launches)
40
+ - `SPACEX::Launches.all`
41
+ - `SPACEX::Launches.info`
42
+ - `SPACEX::Launches.info('flight_number')`
43
+ - `SPACEX::Launches.latest`
44
+ - `SPACEX::Launches.next`
45
+ - `SPACEX::Launches.past`
46
+ - [Missions](#missions)
47
+ - `SPACEX::Missions.info`
48
+ - `SPACEX::Missions.info('mission_id')`
49
+ - [Payloads](#payloads)
50
+ - `SPACEX::Payloads.info`
51
+ - `SPACEX::Payloads.info('payload_id')`
52
+ - [Roadster](#roadster)
53
+ - `SPACEX::Roadster.info`
54
+ - [Rockets](#rockets)
55
+ - `SPACEX::Rockets.info`
56
+ - `SPACEX::Rockets.info('falcon1')`
57
+ - [Ships](#ships)
58
+ - `SPACEX::Ships.info`
59
+ - `SPACEX::Ships.info('ship_id')`
16
60
  - [Contributing](#contributing)
17
61
  - [Copyright](#copyright)
18
62
 
19
63
 
20
64
  ## Installation
21
65
 
22
- Add to Gemfile.
66
+ Add the gem to your Gemfile:
23
67
 
24
68
  ```
25
69
  gem 'spacex'
26
70
  ```
27
71
 
28
- Run `bundle install`.
72
+ Then run `bundle install`.
29
73
 
30
74
 
31
75
  ## Usage
32
76
 
33
- ### Latest Launch
77
+ ### API Info
78
+
79
+ - Get information about the API: `SPACEX::ApiInfo.info`
80
+
81
+ Here's an example of the response:
82
+
83
+ ```ruby
84
+ api_info = SPACEX::ApiInfo.info
85
+
86
+ api_info.project_name # 'SpaceX-API'
87
+ api_info.description = # 'Open Source REST API for rocket, core, capsule, pad, and launch data, created and maintained by the developers of the r/SpaceX organization'
88
+ api_info.organization = # 'r/SpaceX'
89
+ api_info.organization_link = # 'https://github.com/r-spacex'
90
+ api_info.project_link = # 'https://github.com/r-spacex/SpaceX-API'
91
+ api_info.version = # '3.1.0'
92
+ ```
93
+
94
+ ### Capsules
95
+
96
+ - Get information for all capsules: `SPACEX::Capsules.info`
97
+ - Get information about a specific capsule: `SPACEX::Capsules.info('capsule_serial')`
98
+
99
+ This example shows how to get capsule information and what the data fields are for that object:
100
+
101
+ ```ruby
102
+ capsules_info = SPACEX::Capsules.info
103
+
104
+ capsules_info.first.capsule_id # 'dragon2'
105
+ capsules_info.first.capsule_serial # 'C201'
106
+ capsules_info.first.details # 'Pressure vessel used for Dragon 2 structural testing. Rumored to be repurposed for first Red Dragon Mission'
107
+ capsules_info.first.landings # 0
108
+ capsules_info.first.missions # []
109
+ capsules_info.first.original_launch # nil capsules_info.first.original_launch_unix # nil
110
+ capsules_info.first.status # 'active'
111
+ capsules_info.first.type # 'Dragon 2.0'
112
+ ```
113
+
114
+ ### Company Info
115
+
116
+ - Get information about the company: `SPACEX::CompanyInfo.info`
117
+
118
+ Here is an example of the company information:
119
+
120
+ ```ruby
121
+ company_info = SPACEX::CompanyInfo.info
122
+
123
+ company_info.name # 'SpaceX'
124
+ company_info.founder # 'Elon Musk'
125
+ company_info.founded # 2002
126
+ company_info.employees # 7000
127
+ company_info.vehicles # 3
128
+ company_info.launche_sites # nil
129
+ company_info.test_sites # 1
130
+ company_info.ceo # 'Elon Musk'
131
+ company_info.cto # 'Elon Musk'
132
+ company_info.coo # 'Gwynne Shotwell'
133
+ company_info.cto_propulsion # 'Tom Mueller'
134
+ company_info.valuation # 15_000_000_000
135
+ company_info.headquarters.address # 'Rocket Road'
136
+ company_info.headquarters.city # 'Hawthorne'
137
+ company_info.headquarters.state # 'California'
138
+ 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.'
139
+ ```
140
+
141
+ ### Cores
142
+
143
+ - Get information for all cores: `SPACEX::Cores.info`
144
+ - Get information about a specific core: `SPACEX::Cores.info('core_serial')`
145
+
146
+ The following code snippet shows how to get the cores information and what the data fields are for a single core:
147
+
148
+ ```ruby
149
+ cores_info = SPACEX::Cores.info
150
+
151
+ cores_info.first.asds_attempts # 0
152
+ cores_info.first.asds_landings # 0
153
+ cores_info.first.block # 5
154
+ cores_info.first.core_serial # 'B1052'
155
+ cores_info.first.details # 'On test stand at McGregor'
156
+ cores_info.first.missions # []
157
+ cores_info.first.original_launch # nil
158
+ cores_info.first.original_launch_unix # nil
159
+ cores_info.first.rtls_attempts # 0
160
+ cores_info.first.rtls_landings # 0
161
+ cores_info.first.status # 'active'
162
+ cores_info.first.water_landing # false
163
+ ```
164
+
165
+ ### Dragon Capsules
166
+
167
+ - Get information for all dragon capsules: `SPACEX::DragonCapsules.info`
168
+ - Get information about a specific dragon capsule: `SPACEX::DragonCapsules.info('dragon_id')`
169
+
170
+ This code snippet shows the `dragon1` dragon capsule information:
171
+
172
+ ```ruby
173
+ dragon_capsules = SPACEX::DragonCapsules.info
174
+
175
+ dragon_capsules.first.capsule_id # "dragon1"
176
+ dragon_capsules.first.name # "Dragon 1"
177
+ dragon_capsules.first.type # "capsule"
178
+ dragon_capsules.first.active # true
179
+ dragon_capsules.first.crew_capacity # 0
180
+ dragon_capsules.first.sidewall_angle_deg # 15
181
+ dragon_capsules.first.orbit_duration_yr # 2
182
+ dragon_capsules.first.dry_mass_kg # 4200
183
+ dragon_capsules.first.dry_mass_lb # 9300
184
+ dragon_capsules.first.first_flight # "2010-12-08"
185
+ dragon_capsules.first.heat_shield['material'] # "PICA-X"
186
+ dragon_capsules.first.heat_shield['size_meters'] # 3.6
187
+ dragon_capsules.first.heat_shield['temp_degrees'] # 3000
188
+ dragon_capsules.first.heat_shield['dev_partner'] # "NASA"
189
+ dragon_capsules.first.thrusters[0]['type'] # "Draco"
190
+ dragon_capsules.first.thrusters[0]['amount'] # 18
191
+ dragon_capsules.first.thrusters[0]['pods'] # 4
192
+ dragon_capsules.first.thrusters[0]['fuel_1'] # "nitrogen tetroxide"
193
+ dragon_capsules.first.thrusters[0]['fuel_2'] # "monomethylhydrazine"
194
+ dragon_capsules.first.thrusters[0]['thrust']['kN'] # 0.4
195
+ dragon_capsules.first.thrusters[0]['thrust']['lbf'] # 90
196
+ dragon_capsules.first.launch_payload_mass['kg'] # 6000
197
+ dragon_capsules.first.launch_payload_mass['lb'] # 13228
198
+ dragon_capsules.first.launch_payload_vol['cubic_meters'] # 25
199
+ dragon_capsules.first.launch_payload_vol['cubic_feet'] # 883
200
+ dragon_capsules.first.return_payload_mass['kg'] # 3000
201
+ dragon_capsules.first.return_payload_mass['lb'] # 6614
202
+ dragon_capsules.first.return_payload_vol['cubic_meters'] # 11
203
+ dragon_capsules.first.return_payload_vol['cubic_feet'] # 388
204
+ dragon_capsules.first.pressurized_capsule['payload_volume']['cubic_meters']) # 11
205
+ dragon_capsules.first.pressurized_capsule['payload_volume']['cubic_feet'] # 388
206
+ dragon_capsules.first.trunk['trunk_volume['cubic_meters'] # 14
207
+ dragon_capsules.first.trunk['trunk_volume['cubic_feet'] # 494
208
+ dragon_capsules.first.trunk['cargo']['solar_array'] # 2
209
+ dragon_capsules.first.trunk['cargo']['unpressurized_cargo'] # true
210
+ dragon_capsules.first.height_w_trunk['meters'] # 7.2
211
+ dragon_capsules.first.height_w_trunk['feet'] # 23.6
212
+ dragon_capsules.first.diameter['meters'] # 3.7
213
+ dragon_capsules.first.diameter['feet'] # 12
214
+ dragon_capsules.first.wikipedia # "https://en.wikipedia.org/wiki/SpaceX_Dragon"
215
+ 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)."
216
+ ```
217
+
218
+ ### History
219
+
220
+ - Get information for all historical events: `SPACEX::History.info`
221
+ - Get information about a specific historical event: `SPACEX::History.info('4')`
222
+
223
+ ```ruby
224
+ require 'spacex'
225
+ historical_events = SPACEX::History.info
226
+
227
+ first_event = historical_events.first
228
+ first_event.id # 1
229
+ first_event.title # Falcon 1 Makes History
230
+ first_event.event_date_utc # 2008-09-28T23:15:00Z
231
+ first_event.event_date_unix # 1222643700
232
+ first_event.flight_number # 4
233
+ first_event.details # Falcon 1 becomes the first privately developed liquid fuel rocket to reach Earth orbit.
234
+ first_event.links['reddit'] # nil
235
+ first_event.links['article'] # http://www.spacex.com/news/2013/02/11/flight-4-launch-update-0
236
+ first_event.links['wikipedia'] # https://en.wikipedia.org/wiki/Falcon_1
237
+ ```
238
+
239
+ ### LandingPads
240
+
241
+ - Get information for all LandingPads: `SPACEX::LandingPads.info`
242
+ - Get information about a specific LandingPad: `SPACEX::LandingPads.info('LZ-4')`
243
+
244
+ This code shows how to get the information for a specific LandingPad by id and lists the fields:
245
+
246
+ ```ruby
247
+ landing_pad = SPACEX::LandingPads.info('LZ-4')
248
+ landing_pad.id # 'LZ-4'
249
+ landing_pad.full_name # 'Landing Zone 4'
250
+ landing_pad.status # 'active'
251
+ landing_pad.location['name'] # 'Vandenberg Air Force Base'
252
+ landing_pad.location['region'] # 'California'
253
+ landing_pad.location['latitude'] # 34.632989
254
+ landing_pad.location['longitude'] # -120.615167
255
+ landing_pad.landing_type # 'RTLS'
256
+ landing_pad.attempted_landings # 2
257
+ landing_pad.successful_landings # 2
258
+ landing_pad.wikipedia # "https://en.wikipedia.org/wiki/Vandenberg_AFB_Space_Launch_Complex_4#LZ-4_landing_history"
259
+ landing_pad.details # "SpaceX's west coast landing pad. The pad is adjacent to SLC-4E, SpaceX's west coast launch site. The pad was under construction for about a year starting in 2016. After concerns with seal mating season, this pad was first used for the SAOCOM 1A mission in October 2018. Officially referred to as LZ-4 in FCC filings."
260
+ ```
261
+
262
+ ### LaunchPads
263
+
264
+ - Get information for all LaunchPads: `SPACEX::LaunchPads.info`
265
+ - Get information about a specific LaunchPad: `SPACEX::LaunchPads.info('vafb_slc_4e')`
266
+
267
+ This code shows how to get the information for a specific LaunchPad by site_id and lists the fields:
268
+
269
+ ```ruby
270
+ launch_pad = SPACEX::LaunchPads.info('vafb_slc_4e')
271
+
272
+ launch_pad.id # 6
273
+ launch_pad.name # 'VAFB SLC 4E'
274
+ launch_pad.status # 'active'
275
+ launch_pad.location['name'] # 'Vandenberg Air Force Base',
276
+ launch_pad.location['region'] # 'California',
277
+ launch_pad.location['latitude'] # 34.632093,
278
+ launch_pad.location['longitude'] # -120.610829
279
+ launch_pad.vehicles_launched # ['Falcon 9']
280
+ launch_pad.attempted_launches # 15
281
+ launch_pad.successful_launches # 15
282
+ launch_pad.wikipedia # 'https://en.wikipedia.org/wiki/Vandenberg_AFB_Space_Launch_Complex_4'
283
+ launch_pad.details # 'SpaceX primary west coast launch pad for polar orbits and sun synchronous orbits, primarily used for Iridium. Also intended to be capable of launching Falcon Heavy.'
284
+ launch_pad.site_id # 'vafb_slc_4e'
285
+ launch_pad.site_name_long # 'Vandenberg Air Force Base Space Launch Complex 4E'
286
+ ```
287
+
288
+ ### Launches
289
+
290
+ - Get information for all launches: `SPACEX::Launches.all` or `SPACEX::Launches.info`
291
+ - Get information about a specific launch: `SPACEX::Launches.info('flight_number')`
292
+ - Get information on past launches: `SPACEX::Launches.past`
293
+ - Get information on the next launch: `SPACEX::Launches.next`
294
+ - Get the latest launch information: `SPACEX::Launches.latest`
295
+ - Get information on upcoming launches: `SPACEX::Launches.upcoming`
296
+
297
+ This code snippet shows how to get information for a specific launch by flight number and list the fields:
298
+
299
+ ```ruby
300
+ require 'spacex'
301
+ launch_68 = SPACEX::Launches.info(68)
302
+
303
+ launch_68.flight_number # 68
304
+ launch_68.mission_name # 'Telstar 18V'
305
+ launch_68.rocket.rocket_name # 'Falcon 9'
306
+ launch_68.rocket.first_stage.cores.first.land_success # true
307
+ ```
308
+
309
+ This code snippet shows how to get information on past launches:
310
+ ```ruby
311
+ past_launches = SPACEX::Launches.past
312
+
313
+ past_launches.first.flight_number # 1
314
+ past_launches.first.mission_name # 'FalconSat'
315
+ past_launches.first.rocket.rocket_name # 'Falcon 1'
316
+ past_launches.first.launch_success # false
317
+
318
+ past_launches.last.flight_number # 69
319
+ past_launches.last.mission_name # 'SAOCOM 1A'
320
+ past_launches.last.rocket.rocket_name # 'Falcon 9'
321
+ past_launches.last.rocket.first_stage.cores.first.land_success # true
322
+ past_launches.last.launch_success # true
323
+ ```
324
+
325
+
326
+
327
+ The following code snippet shows the latest launch information and the data fields available on the Launch object:
34
328
 
35
329
  ```ruby
36
330
  require 'spacex'
@@ -102,37 +396,176 @@ latest_launch.upcoming # false
102
396
  latest_launch.static_fire_date_utc # '2018-08-02T15:53:00.000Z'
103
397
  ```
104
398
 
399
+ This code snippet shows how to get information on upcoming launches:
400
+ ```ruby
401
+ upcoming_launches = SPACEX::Launches.upcoming
402
+
403
+ upcoming_launches.first.flight_number # 70
404
+ upcoming_launches.first.mission_name # 'Es’hail 2'
405
+ upcoming_launches.first.launch_date_utc # '2018-11-14T20:46:00.000Z'
406
+
407
+ upcoming_launches.last.flight_number # 91
408
+ upcoming_launches.last.mission_name # 'GPS IIIA-3'
409
+ upcoming_launches.last.launch_date_utc # '2019-10-01T00:00:00.000Z'
410
+ ```
411
+
412
+ ### Missions
105
413
 
106
- ### Company Info
414
+ - Get information for all mission: `SPACEX::Missions.info`
415
+ - Get information about a specific mission: `SPACEX::Missions.info('mission_id')`
416
+
417
+ This code shows how to get the first mission information and lists the fields:
107
418
 
108
419
  ```ruby
109
- company_info = SPACEX::CompanyInfo.info
420
+ missions = SPACEX::Missions.info
110
421
 
111
- company_info.name # 'SpaceX'
112
- company_info.founder # 'Elon Musk'
113
- company_info.founded # 2002
114
- company_info.employees # 7000
115
- company_info.vehicles # 3
116
- company_info.launche_sites # nil
117
- company_info.test_sites # 1
118
- company_info.ceo # 'Elon Musk'
119
- company_info.cto # 'Elon Musk'
120
- company_info.coo # 'Gwynne Shotwell'
121
- company_info.cto_propulsion # 'Tom Mueller'
122
- company_info.valuation # 15_000_000_000
123
- company_info.headquarters.address # 'Rocket Road'
124
- company_info.headquarters.city # 'Hawthorne'
125
- company_info.headquarters.state # 'California'
126
- 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.'
422
+ missions.first.mission_id # "F3364BF"
423
+ missions.first.mission_name # "Iridium NEXT"
424
+ missions.first.manufacturers # ["Orbital ATK"]
425
+ 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"]
426
+ missions.first.wikipedia # "https://en.wikipedia.org/wiki/Iridium_satellite_constellation"
427
+ missions.first.website # "https://www.iridiumnext.com/"
428
+ missions.first.twitter # "https://twitter.com/IridiumBoss?lang=en"
429
+ 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."
430
+ ```
431
+
432
+ ### Payloads
433
+
434
+ - Get information for all payloads: `SPACEX::Payloads.info`
435
+ - Get information about a specific payload: `SPACEX::Payloads.info('payload_id')`
436
+
437
+ The following code shows how to get information about a specific payload and lists the payload data fields:
438
+
439
+ ```ruby
440
+ payload = SPACEX::Payloads.info('FalconSAT-2')
441
+
442
+ payload.payload_id # 'FalconSAT-2'
443
+ payload.reused # false
444
+ payload.customers # ['DARPA']
445
+ payload.nationality # 'United States'
446
+ payload.manufacturer # 'SSTL'
447
+ payload.payload_type # 'Satellite'
448
+ payload.payload_mass_kg # 20
449
+ payload.payload_mass_lbs # 43
450
+ payload.orbit # 'LEO'
451
+ 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}
127
452
  ```
128
453
 
454
+ ### Roadster
455
+
456
+ - Get roadster orbital data: `SPACEX::Roadster.info`
457
+
458
+ The following code shows how to get information about the Roadster:
459
+
460
+ ```ruby
461
+ roadster = SPACEX::Roadster.info
462
+
463
+ roadster.name # "Elon Musk's Tesla Roadster"
464
+ roadster.launch_date_utc # '2018-02-06T20:45:00.000Z'
465
+ roadster.launch_date_unix # 1_517_949_900
466
+ roadster.launch_date_kg # nil
467
+ roadster.launch_date_lbs # nil
468
+ roadster.norad_id # 43_205
469
+ roadster.epoch_jd # 2_458_353.027800926
470
+ roadster.orbit_type # 'heliocentric'
471
+ roadster.apoapsis_au # 1.663757412460597
472
+ roadster.periapsis_au # 0.9860953641129515
473
+ roadster.semo_major_axis_au # nil
474
+ roadster.eccentricity # 0.2557357353354217
475
+ roadster.inclination # 1.077474057737451
476
+ roadster.longitude # 317.0962040947829
477
+ roadster.periapsis_arg # 177.491390597234
478
+ roadster.speed_kph # 76_703.72399999999
479
+ roadster.speed_mph # 47_661.469685603995
480
+ roadster.earth_distance_km # 172_954_806.23899576
481
+ roadster.earth_distance_mi # 107_469_100.90753104
482
+ roadster.mars_distance_km # 147_648_108.6344399
483
+ roadster.mars_distance_mi # 91_744_252.91029055
484
+ roadster.wikipedia # 'https://en.wikipedia.org/wiki/Elon_Musk%27s_Tesla_Roadster'
485
+ 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."
486
+ ```
487
+
488
+ ### Rockets
489
+
490
+ - Get information for all rockets: `SPACEX::Rockets.info`
491
+ - Get information about a specific rocket: `SPACEX::Rockets.info('rocket_id')`
492
+
493
+ This example shows a single rocket and its data fields:
494
+
495
+ ```
496
+ rockets = SPACEX::Rockets.info
497
+ first_rocket = rockets.first
498
+
499
+ first_rocket.id # 1
500
+ first_rocket.active # false
501
+ first_rocket.stages # 2
502
+ first_rocket.boosters # 0
503
+ first_rocket.cost_per_launch # 6700000
504
+ first_rocket.success_rate_pct # 40
505
+ first_rocket.first_flight # "2006-03-24"
506
+ first_rocket.country # "Republic of the Marshall Islands"
507
+ first_rocket.company # "SpaceX"
508
+ first_rocket.height # {"meters"=>22.25, "feet"=>73}
509
+ first_rocket.diameter # {"meters"=>1.68, "feet"=>5.5}
510
+ first_rocket.mass # {"kg"=>30146, "lb"=>66460}
511
+ first_rocket.payload_weights # [{"id"=>"leo", "name"=>"Low Earth Orbit", "kg"=>450, "lb"=>992}]
512
+ 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}}
513
+ 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}}}}
514
+ 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}
515
+ first_rocket.landing_legs # {"number"=>0, "material"=>nil}
516
+ first_rocket.wikipedia # "https://en.wikipedia.org/wiki/Falcon_1"
517
+ 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."
518
+ first_rocket.rocket_id # "falcon1"
519
+ first_rocket.rocket_name # "Falcon 1"
520
+ first_rocket.rocket_type # "rocket"
521
+ 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"]
522
+ ```
523
+
524
+ ### Ships
525
+
526
+ - Get information for all ships: `SPACEX::Ships.info`
527
+ - Get information about a specific ship: `SPACEX::Ships.info('ship_id')`
528
+
529
+ The following code shows how to get information about a specific ship and lists the ship data fields:
530
+
531
+ ```ruby
532
+ ship = SPACEX::Ships.info('AMERICANCHAMPION')
533
+
534
+ ship.ship_id # 'AMERICANCHAMPION'
535
+ ship.ship_name # 'American Champion'
536
+ ship.ship_model # nil
537
+ ship.ship_type # 'Tug'
538
+ ship.roles # ['Support Ship', 'Barge Tug']
539
+ ship.active # false
540
+ ship.imo # 7_434_016
541
+ ship.mmsi # 367_020_820
542
+ ship.abs # 571_252
543
+ ship.ship_class # 7_604_342 # Call as array since "class" is a method in Ruby
544
+ ship.weight_lbs # 588_000
545
+ ship.weight_kg # 266_712
546
+ ship.year_built # 1976
547
+ ship.home_port # 'Port of Los Angeles'
548
+ ship.status # 'Stopped'
549
+ ship.speed_kn # 0
550
+ ship.course_deg # nil
551
+ ship.position # ({ 'latitude' => 30.52852, 'longitude' => -88.09869 })
552
+ ship.successful_landings # nil
553
+ ship.attempted_landings # nil
554
+ ship.missions # [{ 'flight' => 7, 'name' => 'COTS 1' }, { 'flight' => 8, 'name' => 'COTS 2' }]
555
+ ship.url # 'https://www.marinetraffic.com/en/ais/details/ships/shipid:434663/vessel:AMERICAN%20CHAMPION'
556
+ ship.image # 'https://i.imgur.com/woCxpkj.jpg'
557
+ ```
558
+
559
+
129
560
  ## Contributing
130
561
 
131
- Want to help? Create an issue, open a pull request. Any help is welcome.
562
+ See [CONTRIBUTING](CONTRIBUTING.md).
563
+
564
+ [List of awesome people that already helped this project](CHANGELOG.md).
132
565
 
133
566
 
134
567
  ## Copyright
135
568
 
136
- Copyright (c) Rodolfo Bandeira, 2018
569
+ Copyright (c) 2018, [Rodolfo Bandeira](https://twitter.com/rodolfobandeira) and [Contributors](CHANGELOG.md).
137
570
 
138
571
  MIT License, see [LICENSE](https://github.com/rodolfobandeira/spacex/blob/master/LICENSE) for details.