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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27e87e156a81dd5451506f1bf4ac20e9012c7201
4
- data.tar.gz: f9d02d48904c1b7d37a558290a9d05b351ce37d4
3
+ metadata.gz: 726550f0d490c4f1b467464c2f9c57a1d183c423
4
+ data.tar.gz: b466139767c881c5c477284723922128dd311fad
5
5
  SHA512:
6
- metadata.gz: d30fd86ea88664dee532ca5a79979122708b94dc2ffd6c782afc8cdcfba8bd43ceb4002f5db917d816211bb1bfa623149323c84315e1df4de65a313a3fedd5dd
7
- data.tar.gz: 07547a05beedd21940330b7552b4496890834f3ebf22001d95accaef681af11dd38caab8f0ee38f965b035896122457dd5a32636f3359ae59f6b18d00a1adb2f
6
+ metadata.gz: da8f5de00dfb595c100255a1652f98849cb3837bbdd51ff40da77a61df481f34f2c8650d70d7ef8d2f15631a64369d29ad6f7b2ecbb328c71c54cf743f14ef10
7
+ data.tar.gz: 8a0d061d44799ea8cb4d1aef5c0006014ab5cfc1ecb82b943661234c9366d594cc18329d2ee0a6aae051378514b622c74674d3a908b52c69720ab106433cbc09
data/.gitignore CHANGED
@@ -9,6 +9,7 @@ _yardoc
9
9
  coverage
10
10
  doc/
11
11
  lib/bundler/man
12
+ bin
12
13
  pkg
13
14
  rdoc
14
15
  spec/reports
@@ -20,3 +21,5 @@ tmp
20
21
  *.o
21
22
  *.a
22
23
  mkmf.log
24
+ .ruby-version
25
+ .ruby-gemset
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
- # => { "addr_elem_region" => [""], "addr_elem_city" => {...}, ... }
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
- # => { "addr_elem_region" => [""], "addr_elem_street" => {"0" => "Street X"}, ... }
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.
@@ -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
- client = Savon.client(wsdl: Lpaisais::API.config[:wsdl])
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])
@@ -1,9 +1,10 @@
1
1
  module Lpaisais
2
2
  module API
3
- Configuration = Struct.new(:wsdl, :key) do
3
+ Configuration = Struct.new(:wsdl, :key, :timeout) do
4
4
  def initialize
5
5
  self.wsdl = nil
6
6
  self.key = nil
7
+ self.timeout = 2
7
8
  end
8
9
  end
9
10
 
@@ -1,5 +1,5 @@
1
1
  module Lpaisais
2
2
  module API
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
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.1
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: 2014-11-12 00:00:00.000000000 Z
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.4.3
81
+ rubygems_version: 2.2.2
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Latvian postal service address API gem