spacex 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26e5f1c2dfc3df1fb6474f11e1566fe3cc82193b
4
- data.tar.gz: 48f6adde1cc156854b828b88d51536d666adc419
3
+ metadata.gz: c74162dea1d1f3e802796e8553db4d79ef981ae5
4
+ data.tar.gz: d2e2ed9cd5efddae48184918de2276a83ee93b07
5
5
  SHA512:
6
- metadata.gz: 2130be20a9251a4a431efdcb325215d9f862d7da3743c715b6f7c448cfd19cb3240607d428fe00bd6b69181b919852a6083d13cee8f4f5bbd515ff2d32ee2568
7
- data.tar.gz: 96e6677d0b36a332d172614d22b95d6b9a73192f232895c00693e0d19a8ea122ac6a8b90d1b9e2a087839160698189a6cb4dad1e852a8e3356e93e48c1a90866
6
+ metadata.gz: 7373aa70e494200d0ebc1600e30c32a02c86f5a53c3479cff303b96025b0b49d9e144038f261afa49a631840b512f27b5301c8e8113c65463cf072de7af051e4
7
+ data.tar.gz: b547de5a01d4e95368cd2e5c8f3b52b228d8cb28f2fcd7262ce8159921030f7a0c977a2e3d14bb467712a6a06082d734aa24809c9fa904b4c9815f43dcfe7645
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
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-08-22 09:37:39 -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
@@ -11,23 +11,23 @@ Lint/AmbiguousOperator:
11
11
  Exclude:
12
12
  - 'spec/spacex/launches_spec.rb'
13
13
 
14
- # Offense count: 3
14
+ # Offense count: 5
15
15
  # Configuration parameters: CountComments, ExcludedMethods.
16
16
  Metrics/BlockLength:
17
17
  Max: 71
18
18
 
19
- # Offense count: 25
19
+ # Offense count: 26
20
20
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
21
21
  # URISchemes: http, https
22
22
  Metrics/LineLength:
23
- Max: 247
23
+ Max: 494
24
24
 
25
25
  # Offense count: 1
26
26
  # Configuration parameters: CountComments.
27
27
  Metrics/MethodLength:
28
28
  Max: 11
29
29
 
30
- # Offense count: 4
30
+ # Offense count: 5
31
31
  Style/Documentation:
32
32
  Exclude:
33
33
  - 'spec/**/*'
@@ -35,4 +35,5 @@ Style/Documentation:
35
35
  - 'lib/spacex/base_request.rb'
36
36
  - 'lib/spacex/company_info.rb'
37
37
  - 'lib/spacex/launches.rb'
38
+ - 'lib/spacex/roadster.rb'
38
39
  - 'lib/spacex/version.rb'
