nasa_apod 1.0.2 → 1.0.3
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 +4 -4
- data/README.md +21 -0
- data/lib/nasa_apod/client.rb +1 -0
- data/lib/nasa_apod/search_results.rb +2 -1
- data/lib/nasa_apod/version.rb +1 -1
- data/spec/nasa_apod_spec.rb +12 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77f64569ecc39352b535f6f5f361becdc6d9c013
|
4
|
+
data.tar.gz: 4b78c2d1f5c3a2ca25d98d607dd9bddf857481e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1fcb548af24930d3889190a9cc37d41f61ac0e10f708eea4ac10f8d640254ab64ac9e9007e2ee13c816f2cc2fd9cfb60b8e32cd2751a17de320f0ae637dd060
|
7
|
+
data.tar.gz: b27503c074a2fae562cd955d0163d49137acc4d282c21c1d4e297e5e08ea487c29d8a092dc8c15658bc04bbeab73be8f8d456fa3066b1fd6e4ccb5f20e69396c
|
data/README.md
CHANGED
@@ -25,6 +25,20 @@ result = client.search(date: "2015-06-18") #You can also pass in a Ruby Date obj
|
|
25
25
|
result
|
26
26
|
```
|
27
27
|
|
28
|
+
Get title:
|
29
|
+
|
30
|
+
```
|
31
|
+
result = client.search
|
32
|
+
result.title #=> "M64: The Black Eye Galaxy"
|
33
|
+
```
|
34
|
+
|
35
|
+
Get explanation:
|
36
|
+
|
37
|
+
```
|
38
|
+
result = client.search
|
39
|
+
result.explanation #=> "This big, bright, beautiful spiral galaxy is Messier 64..."
|
40
|
+
```
|
41
|
+
|
28
42
|
Get concept tags with result
|
29
43
|
```
|
30
44
|
result = client.search(concept_tags: true)
|
@@ -32,6 +46,13 @@ result.concepts #=> ["Sun","Sunspot","Light",...],
|
|
32
46
|
```
|
33
47
|
Note: Not all posts have concept tags.
|
34
48
|
|
49
|
+
Get image URL:
|
50
|
+
|
51
|
+
```
|
52
|
+
result = client.search
|
53
|
+
result.url #=> "http://apod.nasa.gov/apod/image/1506/CeresMountain_Dawn_1041.jpg"
|
54
|
+
```
|
55
|
+
|
35
56
|
Get HD image URL:
|
36
57
|
|
37
58
|
```
|
data/lib/nasa_apod/client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module NasaApod
|
2
2
|
|
3
3
|
class SearchResults
|
4
|
-
attr_accessor :concepts, :url, :media_type, :title, :explanation, :hd_url
|
4
|
+
attr_accessor :concepts, :url, :media_type, :title, :explanation, :hd_url, :date
|
5
5
|
|
6
6
|
def initialize(attributes={})
|
7
7
|
@concepts = attributes["concepts"]
|
@@ -10,6 +10,7 @@ module NasaApod
|
|
10
10
|
@explanation = attributes["explanation"]
|
11
11
|
@title = attributes["title"]
|
12
12
|
@hd_url = attributes["hdurl"]
|
13
|
+
@date = attributes["date"]
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
data/lib/nasa_apod/version.rb
CHANGED
data/spec/nasa_apod_spec.rb
CHANGED
@@ -27,6 +27,11 @@ module NasaApod
|
|
27
27
|
expect(results.class).to eq(NasaApod::SearchResults)
|
28
28
|
end
|
29
29
|
|
30
|
+
it 'returns a date' do
|
31
|
+
results = client.search(:date => Date.today.prev_day)
|
32
|
+
expect(results.date).to eq(Date.today.prev_day.to_s)
|
33
|
+
end
|
34
|
+
|
30
35
|
it 'changes picture when date changes' do
|
31
36
|
results = client.search(:date => Date.today.prev_day)
|
32
37
|
yesterdays_title = results.title
|
@@ -60,17 +65,18 @@ module NasaApod
|
|
60
65
|
expect(attributes['api_key']).to eq('DEMO_KEY')
|
61
66
|
end
|
62
67
|
end
|
63
|
-
|
64
68
|
end
|
65
69
|
|
66
70
|
describe SearchResults do
|
67
71
|
describe '#initialize' do
|
68
72
|
let(:result) { SearchResults.new(attributes) }
|
69
|
-
let(:attributes) {{"url" => "test_url",
|
70
|
-
"concepts" => ["test_concept1","test_concept2"],
|
71
|
-
"media_type" => "JPG",
|
72
|
-
"title" => "Test title",
|
73
|
-
"explanation" => "Test explanation"
|
73
|
+
let(:attributes) {{"url" => "test_url",
|
74
|
+
"concepts" => ["test_concept1","test_concept2"],
|
75
|
+
"media_type" => "JPG",
|
76
|
+
"title" => "Test title",
|
77
|
+
"explanation" => "Test explanation",
|
78
|
+
"date" => "1995-06-16"
|
79
|
+
}}
|
74
80
|
|
75
81
|
it 'assigns all attributes properly' do
|
76
82
|
attributes.keys.each do |attr|
|
@@ -90,7 +96,4 @@ module NasaApod
|
|
90
96
|
end
|
91
97
|
end
|
92
98
|
end
|
93
|
-
|
94
|
-
|
95
|
-
|
96
99
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nasa_apod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabe Dominguez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|