nasa_apod 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/nasa_apod/client.rb +7 -0
- data/lib/nasa_apod/version.rb +1 -1
- data/spec/nasa_apod_spec.rb +10 -0
- 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: 3579d3550ea8cb884d5dc88ca9e87b1f7a1c0101
|
4
|
+
data.tar.gz: 711a1767a003a9776871391d7eca0277576c908f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 039d50bfc573efffb0445ddae976a6957899f07e266189ab5f9cbe755d353925aeb0ddae9893a5d75df9735bd24d49452270125b3afa4c97e7289ae0f7887dd7
|
7
|
+
data.tar.gz: f298603be5482d3d2c70cb50a1843733a929d427eed34523da3b729f174a691ca5c5439007005cbe0ea84a0b25610113a41e87bbc417a39a74efe70c848c8e61
|
data/README.md
CHANGED
@@ -18,12 +18,19 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
+
Search by date:
|
21
22
|
```
|
22
23
|
client = NasaApod::Client.new(api_key: "DEMO_KEY") #DEMO_KEY usage is limited.
|
23
24
|
result = client.search(date: "2015-06-18") #You can also pass in a Ruby Date object.
|
24
25
|
result
|
25
26
|
```
|
26
27
|
|
28
|
+
Random post:
|
29
|
+
```
|
30
|
+
result = client.wormhole #can optionally pass in list_concepts: true for concept tags.
|
31
|
+
result
|
32
|
+
```
|
33
|
+
|
27
34
|
## Contributing
|
28
35
|
|
29
36
|
1. Fork it ( https://github.com/[my-github-username]/nasa_apod/fork )
|
data/lib/nasa_apod/client.rb
CHANGED
@@ -40,6 +40,13 @@ module NasaApod
|
|
40
40
|
handle_response(response)
|
41
41
|
end
|
42
42
|
|
43
|
+
def random_post(options={})
|
44
|
+
date = rand(Date.parse("1995-06-16")..Date.today)
|
45
|
+
search(:date => date)
|
46
|
+
end
|
47
|
+
|
48
|
+
alias_method :wormhole, :random_post
|
49
|
+
|
43
50
|
private
|
44
51
|
|
45
52
|
def handle_response(response)
|
data/lib/nasa_apod/version.rb
CHANGED
data/spec/nasa_apod_spec.rb
CHANGED
@@ -36,6 +36,16 @@ module NasaApod
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
describe '#random_post' do
|
40
|
+
let(:client) { Client.new }
|
41
|
+
|
42
|
+
it 'returns a random post within apod range' do
|
43
|
+
results = client.random_post
|
44
|
+
expect(results.class).to eq(NasaApod::SearchResults)
|
45
|
+
expect(Date.parse(client.date)).to be_between(Date.parse("1995-06-16"),Date.today)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
39
49
|
end
|
40
50
|
|
41
51
|
describe SearchResults do
|
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: 0.0.
|
4
|
+
version: 0.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: 2015-06-
|
11
|
+
date: 2015-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|