policymap_wrap 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -72,6 +72,16 @@ Other search options:
72
72
  :lat => 33.805094 # Only to be used if boundary_ids (above) is not specified
73
73
  :lng => -118.353717
74
74
 
75
+ === PolicyMap::Client.containment_search(<search_options>)
76
+
77
+ A +:containment+ type of search *returns a hash (with symbolized keys)* containing boundary IDs for each of the boundary types contained by the specified boundary ID.
78
+ For example, if the boundary ID is for Alameda County, specifying :city as the boundary_types will reveal all cities within Alameda county.
79
+
80
+ Required search options:
81
+
82
+ :boundary_types => [:city, :zip, :state] # Can be a single boundary type, an array, or :all
83
+ :boundary_id => 590932 # The ID of the boundary to use as the "container"
84
+
75
85
  === Available Boundary Types
76
86
 
77
87
  :state
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -109,6 +109,25 @@ module PolicyMap
109
109
  @@connection.get endpoint, data
110
110
  end
111
111
 
112
+ def containment_search(*args)
113
+ default_options = @@default_options
114
+ default_options[:t] = "cnt"
115
+
116
+ options = extract_options!(args)
117
+
118
+ raise InsufficientArgsForSearch unless options.has_key?(:boundary_types) && options.has_key?(:boundary_id)
119
+
120
+ options[:boundary_types] = Array(options[:boundary_types]).collect {|bt| BOUNDARY_TYPES[bt] }.join(',')
121
+ HashUtils.rename_key!(options, :boundary_types, :ct)
122
+ HashUtils.rename_key!(options, :boundary_id, :bi)
123
+
124
+
125
+ options = default_options.merge(options)
126
+
127
+ result = get(Endpoint.endpoint_url, options)
128
+ result['cnt'].collect {|hsh| HashUtils.symbolize_keys(hsh) }
129
+ end
130
+
112
131
  private
113
132
 
114
133
  def extract_options!(args)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: policymap_wrap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mauricio Gomes
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-07 00:00:00 -04:00
18
+ date: 2010-08-17 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency