wuparty 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/wuparty.rb +21 -1
  2. metadata +2 -2
data/lib/wuparty.rb CHANGED
@@ -308,10 +308,30 @@ class WuParty
308
308
  query[:sort] = field
309
309
  query[:sortDirection] = direction || 'ASC'
310
310
  end
311
-
311
+
312
312
  @party.get("forms/#{@id}/entries", :query => query)['Entries']
313
313
  end
314
314
 
315
+ # Return entries already submitted to the form.
316
+ #
317
+ # Supports:
318
+ # Same as Entries above with filtering.
319
+ # form.count(:filters => [['Field1', 'Is_equal_to', 'Tim']])
320
+ #
321
+ # See http://wufoo.com/docs/api/v3/entries/get/#filter for details
322
+ def count(options={})
323
+ query = {}
324
+
325
+ if options[:filters]
326
+ query['match'] = options[:filter_match] || 'AND'
327
+ options[:filters].each_with_index do |filter, index|
328
+ query["Filter#{ index + 1 }"] = filter.join(' ')
329
+ end
330
+ end
331
+ @party.get("forms/#{@id}/entries/count", :query => query)['EntryCount']
332
+ end
333
+
334
+
315
335
  # Submit form data to the form.
316
336
  # Pass data as a hash, with field ids as the hash keys, e.g.
317
337
  # submit('Field1' => 'Tim', 'Field2' => 'Morgan')
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: wuparty
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.2
5
+ version: 1.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tim Morgan
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-15 00:00:00.000000000 Z
12
+ date: 2013-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime