aupost 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Rakefile +4 -0
- data/lib/aupost.rb +21 -1
- data/lib/aupost/version.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 770d1665f9531d9fad7030d50e12aca5dbbfbbc9
|
4
|
+
data.tar.gz: e8e8ff3f2bd99c0ce16ee977cd6ded5564bd8c20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cc0a6d31d6a5c45a172e02d4f5b141ba50ba4d2f7e1aa04054665ecbb8b363874197fa4f9d4239930d355f7954346a157debec8402fe3224bbcf7d59c42b9f7
|
7
|
+
data.tar.gz: 32fbc7dac39e889cdbe260d4ff41bbb320010349780ab439f99dc773b34e2c500709857c59ec3012b3b587c8ee0ab62e9b082e5aa9abe49a52004454788ee4c5
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/aupost.rb
CHANGED
@@ -1,5 +1,25 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
1
3
|
require "aupost/version"
|
2
4
|
|
5
|
+
#require "aupost/configuration"
|
6
|
+
|
3
7
|
module Aupost
|
4
|
-
|
8
|
+
class Client
|
9
|
+
attr_accessor :aupost_key
|
10
|
+
def initialize(aupost_key)
|
11
|
+
self.aupost_key = aupost_key
|
12
|
+
end
|
13
|
+
|
14
|
+
def domestic_postcode_search(text, state = "", format = "json")
|
15
|
+
uri = URI("#{Aupost::AUPOST_URL}/postcode/search.#{format}?q=#{text}&state=#{state}")
|
16
|
+
req = Net::HTTP::Get.new(uri)
|
17
|
+
req['AUTH-KEY'] = @aupost_key
|
18
|
+
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
19
|
+
return http.request(req).read_body
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
5
25
|
end
|
data/lib/aupost/version.rb
CHANGED