Module: EarthTools
- Defined in:
- lib/earth_tools.rb,
lib/earth_tools/sun.rb,
lib/earth_tools/date.rb,
lib/earth_tools/height.rb,
lib/earth_tools/location.rb,
lib/earth_tools/timezone.rb,
lib/earth_tools/sun/evening.rb,
lib/earth_tools/sun/morning.rb,
lib/earth_tools/xml/element.rb,
lib/earth_tools/sun/twilight.rb
Defined Under Namespace
Modules: XML
Classes: Date, Height, Location, Sun, Timezone
Constant Summary
collapse
- VERSION =
'0.1.0'
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.base_uri ⇒ Object
Returns the value of attribute base_uri.
21
22
23
|
# File 'lib/earth_tools.rb', line 21
def base_uri
@base_uri
end
|
Class Method Details
.get(service, version = nil, *params) ⇒ Object
44
45
46
47
48
|
# File 'lib/earth_tools.rb', line 44
def self.get(service, version = nil, *params)
service = versioned_service(service, version)
response = open(File.join(self.base_uri, service, *params))
EarthTools::XML::Element.new(Nokogiri::XML(response))
end
|
.height(params) ⇒ Object
38
39
40
41
42
|
# File 'lib/earth_tools.rb', line 38
def self.height(params)
params = prepare_params(params)
response = self.get('height', params['version'], params['latitude'], params['longitude'])
EarthTools::Height.new(response)
end
|
.sun(params) ⇒ Object
32
33
34
35
36
|
# File 'lib/earth_tools.rb', line 32
def self.sun(params)
params = { 'timezone' => '99', 'dst' => '0' }.merge(prepare_params(params))
response = self.get('sun', params['version'], params['latitude'], params['longitude'], params['day'], params['month'], params['timezone'], params['dst'])
EarthTools::Sun.new(response)
end
|
.timezone(params) ⇒ Object
26
27
28
29
30
|
# File 'lib/earth_tools.rb', line 26
def self.timezone(params)
params = prepare_params(params)
response = self.get('timezone', params['version'], params['latitude'], params['longitude'])
EarthTools::Timezone.new(response)
end
|