kleber 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +16 -14
- data/.gitignore +0 -14
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -31
- data/Rakefile +0 -2
- data/kleber.gemspec +0 -23
- data/lib/kleber.rb +0 -20
- data/lib/kleber/exception.rb +0 -8
- data/lib/kleber/methods.rb +0 -5
- data/lib/kleber/query/address_verify.rb +0 -31
- data/lib/kleber/version.rb +0 -3
- data/lib/kleber/web_request.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e434c9ce145db4d6995cd7790862af5807d69db3
|
4
|
+
data.tar.gz: c90c31c9a4818e82058ffa12b74e66b5b6647b87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4afb153d4f7f892edc231694fac355af331b7258b57a68b9b0c5b070d4c3101a1f0e2da45a30fda6faa1966ebac65099b2fcbde1126f9ee9076b784f79da4bdf
|
7
|
+
data.tar.gz: f565c54ae4a764e1e953c6508dfd8d724c2f60394314d23aa200703043a29485ff176e2ad542e46cde232f2ef3ef9854c74c73857104049ae878b6566d94dfe7
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kleber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Kloppenborg
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bump
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.2
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.2
|
41
55
|
description: Kleber provides data hydration services for address verification and
|
42
56
|
repair
|
43
57
|
email:
|
@@ -45,19 +59,7 @@ email:
|
|
45
59
|
executables: []
|
46
60
|
extensions: []
|
47
61
|
extra_rdoc_files: []
|
48
|
-
files:
|
49
|
-
- ".gitignore"
|
50
|
-
- Gemfile
|
51
|
-
- LICENSE.txt
|
52
|
-
- README.md
|
53
|
-
- Rakefile
|
54
|
-
- kleber.gemspec
|
55
|
-
- lib/kleber.rb
|
56
|
-
- lib/kleber/exception.rb
|
57
|
-
- lib/kleber/methods.rb
|
58
|
-
- lib/kleber/query/address_verify.rb
|
59
|
-
- lib/kleber/version.rb
|
60
|
-
- lib/kleber/web_request.rb
|
62
|
+
files: []
|
61
63
|
homepage: https://www.logicsaas.com
|
62
64
|
licenses:
|
63
65
|
- MIT
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 Karl Kloppenborg
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# Kleber
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'kleber'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install kleber
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
TODO: Write usage instructions here
|
24
|
-
|
25
|
-
## Contributing
|
26
|
-
|
27
|
-
1. Fork it ( https://github.com/[my-github-username]/kleber/fork )
|
28
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
-
5. Create a new Pull Request
|
data/Rakefile
DELETED
data/kleber.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'kleber/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "kleber"
|
8
|
-
spec.version = Kleber::VERSION
|
9
|
-
spec.authors = ["Karl Kloppenborg"]
|
10
|
-
spec.email = ["karl@logicsaas.com"]
|
11
|
-
spec.summary = %q{Kleber interfaces with the DataTools Kleber service}
|
12
|
-
spec.description = %q{Kleber provides data hydration services for address verification and repair}
|
13
|
-
spec.homepage = "https://www.logicsaas.com"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
end
|
data/lib/kleber.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require "kleber/version"
|
2
|
-
require "kleber/exception"
|
3
|
-
require "kleber/methods"
|
4
|
-
require "kleber/web_request"
|
5
|
-
require "kleber/query/address_verify"
|
6
|
-
|
7
|
-
class Kleber
|
8
|
-
PRODUCTION = 'production'
|
9
|
-
DEVELOPMENT = 'development'
|
10
|
-
def initialize(request_key, environment)
|
11
|
-
@request_key = request_key
|
12
|
-
raise Kleber::EnvironmentNotFound, "Environment is either development or production, you specified #{environment}" unless (environment.eql? Kleber::DEVELOPMENT or environment.eql? Kleber::PRODUCTION)
|
13
|
-
@environment = environment
|
14
|
-
if environment.eql? Kleber::DEVELOPMENT
|
15
|
-
@host = "http://kleber-devuat.datatoolscloud.net.au"
|
16
|
-
else
|
17
|
-
@host = "https://kleber.datatoolscloud.net.au"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/kleber/exception.rb
DELETED
data/lib/kleber/methods.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Kleber::Query
|
2
|
-
class AddressVerify
|
3
|
-
attr_reader :payload
|
4
|
-
#
|
5
|
-
# This class will provide the json payload for the request.
|
6
|
-
#
|
7
|
-
def initialize(locality, state, postcode, addressLine1, otherAddresses)
|
8
|
-
raise Kleber::TooManyAddresses, "Max of five other address lines, you entered #{otherAddresses.count}" unless otherAddresses.count < 6
|
9
|
-
@payload = {
|
10
|
-
:Locality => locality,
|
11
|
-
:State => state,
|
12
|
-
:Postcode => postcode,
|
13
|
-
:AddressLine1 => addressLine1
|
14
|
-
}
|
15
|
-
counter = 2
|
16
|
-
otherAddresses.each do |val|
|
17
|
-
@payload["AddressLine#{counter}".to_sym] = val
|
18
|
-
counter += 1
|
19
|
-
end
|
20
|
-
end
|
21
|
-
#/End Initialize
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class Kleber
|
26
|
-
|
27
|
-
def run_address_verification(locality, state, postcode, addressLine1, *otherAddresses)
|
28
|
-
query = Kleber::Query::AddressVerify.new(locality, state, postcode, addressLine1, otherAddresses)
|
29
|
-
response = get_request(Kleber::Methods::Verify::AUPAF_ADDRESS, query.payload)
|
30
|
-
end
|
31
|
-
end
|
data/lib/kleber/version.rb
DELETED
data/lib/kleber/web_request.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require "net/http"
|
2
|
-
|
3
|
-
class Kleber
|
4
|
-
DEFAULT_SERVER_PATH = '/KleberWebService/DtKleberService.svc/ProcessQueryStringRequest'
|
5
|
-
def get_request(method, queryPayload)
|
6
|
-
uri = URI.parse(@host)
|
7
|
-
uri.path = DEFAULT_SERVER_PATH
|
8
|
-
|
9
|
-
headerPayload = {
|
10
|
-
:Method => method,
|
11
|
-
:RequestKey => @request_key,
|
12
|
-
:OutputFormat => "json"
|
13
|
-
}
|
14
|
-
headerPayload.merge! queryPayload
|
15
|
-
Rails.logger.debug headerPayload
|
16
|
-
|
17
|
-
uri.query = URI.encode_www_form(headerPayload)
|
18
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
19
|
-
|
20
|
-
if @environment.eql? Kleber::PRODUCTION
|
21
|
-
http.use_ssl = true
|
22
|
-
end
|
23
|
-
|
24
|
-
request = Net::HTTP::Get.new(uri)
|
25
|
-
response = http.request(request)
|
26
|
-
raise Kleber::QueryResponseInvalid, "The query response was #{response.code}, expected 200" unless response.code.to_i.eql? 200
|
27
|
-
return ActiveSupport::JSON.decode(response.body)
|
28
|
-
end
|
29
|
-
end
|