data/README.md CHANGED
@@ -13,6 +13,7 @@ Ruby library that consumes SpaceX API
13
13
  - [Usage](#usage)
14
14
  - [Latest Launch](#latest-launch)
15
15
  - [Company Info](#company-info)
16
+ - [Roadster](#roadster)
16
17
  - [Contributing](#contributing)
17
18
  - [Copyright](#copyright)
18
19
 
@@ -126,6 +127,37 @@ company_info.headquarters.state # 'California'
126
127
  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.'
127
128
  ```
128
129
 
130
+ ### Roadster
131
+
132
+ ```ruby
133
+ roadster = SPACEX::Roadster.info
134
+
135
+ roadster.name # "Elon Musk's Tesla Roadster"
136
+ roadster.launch_date_utc # '2018-02-06T20:45:00.000Z'
137
+ roadster.launch_date_unix # 1_517_949_900
138
+ roadster.launch_date_kg # nil
139
+ roadster.launch_date_lbs # nil
140
+ roadster.norad_id # 43_205
141
+ roadster.epoch_jd # 2_458_353.027800926
142
+ roadster.orbit_type # 'heliocentric'
143
+ roadster.apoapsis_au # 1.663757412460597
144
+ roadster.periapsis_au # 0.9860953641129515
145
+ roadster.semo_major_axis_au # nil
146
+ roadster.eccentricity # 0.2557357353354217
147
+ roadster.inclination # 1.077474057737451
148
+ roadster.longitude # 317.0962040947829
149
+ roadster.periapsis_arg # 177.491390597234
150
+ roadster.speed_kph # 76_703.72399999999
151
+ roadster.speed_mph # 47_661.469685603995
152
+ roadster.earth_distance_km # 172_954_806.23899576
153
+ roadster.earth_distance_mi # 107_469_100.90753104
154
+ roadster.mars_distance_km # 147_648_108.6344399
155
+ roadster.mars_distance_mi # 91_744_252.91029055
156
+ roadster.wikipedia # 'https://en.wikipedia.org/wiki/Elon_Musk%27s_Tesla_Roadster'
157
+ 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."
158
+ ```
159
+
160
+
129
161
  ## Contributing
130
162
 
131
163
  Want to help? Create an issue, open a pull request. Any help is welcome.
data/lib/spacex.rb CHANGED
@@ -9,3 +9,4 @@ require_relative 'spacex/base_request'
9
9
  require_relative 'spacex/version'
10
10
  require_relative 'spacex/launches'
11
11
  require_relative 'spacex/company_info'
12
+ require_relative 'spacex/roadster'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SPACEX
4
+ module Roadster
5
+ def self.info
6
+ SPACEX::BaseRequest.get('info/roadster')
7
+ end
8
+ end
9
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SPACEX
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  ROOT_URI = 'https://api.spacexdata.com/v2'
6
6
 
7
7
  def self.help
data/spacex.gemspec CHANGED
@@ -7,8 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.name = 'spacex'
8
8
  s.bindir = 'bin'
9
9
  s.version = SPACEX::VERSION
10
- s.date = '2018-08-17'
11
- s.summary = 'Swap SpaceX API with Ruby'
10
+ s.summary = 'SpaceX API with Ruby'
12
11
  s.description = 'Ruby library to consume SpaceX launch data'
13
12
  s.authors = ['Rodolfo Bandeira']
14
13
  s.email = 'rodolfobandeira@protonmail.com'
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.spacexdata.com/v2/info/roadster
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Wed, 22 Aug 2018 12:43:44 GMT
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=de099dbdaf8adee64cc1bb8b455b7e35f1534941824; expires=Thu, 22-Aug-19
31
+ 12:43:44 GMT; path=/; domain=.spacexdata.com; HttpOnly; Secure
32
+ Vary:
33
+ - Accept-Encoding, Origin
34
+ X-Dns-Prefetch-Control:
35
+ - 'off'
36
+ X-Frame-Options:
37
+ - SAMEORIGIN
38
+ Strict-Transport-Security:
39
+ - max-age=15552000; includeSubDomains
40
+ X-Download-Options:
41
+ - noopen
42
+ X-Content-Type-Options:
43
+ - nosniff
44
+ X-Xss-Protection:
45
+ - 1; mode=block
46
+ Access-Control-Allow-Origin:
47
+ - "*"
48
+ X-Koa-Redis-Cache:
49
+ - 'true'
50
+ X-Response-Time:
51
+ - 2ms
52
+ Expect-Ct:
53
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
54
+ Server:
55
+ - cloudflare
56
+ Cf-Ray:
57
+ - 44e56d43de24aba2-YYZ
58
+ body:
59
+ encoding: ASCII-8BIT
60
+ string: '{"name":"Elon Musk''s Tesla Roadster","launch_date_utc":"2018-02-06T20:45:00.000Z","launch_date_unix":1517949900,"launch_mass_kg":1350,"launch_mass_lbs":2976,"norad_id":43205,"epoch_jd":2458353.027800926,"orbit_type":"heliocentric","apoapsis_au":1.663757412460597,"periapsis_au":0.9860953641129515,"semi_major_axis_au":128.9377154487144,"eccentricity":0.2557357353354217,"inclination":1.077474057737451,"longitude":317.0962040947829,"periapsis_arg":177.491390597234,"period_days":557.0395762229033,"speed_kph":76703.72399999999,"speed_mph":47661.469685603995,"earth_distance_km":172954806.23899576,"earth_distance_mi":107469100.90753104,"mars_distance_km":147648108.6344399,"mars_distance_mi":91744252.91029055,"wikipedia":"https://en.wikipedia.org/wiki/Elon_Musk%27s_Tesla_Roadster","details":"Elon
61
+ Musk''s Tesla Roadster is an electric sports car that served as the dummy
62
+ payload for the February 2018 Falcon Heavy test flight and is now an artificial
63
+ satellite of the Sun. Starman, a mannequin dressed in a spacesuit, occupies
64
+ the driver''s seat. The car and rocket are products of Tesla and SpaceX, both
65
+ companies founded by Elon Musk. This 2008-model Roadster was previously used
66
+ by Musk for commuting, and is the only consumer car sent into space."}'
67
+ http_version:
68
+ recorded_at: Wed, 22 Aug 2018 12:43:44 GMT
69
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe SPACEX do
6
+ context 'Roadster Information', vcr: { cassette_name: 'roadster/info' } do
7
+ subject do
8
+ SPACEX::Roadster.info
9
+ end
10
+ it 'returns Roadster launch info' do
11
+ expect(subject.name).to eq "Elon Musk's Tesla Roadster"
12
+ expect(subject.launch_date_utc).to eq '2018-02-06T20:45:00.000Z'
13
+ expect(subject.launch_date_unix).to eq 1_517_949_900
14
+ expect(subject.launch_date_kg).to eq nil
15
+ expect(subject.launch_date_lbs).to eq nil
16
+ expect(subject.norad_id).to eq 43_205
17
+ expect(subject.epoch_jd).to eq 2_458_353.027800926
18
+ expect(subject.orbit_type).to eq 'heliocentric'
19
+ expect(subject.apoapsis_au).to eq 1.663757412460597
20
+ expect(subject.periapsis_au).to eq 0.9860953641129515
21
+ expect(subject.semo_major_axis_au).to eq nil
22
+ expect(subject.eccentricity).to eq 0.2557357353354217
23
+ expect(subject.inclination).to eq 1.077474057737451
24
+ expect(subject.longitude).to eq 317.0962040947829
25
+ expect(subject.periapsis_arg).to eq 177.491390597234
26
+ expect(subject.speed_kph).to eq 76_703.72399999999
27
+ expect(subject.speed_mph).to eq 47_661.469685603995
28
+ expect(subject.earth_distance_km).to eq 172_954_806.23899576
29
+ expect(subject.earth_distance_mi).to eq 107_469_100.90753104
30
+ expect(subject.mars_distance_km).to eq 147_648_108.6344399
31
+ expect(subject.mars_distance_mi).to eq 91_744_252.91029055
32
+ expect(subject.wikipedia).to eq 'https://en.wikipedia.org/wiki/Elon_Musk%27s_Tesla_Roadster'
33
+ expect(subject.details).to eq "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."
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spacex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodolfo Bandeira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-17 00:00:00.000000000 Z
11
+ date: 2018-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -143,13 +143,16 @@ files:
143
143
  - lib/spacex/company_info.rb
144
144
  - lib/spacex/endpoint.rb
145
145
  - lib/spacex/launches.rb
146
+ - lib/spacex/roadster.rb
146
147
  - lib/spacex/version.rb
147
148
  - rubocop.yml
148
149
  - spacex.gemspec
149
150
  - spec/fixtures/spacex/company_info/info.yml
150
151
  - spec/fixtures/spacex/launches/latest.yml
152
+ - spec/fixtures/spacex/roadster/info.yml
151
153
  - spec/spacex/company_info_spec.rb
152
154
  - spec/spacex/launches_spec.rb
155
+ - spec/spacex/roadster_spec.rb
153
156
  - spec/spacex/version_spec.rb
154
157
  - spec/spec_helper.rb
155
158
  - spec/support/vcr.rb
@@ -176,12 +179,14 @@ rubyforge_project:
176
179
  rubygems_version: 2.6.11
177
180
  signing_key:
178
181
  specification_version: 4
179
- summary: Swap SpaceX API with Ruby
182
+ summary: SpaceX API with Ruby
180
183
  test_files:
181
184
  - spec/fixtures/spacex/company_info/info.yml
182
185
  - spec/fixtures/spacex/launches/latest.yml
186
+ - spec/fixtures/spacex/roadster/info.yml
183
187
  - spec/spacex/company_info_spec.rb
184
188
  - spec/spacex/launches_spec.rb
189
+ - spec/spacex/roadster_spec.rb
185
190
  - spec/spacex/version_spec.rb
186
191
  - spec/spec_helper.rb
187
192
  - spec/support/vcr.rb