mars_photos 0.2.1 → 0.2.2

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: caa7bbd47c9d2326827488405d9bb8f7c204c0ca
4
- data.tar.gz: c3bdafca68b394498a4d8df0479b75892496bc9c
3
+ metadata.gz: 5e89020f09acef91f102a688370b36e939b75a5a
4
+ data.tar.gz: c88788b6701bf6df434678a97e728fa6c0a9c2a2
5
5
  SHA512:
6
- metadata.gz: 3114fb19aaae40ef324004136be9d79f6727466183d0284214ce535009027a6547fa6f251baff45ed07156bfd19a53178ed3f83f1cf9aaf2ad6787b596abe838
7
- data.tar.gz: 27a3d65fcd6356c06bb41bae2e7da1bea50902ab681121c572e873ec1084895e56151c150f7d1365055d688b597db8e1d6a247fc88aa15014eeb2ed8ff944c21
6
+ metadata.gz: a16aba734b9d3b98622f5987d86523a3c8f83555ccac2d6b30707ffec9692844c716199d70a67f8c768cfbe7288ade1ff07b9916a1bb37846fe5204548a3a00d
7
+ data.tar.gz: 2a0d2901c438ca4dee4527ed5ea24dc3cb86c4460803ec36cc1a92cbb62c2b70e289497b56d4571d968b4d2d2dc1a001194209ab362f020e6e9f12c1007a7446
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MarsPhotos
2
2
 
3
- [![Test Coverage](https://codeclimate.com/github/cltweedie/mars_photos/badges/coverage.svg)](https://codeclimate.com/github/cltweedie/mars_photos/coverage)
3
+ [![Gem Version](https://badge.fury.io/rb/mars_photos.svg)](https://badge.fury.io/rb/mars_photos) [![Build Status](https://travis-ci.org/cltweedie/mars_photos.svg?branch=master)](https://travis-ci.org/cltweedie/mars_photos) [![Test Coverage](https://codeclimate.com/github/cltweedie/mars_photos/badges/coverage.svg)](https://codeclimate.com/github/cltweedie/mars_photos/coverage)
4
4
 
5
5
  A Ruby wrapper for NASAs Mars Rover Photos API.
6
6
 
@@ -83,27 +83,19 @@ Images are available from three rovers:
83
83
 
84
84
  Sol is a time measurement representing the number of Martian solar days since the rover landed. It starts from 0.
85
85
 
86
- ### Curiosity's Cameras
87
-
88
- Abbreviation | Camera
89
- ------------ | ------------------------------
90
- FHAZ | Front Hazard Avoidance Camera
91
- RHAZ | Rear Hazard Avoidance Camera
92
- MAST | Mast Camera
93
- CHEMCAM | Chemistry and Camera Complex
94
- MAHLI | Mars Hand Lens Imager
95
- MARDI | Mars Descent Imager
96
- NAVCAM | Navigation Camera
97
-
98
- ### Opportunity and Spirit's Cameras
99
-
100
- Abbreviation | Camera
101
- ------------ | -----------------------------
102
- FHAZ | Front Hazard Avoidance Camera
103
- RHAZ | Rear Hazard Avoidance Camera
104
- PANCAM | Panoramic Camera
105
- NAVCAM | Navigation Camera
106
- MINITES | Miniature Thermal Emission Spectrometer (Mini-TES)
86
+ ### Cameras
87
+
88
+ Abbreviation | Camera | Curiosity | Spirit | Opportunity
89
+ ------------ | -----------------------------------|-----------|--------|------------
90
+ FHAZ | Front Hazard Avoidance Camera | ✓ |✓|✓
91
+ RHAZ | Rear Hazard Avoidance Camera | ✓ |✓|✓
92
+ MAST | Mast Camera | ✓ | |
93
+ CHEMCAM | Chemistry and Camera Complex | ✓ | |
94
+ MAHLI | Mars Hand Lens Imager | ✓ | |
95
+ MARDI | Mars Descent Imager | ✓ | |
96
+ NAVCAM | Navigation Camera | ✓ |✓|✓
97
+ PANCAM | Panoramic Camera | |✓|✓
98
+ MINITES | Mini Thermal Emission Spectrometer| |✓|✓
107
99
 
108
100
  ## Development
109
101
 
@@ -8,7 +8,7 @@ module MarsPhotos
8
8
 
9
9
  def get(params={})
10
10
  params[:key] = @key
11
- url = MarsPhotos::URL.build(params)
11
+ url = URL.build(params)
12
12
  response = HTTParty.get(url)
13
13
 
14
14
  if block_given?
@@ -2,37 +2,28 @@ require 'pry'
2
2
 
3
3
  module MarsPhotos
4
4
  class Rover
5
- attr_accessor :name
6
- def initialize(name)
7
- @name = name
8
- @key = 'DEMO_KEY'
5
+ attr_accessor :name, :key
6
+ def initialize(params = {})
7
+ @name = params[:name]
8
+ @key = params[:key] ? params[:key] : 'DEMO_KEY'
9
9
  end
10
10
 
11
11
  def get(parameters = {})
12
12
  parameters[:rover] = @name
13
13
  parameters[:key] = @key
14
- url = MarsPhotos::URL.build(parameters)
14
+ url = URL.build(parameters)
15
15
  response = HTTParty.get(url)
16
16
  response['photos']
17
17
  end
18
18
 
19
19
  def get_by_sol(sol)
20
- url = MarsPhotos::URL.build(rover: name, sol: sol, key: @key)
20
+ url = URL.build(rover: name, sol: sol, key: @key)
21
21
  response = HTTParty.get(url)
22
22
  response['photos']
23
23
  end
24
24
 
25
25
  def get_by_earth_date(earth_date)
26
- url = MarsPhotos::URL.build(rover: name, earth_date: earth_date, key: @key)
27
- response = HTTParty.get(url)
28
- response['photos']
29
- end
30
-
31
- def get_by_sol_and_cam(parameters)
32
- sol = parameters[:sol]
33
- cam = parameters[:cam]
34
- url_rovers = "https://api.nasa.gov/mars-photos/api/v1/rovers/"
35
- url = "#{url_rovers}#{name}/photos?sol=#{sol}&camera=#{cam}&api_key=DEMO_KEY"
26
+ url = URL.build(rover: name, earth_date: earth_date, key: @key)
36
27
  response = HTTParty.get(url)
37
28
  response['photos']
38
29
  end
@@ -11,7 +11,7 @@ module MarsPhotos::URL
11
11
  end
12
12
 
13
13
  camera = params[:cam] ? "&camera=#{params[:cam]}" : ""
14
-
15
- "#{base_url}#{params[:rover]}/photos?api_key=#{params[:key]}#{date}#{camera}"
14
+ page = params[:page] ? "&page=#{params[:page]}" : ""
15
+ "#{base_url}#{params[:rover]}/photos?api_key=#{params[:key]}#{date}#{camera}#{page}"
16
16
  end
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module MarsPhotos
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mars_photos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tweedie
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-04-22 00:00:00.000000000 Z
12
+ date: 2016-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler