lpaisais-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 +19 -2
- data/lib/lpaisais/api/client.rb +6 -1
- data/lib/lpaisais/api/configuration.rb +2 -1
- data/lib/lpaisais/api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 726550f0d490c4f1b467464c2f9c57a1d183c423
|
4
|
+
data.tar.gz: b466139767c881c5c477284723922128dd311fad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da8f5de00dfb595c100255a1652f98849cb3837bbdd51ff40da77a61df481f34f2c8650d70d7ef8d2f15631a64369d29ad6f7b2ecbb328c71c54cf743f14ef10
|
7
|
+
data.tar.gz: 8a0d061d44799ea8cb4d1aef5c0006014ab5cfc1ecb82b943661234c9366d594cc18329d2ee0a6aae051378514b622c74674d3a908b52c69720ab106433cbc09
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -27,15 +27,32 @@ Lpaisais::API.configure do |config|
|
|
27
27
|
config.key = 'server_key'
|
28
28
|
end
|
29
29
|
|
30
|
+
# Configuration with timeout, default value is 2 seconds
|
31
|
+
Lpaisais::API.configure do |config|
|
32
|
+
config.wsdl = 'wsdl_url'
|
33
|
+
config.key = 'server_key'
|
34
|
+
config.timeout = 5
|
35
|
+
end
|
36
|
+
|
30
37
|
# call without parameters, for initial data from server
|
31
38
|
Lpaisais::API.call
|
32
|
-
# =>
|
39
|
+
# =>
|
40
|
+
{
|
41
|
+
"addr_elem_region" => [""],
|
42
|
+
"addr_elem_city" => {...},
|
43
|
+
...
|
44
|
+
}
|
33
45
|
|
34
46
|
# call with parameters, Lpaisais::API.call(udpdate, data)
|
35
47
|
# - update (string or symbol): updated element, in this case :addr_elem_type
|
36
48
|
# - data (hash): information to query from server
|
37
49
|
response = Lpaisais::API.call(:addr_elem_type, { addr_elem_city: 178 })
|
38
|
-
# =>
|
50
|
+
# =>
|
51
|
+
{
|
52
|
+
"addr_elem_region" => [""],
|
53
|
+
"addr_elem_street" => {"0" => "Street X"},
|
54
|
+
...
|
55
|
+
}
|
39
56
|
```
|
40
57
|
|
41
58
|
For further information on Lpaisais response structure, please visit the server's website.
|
data/lib/lpaisais/api/client.rb
CHANGED
@@ -8,7 +8,12 @@ module Lpaisais
|
|
8
8
|
def call(update = nil, data = {})
|
9
9
|
fail InvalidConfiguration if Lpaisais::API.config[:wsdl].blank?
|
10
10
|
fail InvalidConfiguration if Lpaisais::API.config[:key].blank?
|
11
|
-
|
11
|
+
fail InvalidConfiguration if Lpaisais::API.config[:timeout].blank?
|
12
|
+
client = Savon.client do
|
13
|
+
wsdl Lpaisais::API.config[:wsdl]
|
14
|
+
open_timeout Lpaisais::API.config[:timeout].to_i
|
15
|
+
read_timeout Lpaisais::API.config[:timeout].to_i
|
16
|
+
end
|
12
17
|
body = { params: build_params(update, data) }
|
13
18
|
response = client.call(:lpaisais, message: body)
|
14
19
|
parse_response(response.body[:lpaisais_response][:return])
|
data/lib/lpaisais/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lpaisais-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
|
- David Ochoa
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.2.2
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: Latvian postal service address API gem
|