SnowNasa 0.1.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 521bdf23afe2e6356600f7c8d7b7475e0eab5aef
4
- data.tar.gz: 8b13855c3ca411b34bdbcd9e0e0d637ff8737f92
3
+ metadata.gz: 3cbb447a87150c85434d5af9ae612800fc9b51be
4
+ data.tar.gz: 01a6d179b06b9a9ca771f902c77b18ecbb14b7e2
5
5
  SHA512:
6
- metadata.gz: b197b405ef059a2dd61b28cc50540a4755ec0e7c7d8551f8f49a5b3645a545184db29d0140af6fd645f75d8bf9a6c09cc5291eda68a356f8cddb63a0453df637
7
- data.tar.gz: b8978d618a1b9718c7c26e7fdcd76f1f1c229994e8ad7a8f651cdc2d063c843ede8b55891ad3313ae1331c0238c2e11d3623df6833dbde1389e16a6732ccf485
6
+ metadata.gz: 6090a0b92d8aa8959ec780ed9d9264730065a84b5c91bc46fc8c2860ca08bb0bb37a3c179f9bfdd84cf1c7874747a9d8f86c577463a765401a6172772ec1a374
7
+ data.tar.gz: 34db1d91416900a6579b725077f9d1a926c72d8ba7df5a424a2bbc2e835c36a47662c80598154d664987e54ca15ac584e79e980c3885316515d90367f1df37cb
data/.travis.yml CHANGED
@@ -1,4 +1,18 @@
1
1
  language: ruby
2
+
3
+
4
+ before_install: gem install bundler -v 1.10.6
5
+
6
+
7
+ env:
8
+ - RAILS_VERSION="~> 3.2.22"
9
+ - RAILS_VERSION="~> 4.0.13"
10
+ - RAILS_VERSION="~> 4.1.13"
11
+ - RAILS_VERSION="~> 4.2.4"
12
+
2
13
  rvm:
