Class: NasaApi::Planetary
Constant Summary
collapse
- PLANETARY_URL =
BASE_URL + 'planetary/'
- APOD_URL =
PLANETARY_URL + 'apod'
- EARTH_URL =
PLANETARY_URL + 'earth/'
- EARTH_IMAGERY_URL =
EARTH_URL + 'imagery'
- EARTH_ASSETS_URL =
EARTH_URL + 'assets'
- EPIC_URL =
BASE_URL + 'EPIC/api/natural'
Instance Attribute Summary
Attributes inherited from NasaInit
#api_key, #date, #high_definition, #options
Instance Method Summary
collapse
Methods inherited from NasaInit
#initialize, #params_dates, #parse_date
Instance Method Details
#apod(params = {}) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/nasa_api/planetary.rb', line 12
def apod(params = {})
params = params_dates(params)
params.merge!(@options)
response = HTTParty.get(APOD_URL, query: params)
if response.code == 200
ResponseHandler::Apod.new(response)
else
Error.new(response)
end
end
|
#earth_assets(params = {}) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/nasa_api/planetary.rb', line 39
def earth_assets(params = {})
params = params_dates(params)
params.merge!(@options)
response = HTTParty.get(EARTH_ASSETS_URL, query: params)
if response.code == 200
ResponseHandler::EarthAssets.new(response)
else
Error.new(response)
end
end
|
#earth_imagery(params = {}) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/nasa_api/planetary.rb', line 27
def earth_imagery(params = {})
params = params_dates(params)
params.merge!(@options)
response_head = HTTParty.head(EARTH_IMAGERY_URL, query: params)
if response_head.code == 200
ResponseHandler::EarthImagery.new(response_head)
else
Error.new(response_head)
end
end
|
#epic(params = {}) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/nasa_api/planetary.rb', line 51
def epic(params = {})
params = params_dates(params)
params.merge!(@options)
response = HTTParty.get(EPIC_URL, query: params)
if response.code == 200
ResponseHandler::Epic.new(response)
else
Error.new(response)
end
end
|