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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b89e550900e12c01ff0415aac207396f95bc26e4
4
- data.tar.gz: 480f9a2efda2bb29503ff33f6efcbf9b3d51e867
3
+ metadata.gz: 770d1665f9531d9fad7030d50e12aca5dbbfbbc9
4
+ data.tar.gz: e8e8ff3f2bd99c0ce16ee977cd6ded5564bd8c20
5
5
  SHA512:
6
- metadata.gz: 2e04776b7c58f054ef9ebbacd77aa5734dad7eef5fbf0ce18536b7318051f133af68c6da4a0cea1275c98d483b78d0e7c3f2f6c7dfd86b58c2080508b9b8deb4
7
- data.tar.gz: 95180b36bd3511f13c653ecc56741a4499f682c755daf14b0d90a40b354a301a134eab0cab0a9ab9785eec18fd4dcff208ec70d1e3f4ca9a27df6da3d960670f
6
+ metadata.gz: 6cc0a6d31d6a5c45a172e02d4f5b141ba50ba4d2f7e1aa04054665ecbb8b363874197fa4f9d4239930d355f7954346a157debec8402fe3224bbcf7d59c42b9f7
7
+ data.tar.gz: 32fbc7dac39e889cdbe260d4ff41bbb320010349780ab439f99dc773b34e2c500709857c59ec3012b3b587c8ee0ab62e9b082e5aa9abe49a52004454788ee4c5
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem 'rspec'
7
7
  gem 'autotest'
8
+ gem 'json'
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task :default => :spec
5
+ task :test => :spec
2
6
 
@@ -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
- # Your code goes here...
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
@@ -1,3 +1,5 @@
1
1
  module Aupost
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
+ AUPOST_URL = "https://auspost.com.au/api"
4
+
3
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aupost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyson Cung