nasa_apod 0.0.2 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d0c937cbaee254da9ab931d3407389e407672c5
4
- data.tar.gz: 2d8d580e9f7839c5b83c42744613b8e9748ade03
3
+ metadata.gz: 3579d3550ea8cb884d5dc88ca9e87b1f7a1c0101
4
+ data.tar.gz: 711a1767a003a9776871391d7eca0277576c908f
5
5
  SHA512:
6
- metadata.gz: d152a093d41f7cf36c420716510e6182af8d67d396cd810b43522f70ce0fd5eee3d581968c8a15ebd4e90e9e3d6c82557471eecb26486967c4bf5eb0ec1690b2
7
- data.tar.gz: 1385b33f8b926117768dd927561296785d3bbd4154a292d5b70a6e454f0c35145072cf57c34d8a90a715f702c69d0d44d713798952c5d632688725f127123150
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 )
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module NasaApod
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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.2
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-19 00:00:00.000000000 Z
11
+ date: 2015-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler