Class: Supercamp::Criteria::Campground

Inherits:
Campsite show all
Defined in:
lib/supercamp/criteria/campground.rb

Constant Summary collapse

AMENITIES =
{
  "biking"    => 4001,
  "boating"   => 4002,
  "equipment_rentals" => 4003,
  "fishing"   => 4004,
  "golf"      => 4005,
  "hiking"    => 4006,
  "horseback_riding" => 4007,
  "hunting"   => 4008,
  "rec_activities" => 4009,
  "scenic_trails" => 4010,
  "sports"    => 4011,
  "beach_or_water" => 4012,
  "winter_activities" => 4013
}

Constants inherited from Campsite

Supercamp::Criteria::Campsite::ELECTRIC_HOOKUPS, Supercamp::Criteria::Campsite::PERKS, Supercamp::Criteria::Campsite::TYPES

Instance Attribute Summary

Attributes inherited from Abstract

#options

Instance Method Summary collapse

Methods inherited from Campsite

#arrival, #min_elec_amps, #min_equip_length, #nights, #people, #site_type

Methods inherited from Abstract

#endpoint, #initialize, #query, #response, search, #search

Constructor Details

This class inherits a constructor from Supercamp::Criteria::Abstract

Instance Method Details

#amenity(key) ⇒ Object

amenity: Campground Feature

There are all sorts of things to do at campgrounds. Only one amenity can be specified per query.



60
61
62
63
64
# File 'lib/supercamp/criteria/campground.rb', line 60

def amenity(key)
  code = AMENITIES.fetch(key.to_s)
  merge_option(:amenity, code)
  self
end

#geo(lat, lng) ⇒ Object

landmarkLat, landmarkLong (latitude/longitude)

These two parameters allow for campground searches around a fixed geo-point.



26
27
28
29
30
# File 'lib/supercamp/criteria/campground.rb', line 26

def geo(lat, lng)
  merge_option("landmarkLat", lat)
  merge_option("landmarkLong", lng)
  self
end

#has(*perks) ⇒ Object

has: Campture Features

Specify 1 or more optional perks: # water

# sewer

# pull

# pets

# waterfront



76
77
78
79
80
81
82
# File 'lib/supercamp/criteria/campground.rb', line 76

def has(*perks)
  perks.each do |perk|
    next unless PERKS.has_key?(perk.to_s)
    merge_option(perk, PERKS[perk.to_s])
  end
  self
end

#name(park) ⇒ Object

pname: Park Name

The name of the park. When this parameter is specified, the API performs a string-match query for parks containing the character string specified.



49
50
51
52
# File 'lib/supercamp/criteria/campground.rb', line 49

def name(park)
  merge_option(:pname, park)
  self
end

#state(abbr) ⇒ Object

pstate: State or Province

The two character abbreviation for US state



37
38
39
40
# File 'lib/supercamp/criteria/campground.rb', line 37

def state(abbr)
  merge_option(:pstate, abbr)
  self
end