nasa-api-client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bca9e20dcb643ac52629854a03a0327e8418c58a
4
+ data.tar.gz: 6298b32271eb32803d46565167f51e9664ac56a3
5
+ SHA512:
6
+ metadata.gz: b2d90c7cd78c5e103a680533e73b039811726d1ef90ec6b31a2c5b962caee82dcfeaafab81a693511a827a98bbfd6a47ba8111c129c13131a797ffc518e4e2da
7
+ data.tar.gz: 82ecf7c6bae7d64aaa2bd97702795a4f9e6f34389ef39f638d971cb8fda07c2183c869cce4cbe3b103b3d80dea7d41e14b7b231f194651f51ba0a5ebc9f3c0f1
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .git/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - '2.0'
4
+ - '2.1'
5
+ - ruby-head
6
+ script:
7
+ - bundle exec rspec -fd
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: ruby-head
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in knackhq-client.gemspec
4
+ gemspec
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nasa-api-client (0.0.1)
5
+ blanket_wrapper (~> 3.0.0)
6
+ hashie
7
+ rest-client
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ blanket_wrapper (3.0.2)
13
+ httparty
14
+ recursive-open-struct
15
+ codeclimate-test-reporter (0.4.8)
16
+ simplecov (>= 0.7.1, < 1.0.0)
17
+ diff-lcs (1.2.5)
18
+ docile (1.1.5)
19
+ domain_name (0.5.25)
20
+ unf (>= 0.0.5, < 1.0.0)
21
+ hashie (3.4.3)
22
+ http-cookie (1.0.2)
23
+ domain_name (~> 0.5)
24
+ httparty (0.13.7)
25
+ json (~> 1.8)
26
+ multi_xml (>= 0.5.2)
27
+ json (1.8.3)
28
+ mime-types (2.99)
29
+ multi_json (1.11.2)
30
+ multi_xml (0.5.5)
31
+ netrc (0.11.0)
32
+ rake (10.4.2)
33
+ recursive-open-struct (0.6.5)
34
+ rest-client (1.8.0)
35
+ http-cookie (>= 1.0.2, < 2.0)
36
+ mime-types (>= 1.16, < 3.0)
37
+ netrc (~> 0.7)
38
+ rspec (3.2.0)
39
+ rspec-core (~> 3.2.0)
40
+ rspec-expectations (~> 3.2.0)
41
+ rspec-mocks (~> 3.2.0)
42
+ rspec-core (3.2.3)
43
+ rspec-support (~> 3.2.0)
44
+ rspec-expectations (3.2.1)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.2.0)
47
+ rspec-its (1.2.0)
48
+ rspec-core (>= 3.0.0)
49
+ rspec-expectations (>= 3.0.0)
50
+ rspec-mocks (3.2.1)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.2.0)
53
+ rspec-support (3.2.2)
54
+ simplecov (0.9.2)
55
+ docile (~> 1.1.0)
56
+ multi_json (~> 1.0)
57
+ simplecov-html (~> 0.9.0)
58
+ simplecov-html (0.9.0)
59
+ unf (0.1.4)
60
+ unf_ext
61
+ unf_ext (0.0.7.1)
62
+
63
+ PLATFORMS
64
+ ruby
65
+
66
+ DEPENDENCIES
67
+ bundler (~> 1.7)
68
+ codeclimate-test-reporter
69
+ nasa-api-client!
70
+ rake (~> 10.0)
71
+ rspec (~> 3.2.0)
72
+ rspec-its (~> 1.2.0)
73
+ simplecov (~> 0.9.0)
74
+
75
+ BUNDLED WITH
76
+ 1.10.6
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 MichaelAChrisco
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ A Client API FOR SPACE!
2
+
3
+ TODO: Add docs
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nasa/client"
5
+
6
+ require "irb"
7
+ IRB.start
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
@@ -0,0 +1,57 @@
1
+ require 'nasa/client/version'
2
+ require 'blanket'
3
+ require 'hashie'
4
+
5
+ module NASA
6
+ class Client
7
+ attr_accessor :base_uri, :application_id
8
+
9
+ def initialize(_base_uri, application_id)
10
+ @base_uri = 'https://api.nasa.gov/'
11
+ @application_id = application_id
12
+ end
13
+
14
+ def apod(date = Time.now.strftime('%Y-%m-%d'),
15
+ concept_tags = true,
16
+ hd = false)
17
+ request
18
+ .planetary('apod')
19
+ .get(:params => { :api_key => @application_id.dup,
20
+ :concept_tags => concept_tags.to_s,
21
+ :date => date,
22
+ :hd => hd })
23
+ .to_h
24
+ end
25
+
26
+ # end_date is 1 week in seconds
27
+ def neo_feed(start_date = Time.now.strftime('%Y-%m-%d'),
28
+ end_date = (Time.now + 604800).strftime('%Y-%m-%d'))
29
+ request
30
+ .neo
31
+ .rest
32
+ .v1('feed')
33
+ .get(:params => { :api_key => @application_id.dup,
34
+ :start_date => start_date,
35
+ :end_date => end_date })
36
+ .to_h
37
+ end
38
+
39
+ def neo_lookup(asteroid_id)
40
+ request
41
+ .neo
42
+ .rest
43
+ .v1
44
+ .neo(asteroid_id.to_s)
45
+ .get(:params => { :api_key => @application_id.dup })
46
+ .to_h
47
+ end
48
+
49
+ private
50
+
51
+ def request
52
+ headers = { 'Content-Type' => 'application/json' }
53
+ Blanket.wrap(@base_uri.dup,
54
+ :headers => headers)
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,5 @@
1
+ module NASA
2
+ class Client
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nasa/client/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'nasa-api-client'
8
+ spec.version = NASA::Client::VERSION
9
+ spec.authors = ['MichaelAChrisco']
10
+ spec.email = ['michaelachrisco@gmail.com']
11
+
12
+ spec.summary = 'NASA API client'
13
+ spec.description = 'A ruby client. For Space.'
14
+ spec.homepage = 'https://github.com/michaelachrisco/nasa-api-client'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_dependency 'blanket_wrapper', '~> 3.0.0'
24
+ spec.add_dependency 'rest-client'
25
+ spec.add_dependency 'hashie'
26
+ spec.add_development_dependency 'bundler', '~> 1.7'
27
+ spec.add_development_dependency 'codeclimate-test-reporter'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
29
+ spec.add_development_dependency 'rspec', '~> 3.2.0'
30
+ spec.add_development_dependency 'rspec-its', '~> 1.2.0'
31
+ # spec.add_development_dependency 'vcr', '~> 2.9.0'
32
+ # spec.add_development_dependency 'webmock', '~> 1.20.0'
33
+ spec.add_development_dependency 'simplecov', '~> 0.9.0'
34
+ end
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nasa-api-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - MichaelAChrisco
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: blanket_wrapper
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hashie
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: codeclimate-test-reporter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 3.2.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 3.2.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-its
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.2.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.2.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.9.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.9.0
139
+ description: A ruby client. For Space.
140
+ email:
141
+ - michaelachrisco@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".rspec"
148
+ - ".travis.yml"
149
+ - CODE_OF_CONDUCT.md
150
+ - Gemfile
151
+ - Gemfile.lock
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - bin/console
156
+ - bin/setup
157
+ - lib/nasa/client.rb
158
+ - lib/nasa/client/version.rb
159
+ - nasa-api-client.gemspec
160
+ homepage: https://github.com/michaelachrisco/nasa-api-client
161
+ licenses:
162
+ - MIT
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.4.6
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: NASA API client
184
+ test_files: []
185
+ has_rdoc: