nne_client 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f962eb35e8fb89c38a8f8c3d0c5009ffac486e78
4
+ data.tar.gz: 8395f6436bf0d427cc1e9760305708f154c64535
5
+ SHA512:
6
+ metadata.gz: f35a1cdf106893354b119c57438f8ea6d0c7b13498650cbc8b57dff77e5b66ece4de737c13e58875aee2614691f5cd712a52174e181708e6123dec2fbf7fe513
7
+ data.tar.gz: 7c037e48c4f7a46df25d0b13afb6d15e94f49d7e4ccef55d45bef9b5d9816d8a00c892b01c86dcc14a3315927984bfc830cc15d899e849eb588bbbe0aec85dd4
data/README.md CHANGED
@@ -78,23 +78,24 @@ This will retry the block up to 3 times when timeouts occur.
78
78
 
79
79
  ## Configuration
80
80
 
81
- NNEClient is based on Savon and HTTPI. You may use these libraries to control
82
- logging. For example:
81
+ NNEClient is based on Savon and HTTPI. To disable logging with HTTPI do:
83
82
 
84
83
  HTTPI.log = false
85
84
 
86
- Savon.configure do |config|
87
- config.log = false # disable logging
88
- config.log_level = :info # changing the log level
89
- config.logger = Rails.logger # using the Rails logger
90
- end
91
-
92
85
  To set a 5 second expiration on reads from NNE do:
93
86
 
94
87
  NNEClient.configure do |config|
95
88
  config.http_read_timeout = 5
96
89
  end
97
90
 
91
+ The NNEClient configuration can also be used to control logging:
92
+
93
+ NNEClient.configure do |config|
94
+ config.log = true # enable logging (default: false)
95
+ config.log_level = :info # change the log level (default: :info)
96
+ config.logger = Rails.logger # use the Rails logger
97
+ end
98
+
98
99
  Alternatively use `with_timeout`:
99
100
 
100
101
  NNEClient.with_timeout(3) do
@@ -18,32 +18,25 @@ module NNEClient
18
18
  private
19
19
 
20
20
  def perform_request(&block)
21
- client.request('wsdl', @command, request_attributes) do
22
- if false
23
- # Savon 0.9.5 does not support this
24
- soap.body do |xml|
25
- yield xml
26
- end
27
- else
28
- # So create a builder manually
29
- str = StringIO.new
30
- builder = Builder::XmlMarkup.new(:target => str)
31
- yield builder
32
- str.rewind
33
- soap.body = str.read
34
- end
35
- end
21
+ str = StringIO.new
22
+ builder = Builder::XmlMarkup.new(:target => str)
23
+ yield builder
24
+ str.rewind
25
+ client.call(@command.to_sym, message: str.read, attributes: request_attributes)
36
26
  end
37
27
 
38
28
  def request_attributes
