usno-imagery 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/usno/imagery.rb +3 -0
- data/lib/usno/imagery/earth/call.rb +16 -0
- data/lib/usno/imagery/earth/call_with_time.rb +16 -0
- data/lib/usno/imagery/earth/earth_view.rb +17 -0
- data/lib/usno/imagery/earth/map.rb +5 -15
- data/lib/usno/imagery/earth/moon.rb +5 -15
- data/lib/usno/imagery/earth/rise.rb +5 -15
- data/lib/usno/imagery/earth/set.rb +5 -15
- data/lib/usno/imagery/earth/sun.rb +4 -14
- data/lib/usno/imagery/version.rb +1 -1
- data/test/unit/usno/imagery/earth/map_test.rb +11 -1
- data/test/unit/usno/imagery/earth/moon_test.rb +10 -0
- data/test/unit/usno/imagery/earth/rise_test.rb +7 -0
- data/test/unit/usno/imagery/earth/set_test.rb +7 -0
- data/test/unit/usno/imagery/earth/sun_test.rb +10 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fabb79015db48b6037ca726a93948839af3d1b88
|
4
|
+
data.tar.gz: e0a6d3688b0efbc0ed415791da8d72485dc101fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb191db6725f9a28fddaad2564e6fbe9d0fc1cbf82ddf8cf738cf0c73052870255e270ce8c4dbb4adec9bab81e1529350d23b5b21cdc96cc9c5e897a5a892cc
|
7
|
+
data.tar.gz: 6c5a7d44b24da88f14820d464f4acb08ee02da8c853b0437f1a0c75f912b9172a6448bed48e673e38a1e6a79d7844f743f4462005d175a1163e28b9cffd34115
|
data/README.md
CHANGED
data/lib/usno/imagery.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require_relative "imagery/version"
|
2
2
|
require_relative "imagery/earth/view"
|
3
|
+
require_relative "imagery/earth/earth_view"
|
4
|
+
require_relative "imagery/earth/call"
|
5
|
+
require_relative "imagery/earth/call_with_time"
|
3
6
|
|
4
7
|
require_relative "imagery/earth/map"
|
5
8
|
require_relative "imagery/earth/rise"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module USNO
|
2
|
+
module Imagery
|
3
|
+
module Earth
|
4
|
+
class EarthView < PayDirt::Base
|
5
|
+
def initialize(options = {})
|
6
|
+
options = {
|
7
|
+
usno_imagery_class: USNO::Imagery::Earth::View
|
8
|
+
}.merge(options)
|
9
|
+
|
10
|
+
# sets instance variables from key value pairs,
|
11
|
+
# will fail if any keys given before options aren't in options
|
12
|
+
load_options(:view, :usno_imagery_class, options)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -3,23 +3,13 @@ require 'pay_dirt'
|
|
3
3
|
module USNO
|
4
4
|
module Imagery
|
5
5
|
module Earth
|
6
|
-
class Map <
|
6
|
+
class Map < EarthView
|
7
|
+
include USNO::Imagery::Earth::CallWithTime
|
8
|
+
|
7
9
|
def initialize(options = {})
|
8
10
|
options = {
|
9
|
-
view: "full"
|
10
|
-
|
11
|
-
}.merge(options)
|
12
|
-
|
13
|
-
# sets instance variables from key value pairs,
|
14
|
-
# will fail if any keys given before options aren't in options
|
15
|
-
load_options(:view, :usno_imagery_class, options)
|
16
|
-
end
|
17
|
-
|
18
|
-
def call
|
19
|
-
result true, @usno_imagery_class.new({
|
20
|
-
view: @view,
|
21
|
-
time: @time || Time.now
|
22
|
-
}).call.data
|
11
|
+
view: "full"
|
12
|
+
}.merge(options) and super
|
23
13
|
end
|
24
14
|
end
|
25
15
|
end
|
@@ -3,23 +3,13 @@ require 'pay_dirt'
|
|
3
3
|
module USNO
|
4
4
|
module Imagery
|
5
5
|
module Earth
|
6
|
-
class Moon <
|
6
|
+
class Moon < EarthView
|
7
|
+
include USNO::Imagery::Earth::CallWithTime
|
8
|
+
|
7
9
|
def initialize(options = {})
|
8
10
|
options = {
|
9
|
-
view: "moon"
|
10
|
-
|
11
|
-
}.merge(options)
|
12
|
-
|
13
|
-
# sets instance variables from key value pairs,
|
14
|
-
# will fail if any keys given before options aren't in options
|
15
|
-
load_options(:view, :usno_imagery_class, options)
|
16
|
-
end
|
17
|
-
|
18
|
-
def call
|
19
|
-
result true, @usno_imagery_class.new({
|
20
|
-
view: @view,
|
21
|
-
time: @time || Time.now
|
22
|
-
}).call.data
|
11
|
+
view: "moon"
|
12
|
+
}.merge(options) and super
|
23
13
|
end
|
24
14
|
end
|
25
15
|
end
|
@@ -3,23 +3,13 @@ require 'pay_dirt'
|
|
3
3
|
module USNO
|
4
4
|
module Imagery
|
5
5
|
module Earth
|
6
|
-
class Rise <
|
6
|
+
class Rise < EarthView
|
7
|
+
include USNO::Imagery::Earth::Call
|
8
|
+
|
7
9
|
def initialize(options = {})
|
8
10
|
options = {
|
9
|
-
view: "rise"
|
10
|
-
|
11
|
-
}.merge(options)
|
12
|
-
|
13
|
-
# sets instance variables from key value pairs,
|
14
|
-
# will fail if any keys given before options aren't in options
|
15
|
-
load_options(:view, :usno_imagery_class, options)
|
16
|
-
end
|
17
|
-
|
18
|
-
def call
|
19
|
-
result true, @usno_imagery_class.new({
|
20
|
-
view: @view,
|
21
|
-
time: nil
|
22
|
-
}).call.data
|
11
|
+
view: "rise"
|
12
|
+
}.merge(options) and super
|
23
13
|
end
|
24
14
|
end
|
25
15
|
end
|
@@ -4,23 +4,13 @@ require 'pay_dirt'
|
|
4
4
|
module USNO
|
5
5
|
module Imagery
|
6
6
|
module Earth
|
7
|
-
class Set <
|
7
|
+
class Set < EarthView
|
8
|
+
include USNO::Imagery::Earth::Call
|
9
|
+
|
8
10
|
def initialize(options = {})
|
9
11
|
options = {
|
10
|
-
view: "set"
|
11
|
-
|
12
|
-
}.merge(options)
|
13
|
-
|
14
|
-
# sets instance variables from key value pairs,
|
15
|
-
# will fail if any keys given before options aren't in options
|
16
|
-
load_options(:view, :usno_imagery_class, options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def call
|
20
|
-
result true, @usno_imagery_class.new({
|
21
|
-
view: @view,
|
22
|
-
time: nil
|
23
|
-
}).call.data
|
12
|
+
view: "set"
|
13
|
+
}.merge(options) and super
|
24
14
|
end
|
25
15
|
end
|
26
16
|
end
|
@@ -3,23 +3,13 @@ require 'pay_dirt'
|
|
3
3
|
module USNO
|
4
4
|
module Imagery
|
5
5
|
module Earth
|
6
|
-
class Sun <
|
6
|
+
class Sun < EarthView
|
7
|
+
include USNO::Imagery::Earth::CallWithTime
|
8
|
+
|
7
9
|
def initialize(options = {})
|
8
10
|
options = {
|
9
11
|
view: "sun",
|
10
|
-
|
11
|
-
}.merge(options)
|
12
|
-
|
13
|
-
# sets instance variables from key value pairs,
|
14
|
-
# will fail if any keys given before options aren't in options
|
15
|
-
load_options(:view, :usno_imagery_class, options)
|
16
|
-
end
|
17
|
-
|
18
|
-
def call
|
19
|
-
result true, @usno_imagery_class.new({
|
20
|
-
view: @view,
|
21
|
-
time: @time || Time.now
|
22
|
-
}).call.data
|
12
|
+
}.merge(options) and super
|
23
13
|
end
|
24
14
|
end
|
25
15
|
end
|
data/lib/usno/imagery/version.rb
CHANGED
@@ -4,7 +4,8 @@ describe USNO::Imagery::Earth::Map do
|
|
4
4
|
before do
|
5
5
|
@subject = USNO::Imagery::Earth::Map
|
6
6
|
@params = {
|
7
|
-
view: "full"
|
7
|
+
view: "full",
|
8
|
+
time: Time.now
|
8
9
|
}
|
9
10
|
end
|
10
11
|
|
@@ -20,5 +21,14 @@ describe USNO::Imagery::Earth::Map do
|
|
20
21
|
result.successful?.must_equal true
|
21
22
|
result.must_be_kind_of PayDirt::Result
|
22
23
|
end
|
24
|
+
|
25
|
+
it "returns the proper url" do
|
26
|
+
result = @subject.new(@params).call.data
|
27
|
+
|
28
|
+
result.must_include @params[:time].strftime("%k:%M").lstrip
|
29
|
+
result.must_include @params[:time].strftime("%m/%d/%Y").lstrip
|
30
|
+
result.must_include "http://api.usno.navy.mil/imagery/earth.png"
|
31
|
+
result.must_include "?view=full"
|
32
|
+
end
|
23
33
|
end
|
24
34
|
end
|
@@ -5,6 +5,7 @@ describe USNO::Imagery::Earth::Moon do
|
|
5
5
|
@subject = USNO::Imagery::Earth::Moon
|
6
6
|
@params = {
|
7
7
|
view: "moon",
|
8
|
+
time: Time.now
|
8
9
|
}
|
9
10
|
end
|
10
11
|
|
@@ -20,5 +21,14 @@ describe USNO::Imagery::Earth::Moon do
|
|
20
21
|
result.successful?.must_equal true
|
21
22
|
result.must_be_kind_of PayDirt::Result
|
22
23
|
end
|
24
|
+
|
25
|
+
it "returns the proper url" do
|
26
|
+
result = @subject.new(@params).call.data
|
27
|
+
|
28
|
+
result.must_include @params[:time].strftime("%k:%M").lstrip
|
29
|
+
result.must_include @params[:time].strftime("%m/%d/%Y").lstrip
|
30
|
+
result.must_include "http://api.usno.navy.mil/imagery/earth.png"
|
31
|
+
result.must_include "?view=moon"
|
32
|
+
end
|
23
33
|
end
|
24
34
|
end
|
@@ -20,5 +20,12 @@ describe USNO::Imagery::Earth::Rise do
|
|
20
20
|
result.successful?.must_equal true
|
21
21
|
result.must_be_kind_of PayDirt::Result
|
22
22
|
end
|
23
|
+
|
24
|
+
it "returns the proper url" do
|
25
|
+
result = @subject.new(@params).call.data
|
26
|
+
|
27
|
+
result.must_include "http://api.usno.navy.mil/imagery/earth.png"
|
28
|
+
result.must_include "?view=rise"
|
29
|
+
end
|
23
30
|
end
|
24
31
|
end
|
@@ -20,5 +20,12 @@ describe USNO::Imagery::Earth::Set do
|
|
20
20
|
result.successful?.must_equal true
|
21
21
|
result.must_be_kind_of PayDirt::Result
|
22
22
|
end
|
23
|
+
|
24
|
+
it "returns the proper url" do
|
25
|
+
result = @subject.new(@params).call.data
|
26
|
+
|
27
|
+
result.must_include "http://api.usno.navy.mil/imagery/earth.png"
|
28
|
+
result.must_include "?view=set"
|
29
|
+
end
|
23
30
|
end
|
24
31
|
end
|
@@ -5,6 +5,7 @@ describe USNO::Imagery::Earth::Sun do
|
|
5
5
|
@subject = USNO::Imagery::Earth::Sun
|
6
6
|
@params = {
|
7
7
|
view: "sun",
|
8
|
+
time: Time.now
|
8
9
|
}
|
9
10
|
end
|
10
11
|
|
@@ -20,5 +21,14 @@ describe USNO::Imagery::Earth::Sun do
|
|
20
21
|
result.successful?.must_equal true
|
21
22
|
result.must_be_kind_of PayDirt::Result
|
22
23
|
end
|
24
|
+
|
25
|
+
it "returns the proper url" do
|
26
|
+
result = @subject.new(@params).call.data
|
27
|
+
|
28
|
+
result.must_include @params[:time].strftime("%k:%M").lstrip
|
29
|
+
result.must_include @params[:time].strftime("%m/%d/%Y").lstrip
|
30
|
+
result.must_include "http://api.usno.navy.mil/imagery/earth.png"
|
31
|
+
result.must_include "?view=sun"
|
32
|
+
end
|
23
33
|
end
|
24
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usno-imagery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan T. Hosford
|
@@ -121,6 +121,9 @@ files:
|
|
121
121
|
- README.md
|
122
122
|
- Rakefile
|
123
123
|
- lib/usno/imagery.rb
|
124
|
+
- lib/usno/imagery/earth/call.rb
|
125
|
+
- lib/usno/imagery/earth/call_with_time.rb
|
126
|
+
- lib/usno/imagery/earth/earth_view.rb
|
124
127
|
- lib/usno/imagery/earth/map.rb
|
125
128
|
- lib/usno/imagery/earth/moon.rb
|
126
129
|
- lib/usno/imagery/earth/rise.rb
|