3
- - 2.2.3
4
- before_install: gem install bundler -v 1.11.2
14
+ - 1.9.3
15
+ - 2.0.0
16
+ - 2.1.4
17
+ - 2.2.2
18
+
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # SnowNasa
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/SnowNasa`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
@@ -20,22 +16,41 @@ Or install it yourself as:
20
16
 
21
17
  $ gem install SnowNasa
22
18
 
23
- ## Usage
19
+ ## Install the initializer
20
+ ```ruby
21
+ rails g snow_nasa:config
22
+ #this is optional and it makes it easy to set the nasa_api_key only once, otherwise you will need to set the nasa_api_key global each time you make a request.
23
+ ```
24
24
 
25
- TODO: Write usage instructions here
25
+ ## Get the Astronomy Picture of the Day
26
26
 
27
- ## Development
27
+ ```ruby
28
+ SnowNasa::Apod.getAstroPic
29
+ ```
28
30
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
+ ## Get Earth Images
30
32
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
+ ```ruby
34
+ SnowNasa::Earthimg.getEarthImages(:lat => "1.5", :lon => "100.75", :date => "2014-02-01", :cloud_code => "True")
35
+ #cloud_code is optional.
36
+ ```
32
37
 
33
- ## Contributing
38
+ ## Get Mars Rover Pics
34
39
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/SnowNasa. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
40
+ Get a list of cameras attached to the rovers
36
41
 
42
+ ```ruby
43
+ SnowNasa::Marsroverphotos.cameras
44
+ ```
37
45
 
38
- ## License
46
+ Get pictures from the rover
39
47
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
48
+ ```ruby
49
+ SnowNasa::Marsroverphotos.getMarsPics(:sol => "1000", :camera => "fhaz", :page => "1", :rover => "curiosity")
50
+ ```
41
51
 
52
+ ## Get Near Earth Objects (Asteroids)
53
+
54
+ ```ruby
55
+ SnowNasa::Neobjects.getNeo(:start_date => "2016-05-27", :end_date => "2016-05-31")
56
+ ```
data/SnowNasa.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'SnowNasa/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "SnowNasa"
8
8
  spec.version = SnowNasa::VERSION
9
- spec.authors = ["Justin"]
9
+ spec.authors = ["Justin Snow"]
10
10
  spec.email = ["jrsnow8921@gmail.com"]
11
11
 
12
12
  spec.summary = %q{A gem to interact with Nasa's api}
@@ -1,11 +1,11 @@
1
1
  module SnowNasa
2
- class AstroPicOfDay
2
+ class Apod
3
3
  include SnowNasa
4
4
 
5
5
  def self.getAstroPic
6
6
  base_url = "https://api.nasa.gov/planetary/apod?api_key=#{@@nasa_api_key}"
7
7
  data = open(base_url).read
8
8
  JSON.parse(data)
9
- end
9
+ end
10
10
  end
11
- end
11
+ end
@@ -1,20 +1,20 @@
1
1
  module SnowNasa
2
- class EarthImagery
2
+ class Earthimg
3
3
  include SnowNasa
4
4
 
5
5
  def self.getEarthImages(options = {})
6
6
  lat = options[:lat]
7
7
  lon = options[:lon]
8
8
  dim = options[:dim]
9
- date = (options[:date].to_d).strftime("%Y-%m-%d")
9
+ date = (options[:date].to_date).strftime("%Y-%m-%d")
10
10
  cloud_score = options[:cloud_score]
11
11
  if cloud_score.nil?
12
- base_url = "https://api.nasa.gov/planetary/earth/imagery?lon=#{lon}&lat=#{lat}&date=#{date}&api_key=#{nasa_api_key}"
12
+ base_url = "https://api.nasa.gov/planetary/earth/imagery?lon=#{lon}&lat=#{lat}&date=#{date}&api_key=#{@@nasa_api_key}"
13
13
  else
14
- base_url = "https://api.nasa.gov/planetary/earth/imagery?lon=#{lon}&lat=#{lat}&date=#{date}&cloud_score=True&api_key=#{nasa_api_key}"
14
+ base_url = "https://api.nasa.gov/planetary/earth/imagery?lon=#{lon}&lat=#{lat}&date=#{date}&cloud_score=True&api_key=#{@@nasa_api_key}"
15
15
  end
16
16
  data = open(base_url).read
17
17
  JSON.parse(data)
18
18
  end
19
- end
20
- end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  module SnowNasa
2
- class MarsRoverPhotos
2
+ class Marsroverphotos
3
3
  include SnowNasa
4
4
 
5
5
  def self.cameras
@@ -11,19 +11,19 @@ module SnowNasa
11
11
  mardi = "(MARDI)= Mars Descent Imager- This is onboard Curiousity only\n".yellow
12
12
  navcam = "(NAVCAM)= Navigation Camera- This is onboard Curiousity, Opportunity, and Spirit\n".red
13
13
  pancam = "(PANCAM)= Panoramic Camera- This is onboard Opportunity, and Spirit\n".green
14
- minites = "(MINITES)= Minature Thermal Emission Spectrometer(Mini-TES)- This in onbard Opportunity, and Spirit\n".yellow
14
+ minites = "(MINITES)= Minature Thermal Emission Spectrometer(Mini-TES)- This in onbard Opportunity, and Spirit\n".yellow
15
15
  cams =(
16
16
  fhaz +
17
17
  rhaz +
18
- mast +
18
+ mast +
19
19
  chemcam +
20
20
  mahli +
21
21
  mardi +
22
- navcam +
23
- pancam +
22
+ navcam +
23
+ pancam +
24
24
  minites)
25
25
  list_cams = cams.split(/\n+/).each { |x| puts x }
26
- return nil
26
+ return nil
27
27
  end
28
28
 
29
29
  def self.getMarsPics(options = {})
@@ -32,10 +32,14 @@ module SnowNasa
32
32
  page = options[:page].to_i
33
33
  rover = options[:rover]
34
34
  if camera.nil?
35
- base_url = "https://api.nasa.gov/mars-photos/api/v1/rovers/#{rover}/photos?sol=#{sol}&api_key=#{nasa_api_key}
36
- else
37
- base_url = "https://api.nasa.gov/mars-photos/api/v1/rovers/#{rover}/photos?sol=#{sol}&camera=#{camera}&api_key=#{nasa_api_key}
38
- end
35
+ base_url = "https://api.nasa.gov/mars-photos/api/v1/rovers/#{rover}/photos?sol=#{sol}&api_key=#{@@nasa_api_key}"
36
+ else
37
+ base_url = "https://api.nasa.gov/mars-photos/api/v1/rovers/#{rover}/photos?sol=#{sol}&camera=#{camera}&api_key=#{@@nasa_api_key}"
38
+ end
39
+ data = open(base_url).read
40
+ JSON.parse(data)
39
41
  end
40
- end
42
+ end
41
43
  end
44
+
45
+
@@ -0,0 +1,13 @@
1
+ module SnowNasa
2
+ class Neobjects
3
+ include SnowNasa
4
+
5
+ def self.getNeo(options = {})
6
+ start_date = (options[:start_date].to_date).strftime("%Y-%m-%d")
7
+ end_date = (options[:end_date].to_date).strftime("%Y-%m-%d")
8
+ base_url = "https://api.nasa.gov/neo/rest/v1/feed?start_date=#{start_date}&end_date=#{end_date}&api_key=#{@@nasa_api_key}"
9
+ data = open(base_url).read
10
+ JSON.parse(data)
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module SnowNasa
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/SnowNasa.rb CHANGED
@@ -1,8 +1,8 @@
1
- require "SnowNasa/version"
2
- require "SnowNasa/AstroPicOfDay"
3
- require "SnowNasa/NearEarthObjects"
4
- require "SnowNasa/EarthImagery"
5
- require "SnowNasa/MarsRoverPhotos"
1
+ require 'SnowNasa/version'
2
+ require 'SnowNasa/apod'
3
+ require 'SnowNasa/neobjects'
4
+ require 'SnowNasa/earthimg'
5
+ require 'SnowNasa/marsroverphotos'
6
6
 
7
7
 
8
8
 
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Creates a config file for the SnowNasa gem with a key to access Nasa's Api
3
+
4
+ Example:
5
+ rails g snow_nasa:config
@@ -0,0 +1,12 @@
1
+ module SnowNasa
2
+ module Generators
3
+
4
+ class ConfigGenerator < ::Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ def generate_config
8
+ template "config.rb.erb", "config/initializers/snow_nasa.rb"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ SnowNasa.nasa_api_key('your_nasa_api_key_goes_here')
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SnowNasa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Justin
7
+ - Justin Snow
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
@@ -127,11 +127,14 @@ files:
127
127
  - bin/console
128
128
  - bin/setup
129
129
  - lib/SnowNasa.rb
130
- - lib/SnowNasa/astro_pic_of_day.rb
131
- - lib/SnowNasa/earth_imagery.rb
132
- - lib/SnowNasa/mars_rover_photos.rb
133
- - lib/SnowNasa/near_earth_objects.rb
130
+ - lib/SnowNasa/apod.rb
131
+ - lib/SnowNasa/earthimg.rb
132
+ - lib/SnowNasa/marsroverphotos.rb
133
+ - lib/SnowNasa/neobjects.rb
134
134
  - lib/SnowNasa/version.rb
135
+ - lib/generators/snow_nasa/config/USAGE
136
+ - lib/generators/snow_nasa/config/config_generator.rb
137
+ - lib/generators/snow_nasa/config/templates/config.rb.erb
135
138
  homepage: ''
136
139
  licenses:
137
140
  - MIT
@@ -1,14 +0,0 @@
1
- module SnowNasa
2
- class NearEarthObjects
3
- include SnowNasa
4
-
5
- def self.getNeo(options = {})
6
- start_date = (options[:start_date].to_d).strftime("%Y-%m-%d")
7
- end_date = (options[:end_date].to_d).strftime("%Y-%m-%d")
8
- base_url = "https://api.nasa.gov/neo/rest/v1/feed?start_date=#{start_date}&end_date=#{end_date}&api_key=#{nasa_api_key}"
9
- data = open(base_url).read
10
- JSON.parse(data)
11
- end
12
- end
13
- end
14
-