39
- { "env:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" }
29
+ { :'env:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" }
40
30
  end
41
31
 
42
32
  def client
43
- @client ||= Savon::Client.new do
44
- wsdl.document = File.expand_path("../../../wsdl/nne.wsdl", __FILE__)
33
+ @client ||= Savon.client do |client|
34
+ client.wsdl File.expand_path("../../../wsdl/nne.wsdl", __FILE__)
35
+ client.read_timeout NNEClient.config.http_read_timeout
36
+ client.log !!NNEClient.config.log
37
+ client.log_level NNEClient.config.log_level
38
+ client.logger NNEClient.config.logger if NNEClient.config.logger
45
39
  end
46
- @client.http.read_timeout = NNEClient.config.http_read_timeout
47
40
  @client
48
41
  end
49
42
  end
@@ -66,13 +66,13 @@ module NNEClient
66
66
 
67
67
  # List of additional_names
68
68
  def additional_names
69
- result = Fetch.new(tdc_id, 'fetchCompanyAdditionalNames').result_set.to_hash
69
+ result = Fetch.new(tdc_id, :fetch_company_additional_names).result_set.to_hash
70
70
  Array(result[:array_ofstring][:item])
71
71
  end
72
72
 
73
73
  # List of trades
74
74
  def trades
75
- trades = Fetch.new(tdc_id, 'fetchCompanyTrade').result_set.to_hash[:trade] || []
75
+ trades = Fetch.new(tdc_id, :fetch_company_trade).result_set.to_hash[:trade] || []
76
76
  if trades.kind_of?(Hash)
77
77
  [Trade.new(trades)]
78
78
  else
@@ -135,19 +135,19 @@ module NNEClient
135
135
  private
136
136
 
137
137
  def fetch_associates
138
- Fetch.new(tdc_id, 'fetchCompanyAssociates').result_set.to_hash[:subsidiary] || []
138
+ Fetch.new(tdc_id, :fetch_company_associates).result_set.to_hash[:subsidiary] || []
139
139
  end
140
140
 
141
141
  def fetch_finances
142
- Fetch.new(tdc_id, 'fetchCompanyFinance').result_set.to_hash[:finance] || []
142
+ Fetch.new(tdc_id, :fetch_company_finance).result_set.to_hash[:finance] || []
143
143
  end
144
144
 
145
145
  def fetch_subsidiaries
146
- Fetch.new(tdc_id, 'fetchCompanySubsidiaries').result_set.to_hash[:subsidiary] || []
146
+ Fetch.new(tdc_id, :fetch_company_subsidiaries).result_set.to_hash[:subsidiary] || []
147
147
  end
148
148
 
149
149
  def fetch_ownerships
150
- Fetch.new(tdc_id, 'fetchCompanyOwnership').result_set.to_hash[:ownership] || []
150
+ Fetch.new(tdc_id, :fetch_company_ownership).result_set.to_hash[:ownership] || []
151
151
  end
152
152
 
153
153
  def basic_attribute(attribute)
@@ -169,7 +169,7 @@ module NNEClient
169
169
  end
170
170
 
171
171
  def fetch_extended_attributes
172
- Fetch.new(tdc_id, 'fetchCompany').result_set.to_hash
172
+ Fetch.new(tdc_id, :fetch_company).result_set.to_hash
173
173
  end
174
174
  end
175
175
  end
@@ -1,3 +1,3 @@
1
1
  module NNEClient
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/nne_client.rb CHANGED
@@ -23,6 +23,9 @@ module NNEClient
23
23
 
24
24
  config :access_key
25
25
  config :http_read_timeout
26
+ config :log, :default => false
27
+ config :log_level, :default => :info
28
+ config :logger
26
29
 
27
30
  # Where users start the interaction with the library.
28
31
  #
data/nne_client.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.name = "nne_client"
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = NNEClient::VERSION
18
- gem.add_dependency('savon', '~> 0.9.5')
18
+ gem.add_dependency('savon', '~> 2.2')
19
19
  gem.add_dependency('config_newton', '~> 0.1.1')
20
20
  gem.add_development_dependency('vcr')
21
21
  gem.add_development_dependency('fakeweb')
data/spec/spec_helper.rb CHANGED
@@ -5,13 +5,6 @@ require 'nne_client'
5
5
 
6
6
  HTTPI.log = false
7
7
 
8
- Savon.configure do |config|
9
- config.log = false # disable logging
10
- config.log_level = :info # changing the log level
11
- # config.logger = Rails.logger # using the Rails logger
12
- end
13
-
14
-
15
8
  VCR.configure do |c|
16
9
  c.cassette_library_dir = 'spec/vcr_cassettes'
17
10
  c.hook_into :fakeweb
metadata CHANGED
@@ -1,122 +1,106 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: nne_client
3
- version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 7
10
- version: 0.0.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Jacob Atzen
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-12-10 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2013-11-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: savon
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 49
29
- segments:
30
- - 0
31
- - 9
32
- - 5
33
- version: 0.9.5
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
34
20
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: config_newton
38
21
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
42
24
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 25
45
- segments:
46
- - 0
47
- - 1
48
- - 1
25
+ - !ruby/object:Gem::Version
26
+ version: '2.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: config_newton
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
49
33
  version: 0.1.1
50
34
  type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: vcr
54
35
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: vcr
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
64
48
  type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: fakeweb
68
49
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fakeweb
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
78
62
  type: :development
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: rspec
82
63
  prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
92
76
  type: :development
93
- version_requirements: *id005
94
- - !ruby/object:Gem::Dependency
95
- name: equivalent-xml
96
77
  prerelease: false
97
- requirement: &id006 !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: equivalent-xml
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
100
87
  - - ~>
101
- - !ruby/object:Gem::Version
102
- hash: 5
103
- segments:
104
- - 0
105
- - 2
106
- - 9
88
+ - !ruby/object:Gem::Version
107
89
  version: 0.2.9
108
90
  type: :development
109
- version_requirements: *id006
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 0.2.9
110
97
  description: Client library for the Navne & Numre Erhverv SOAP service
111
- email:
98
+ email:
112
99
  - jacob@incremental.dk
113
100
  executables: []
114
-
115
101
  extensions: []
116
-
117
102
  extra_rdoc_files: []
118
-
119
- files:
103
+ files:
120
104
  - .gitignore
121
105
  - Gemfile
122
106
  - History.md
@@ -170,40 +154,30 @@ files:
170
154
  - spec/vcr_cassettes/search_lokalebasen.yml
171
155
  - spec/vcr_cassettes/search_lokalebasen_with_access_key.yml
172
156
  - wsdl/nne.wsdl
173
- homepage: ""
157
+ homepage: ''
174
158
  licenses: []
175
-
159
+ metadata: {}
176
160
  post_install_message:
177
161
  rdoc_options: []
178
-
179
- require_paths:
162
+ require_paths:
180
163
  - lib
181
- required_ruby_version: !ruby/object:Gem::Requirement
182
- none: false
183
- requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- hash: 3
187
- segments:
188
- - 0
189
- version: "0"
190
- required_rubygems_version: !ruby/object:Gem::Requirement
191
- none: false
192
- requirements:
193
- - - ">="
194
- - !ruby/object:Gem::Version
195
- hash: 3
196
- segments:
197
- - 0
198
- version: "0"
164
+ required_ruby_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - '>='
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
199
174
  requirements: []
200
-
201
175
  rubyforge_project:
202
- rubygems_version: 1.8.17
176
+ rubygems_version: 2.0.14
203
177
  signing_key:
204
- specification_version: 3
178
+ specification_version: 4
205
179
  summary: A small library easing integration with NNE
206
- test_files:
180
+ test_files:
207
181
  - spec/finance_spec.rb
208
182
  - spec/ownership_spec.rb
209
183
  - spec/result_spec.rb
@@ -235,4 +209,3 @@ test_files:
235
209
  - spec/vcr_cassettes/search_lokale_100.yml
236
210
  - spec/vcr_cassettes/search_lokalebasen.yml
237
211
  - spec/vcr_cassettes/search_lokalebasen_with_access_key.yml
238
- has_rdoc: