Class: Campgrounds::Base
- Inherits:
-
Object
- Object
- Campgrounds::Base
- Includes:
- GeoKit::Geocoders
- Defined in:
- lib/campgrounds/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
Instance Method Summary collapse
- #campground_details ⇒ Object
- #campground_search ⇒ Object
- #campsite_search ⇒ Object
-
#initialize(api_key) ⇒ Base
constructor
A new instance of Base.
-
#query(path, options = {}) ⇒ Object
private.
Constructor Details
#initialize(api_key) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/campgrounds/base.rb', line 7 def initialize(api_key) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/campgrounds/base.rb', line 5 def api_key @api_key end |
Instance Method Details
#campground_details ⇒ Object
15 16 17 |
# File 'lib/campgrounds/base.rb', line 15 def campground_details @campground_details ||= Campgrounds::CampgroundDetails.new(@api_key) end |
#campground_search ⇒ Object
11 12 13 |
# File 'lib/campgrounds/base.rb', line 11 def campground_search @campground_search ||= Campgrounds::CampgroundSearch.new(@api_key) end |
#campsite_search ⇒ Object
19 20 21 |
# File 'lib/campgrounds/base.rb', line 19 def campsite_search @campsite_search ||= Campgrounds::CampsiteSearch.new(@api_key) end |
#query(path, options = {}) ⇒ Object
private
26 27 28 29 30 31 32 |
# File 'lib/campgrounds/base.rb', line 26 def query(path, ={}) base_uri = 'http://api.amp.active.com/camping' ['api_key'] = @api_key url = base_uri + path xml = RestClient.get url, {:params => } data = XmlSimple.xml_in(xml.to_s, { 'KeyAttr' => 'name' }) end |