atdis 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96660446cb7e6ae0edc26280795aabe3923d0eac
4
- data.tar.gz: 7a07cf1247742c8562c9bae0cbca3513ccad1e67
3
+ metadata.gz: 528ead212dae0aa7f87f76ff92e6f7f5451aee40
4
+ data.tar.gz: bd34d58c632307942e6e5ab6ddcb4f553c1dd358
5
5
  SHA512:
6
- metadata.gz: 65e2b704fcb9cbb6f1f660f576f92e5eda0d68dc197495843c1d83e634eb6db80c9079d23a22c4c7a16e1bd5abb1ee8feae41653e4b20437012c054a5e26c8b9
7
- data.tar.gz: c9e44388e4f03d97494fad8b5862a79fc67a07398b17766a1ebc8c0632b583cd2ea7215168533a5cd10cf76335ea04dfed87ed85dbde5c203e481f434c2033a6
6
+ metadata.gz: 60592858c156171e9da739fa9204cdf406580f835a33a7ccd7fe0081bcc46484b1add1f37493c93bfee31ed18a5f72f36287e7f5a2b23b9c13df93242a6d90a0
7
+ data.tar.gz: 38da539b1d5d8bc0c959d9a335156b04c81d719fdd366bebeb8fbd6a49f23e957c6fb13ee99a0dc80eea20b73cecfc735ed06450c4d61f2eac09a048bcb158ad
data/lib/atdis/feed.rb CHANGED
@@ -80,13 +80,18 @@ module ATDIS
80
80
  options
81
81
  end
82
82
 
83
+ # Escape but leave commas unchanged (which are valid in query strings)
84
+ def self.escape(v)
85
+ CGI::escape(v.to_s).gsub('%2C',',')
86
+ end
87
+
83
88
  # Turn an options hash of the form {foo: "bar", hello: "sir"} into a query
84
89
  # string of the form "foo=bar&hello=sir"
85
90
  def self.options_to_query(options)
86
91
  if options.empty?
87
92
  nil
88
93
  else
89
- options.sort{|a,b| a.first.to_s <=> b.first.to_s}.map{|k,v| "#{k}=#{v}"}.join("&")
94
+ options.sort{|a,b| a.first.to_s <=> b.first.to_s}.map{|k,v| "#{k}=#{escape(v)}"}.join("&")
90
95
  end
91
96
  end
92
97
  end
data/lib/atdis/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Atdis
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
@@ -51,6 +51,12 @@ describe ATDIS::Feed do
51
51
  end
52
52
  end
53
53
 
54
+ describe "search by suburb" do
55
+ it do
56
+ feed.applications_url(suburb: ["willow tree", "foo", "bar"]).should == "http://www.council.nsw.gov.au/atdis/1.0/applications.json?suburb=willow+tree,foo,bar"
57
+ end
58
+ end
59
+
54
60
  it "jump straight to the second page" do
55
61
  feed.applications_url(page: 2).should == "http://www.council.nsw.gov.au/atdis/1.0/applications.json?page=2"
56
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atdis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Landauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-21 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler