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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71d2e3bd02bd35dd6312775f2e2f0e7a991cf3ff
4
- data.tar.gz: cdedba8d0000eefe31f72e43836ebecd25844241
3
+ metadata.gz: ad1e1fb4ae8473f959f09bd324d5274aefb3a1e7
4
+ data.tar.gz: 3cc96aa2d98e089612b26418aee0c9dea02eb34d
5
5
  SHA512:
6
- metadata.gz: 67d74a8011424c3f397c1f4f26ccc718e97e1779c431d7c330bdb4746ad529493800e6c0c8c9749286b835223934a0eb66ef2493ac9612870248698503a7837a
7
- data.tar.gz: fd3aaef3a626f7f90822c5b9cff928c0757ab08e462bc41d76574f46d96fd981f12524b816fb956de7dff0042f1ffda34ef9f3e5e6da5ac0a0bfd1901e3405d3
6
+ metadata.gz: 8eacbdaf736095926c3ef53a3333809a94167bf518419e3fb52786088b9f231216d3401c29164655b8a7bb81caad7df7f98319c6451700996af22e8e41aaba43
7
+ data.tar.gz: f5341793d43c0aab2a3dc432fad5d0cb19acfaa24c1d35d621c236fd6e26b587d4e3c60c2f558cd08401b37bea671cf59e37a670c4bddabcfc465b37429432aa
data/.gitignore CHANGED
@@ -7,9 +7,12 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /bin/
10
11
  *.bundle
11
12
  *.so
12
13
  *.o
13
14
  *.a
14
15
  *.gem
15
16
  mkmf.log
17
+ .ruby-version
18
+ .ruby-gemset
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
  # =>
@@ -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(wsdl: Omniva::API.config[:wsdl])
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
- parsed_response(response)
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.parsed_response(response)
31
+ def self.parse_response(response)
27
32
  unwrapped =
28
33
  response
29
34
  .to_hash
@@ -1,9 +1,10 @@
1
1
  module Omniva
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 Omniva
2
2
  module API
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
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.1
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-02-12 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon