Class: Campgrounds::CampsiteSearch

Inherits:
Base
  • Object
show all
Defined in:
lib/campgrounds/campsite_search.rb

Constant Summary collapse

Path =
'/campsites'

Instance Attribute Summary

Attributes inherited from Base

#api_key

Instance Method Summary collapse

Methods inherited from Base

#campground_details, #campground_search, #campsite_search, #initialize

Constructor Details

This class inherits a constructor from Campgrounds::Base

Instance Method Details

#find(options = {}) ⇒ Object

A cleaned up version of the request method below. Updated to use strings or boolean values instead of varius numbers. Required Parameters


contractCode: “contractCode” is a syonym for contractID, which is what is returned by the Campground Search API. It specifies the jurisdiction for the campground. This parameter must be used in conjuction with parkId.

parkId: Facility ID “parkId” is a synonym for “facilityID”, which is returned by the Campground Search API. It is a unique identifier for the campground.

Optional Parameters


siteType: If unspecified, all site types are returned.

"rv": RV Sites
"cabin": Cabins or Lodgings
"tent": Tent
"trailer": Trailer
"group": Group Site
"day": Day Use
"horse": Horse Site
"boat": Boat Site

arvDate: Arrival Date lengthOfStay: When combined with arvDate, this parameter determines how long the camper would like to reserve the campground. eqpLen: Equipment Length maxPeople: Number of campers

hookup: Electric Hookup

"15+": 15 Amps or More
"20+": 20 Amps or More 
"30+": 30 Amps or More 
"50+": 50 Amps or More

water: Water Hookup. Boolean. sewer: Sewer Hookup. Boolean. pull: Pull Through Driveway. Boolean. pets: Pets Allowed. Boolean. waterfront: Waterfront Sites. Boolean.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/campgrounds/campsite_search.rb', line 47

def find(options={})
    case options[:siteType]
        when "rv"
            options[:siteType] = 2001
        when "cabin"
            options[:siteType] = 10001
        when "tent"
            options[:siteType] = 2003
        when "trailer"
            options[:siteType] = 2002
        when "group"
            options[:siteType] = 9002
        when "day"
            options[:siteType] = 9001
        when "horse"
            options[:siteType] = 3001
        when "boat"
            options[:siteType] = 2004
    end

    case options[:hookup]
        when "15+"
            options[:hookup] = 3002
        when "20+"
            options[:hookup] = 3003
        when "30+"
            options[:hookup] = 3004
        when "50+"
            options[:hookup] = 3005
    end

    options[:water] = 3006 if options[:water]
    options[:sewer] = 3007 if options[:sewer]
    options[:pull] = 3008 if options[:pull]
    options[:pets] = 3010 if options[:pets]
    options[:waterfront] = 3011 if options[:waterfront]

    # Might return results array at some point, but returning the wrapper for now to keep results similar to default.
    return query(Path, options)
end

#request(options = {}) ⇒ Object



131
132
133
# File 'lib/campgrounds/campsite_search.rb', line 131

def request(options={})
  query(Path, options)
end