omniva-api 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/README.md +9 -0
- data/lib/omniva/api/client.rb +9 -4
- data/lib/omniva/api/configuration.rb +2 -1
- data/lib/omniva/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad1e1fb4ae8473f959f09bd324d5274aefb3a1e7
|
|
4
|
+
data.tar.gz: 3cc96aa2d98e089612b26418aee0c9dea02eb34d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8eacbdaf736095926c3ef53a3333809a94167bf518419e3fb52786088b9f231216d3401c29164655b8a7bb81caad7df7f98319c6451700996af22e8e41aaba43
|
|
7
|
+
data.tar.gz: f5341793d43c0aab2a3dc432fad5d0cb19acfaa24c1d35d621c236fd6e26b587d4e3c60c2f558cd08401b37bea671cf59e37a670c4bddabcfc465b37429432aa
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -21,12 +21,21 @@ Or install it yourself as:
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```` ruby
|
|
24
|
+
require 'omniva/api'
|
|
25
|
+
|
|
24
26
|
# Configuration
|
|
25
27
|
Omniva::API.configure do |config|
|
|
26
28
|
config.wsdl = 'wsdl_url'
|
|
27
29
|
config.key = 'secret_key'
|
|
28
30
|
end
|
|
29
31
|
|
|
32
|
+
# Configuration with timeout, default value is 2 seconds
|
|
33
|
+
Omniva::API.configure do |config|
|
|
34
|
+
config.wsdl = 'wsdl_url'
|
|
35
|
+
config.key = 'secret_key'
|
|
36
|
+
config.timeout = 5
|
|
37
|
+
end
|
|
38
|
+
|
|
30
39
|
# Initial data query (counties)
|
|
31
40
|
Omniva::API.call
|
|
32
41
|
# =>
|
data/lib/omniva/api/client.rb
CHANGED
|
@@ -6,16 +6,21 @@ module Omniva
|
|
|
6
6
|
def self.call(data = nil)
|
|
7
7
|
validate_config
|
|
8
8
|
data ||= initial_request
|
|
9
|
-
client = Savon.client
|
|
9
|
+
client = Savon.client do
|
|
10
|
+
wsdl Omniva::API.config[:wsdl]
|
|
11
|
+
open_timeout Omniva::API.config[:timeout].to_i
|
|
12
|
+
read_timeout Omniva::API.config[:timeout].to_i
|
|
13
|
+
end
|
|
10
14
|
auth = { authPhrase: Omniva::API.config[:key] }
|
|
11
15
|
response = client.call :single_address1, attributes: auth, message: data
|
|
12
|
-
|
|
16
|
+
parse_response(response)
|
|
13
17
|
end
|
|
14
18
|
|
|
15
19
|
def self.validate_config
|
|
16
20
|
messages = {
|
|
17
21
|
wsdl: 'WSDL is missing',
|
|
18
|
-
key: 'Key is missing'
|
|
22
|
+
key: 'Key is missing',
|
|
23
|
+
timeout: 'Timeout is missing'
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
messages.each do |key, value|
|
|
@@ -23,7 +28,7 @@ module Omniva
|
|
|
23
28
|
end
|
|
24
29
|
end
|
|
25
30
|
|
|
26
|
-
def self.
|
|
31
|
+
def self.parse_response(response)
|
|
27
32
|
unwrapped =
|
|
28
33
|
response
|
|
29
34
|
.to_hash
|
data/lib/omniva/api/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniva-api
|
|
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
|
- Stanislav Gorski
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: savon
|