nne_client 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +12 -0
- data/README.md +0 -4
- data/lib/nne_client/record_types/finance.rb +28 -27
- data/lib/nne_client/request.rb +6 -5
- data/lib/nne_client/result_attributes.rb +9 -0
- data/lib/nne_client/version.rb +1 -1
- data/lib/nne_client.rb +0 -2
- data/spec/finance_spec.rb +27 -27
- data/spec/result_spec.rb +9 -6
- data/spec/vcr_cassettes/result_additional_names_single.yml +10 -676
- data/spec/vcr_cassettes/result_extended_info.yml +13 -679
- data/spec/vcr_cassettes/result_extended_info_with_access_key.yml +15 -681
- data/spec/vcr_cassettes/result_fetching_basic_attributes.yml +6 -672
- data/spec/vcr_cassettes/result_fetching_ext_attributes_email_hash.yml +14 -1346
- data/spec/vcr_cassettes/result_fetching_missing_company.yml +11 -677
- data/spec/vcr_cassettes/result_multiple_finances.yml +23 -1355
- data/spec/vcr_cassettes/result_multiple_ownerships.yml +20 -1352
- data/spec/vcr_cassettes/result_multiple_trades.yml +17 -1349
- data/spec/vcr_cassettes/result_names.yml +13 -679
- data/spec/vcr_cassettes/result_names_empty.yml +12 -678
- data/spec/vcr_cassettes/result_no_finance.yml +21 -1353
- data/spec/vcr_cassettes/result_no_ownerships.yml +12 -678
- data/spec/vcr_cassettes/result_no_subsidiaries.yml +21 -1353
- data/spec/vcr_cassettes/result_single_finance.yml +19 -1351
- data/spec/vcr_cassettes/result_single_ownership.yml +24 -1356
- data/spec/vcr_cassettes/result_single_subsidiary.yml +23 -1355
- data/spec/vcr_cassettes/result_trades.yml +11 -677
- data/spec/vcr_cassettes/search_for_noise.yml +13 -679
- data/spec/vcr_cassettes/search_lokale.yml +12 -678
- data/spec/vcr_cassettes/search_lokale_100.yml +13 -679
- data/spec/vcr_cassettes/search_lokalebasen.yml +12 -678
- data/spec/vcr_cassettes/search_lokalebasen_with_access_key.yml +13 -679
- data/wsdl/nne.wsdl +639 -0
- metadata +6 -4
data/History.md
ADDED
data/README.md
CHANGED
@@ -7,37 +7,38 @@ module NNEClient
|
|
7
7
|
end
|
8
8
|
|
9
9
|
attributes :accounting_date,
|
10
|
-
:assets,
|
11
|
-
:available_funds,
|
12
|
-
:available_funds_ratio,
|
13
|
-
:balance,
|
14
|
-
:capacity_ratio,
|
15
|
-
:contribution_ratio,
|
16
10
|
:credit_rating,
|
17
|
-
:current_assets,
|
18
|
-
:depreciations,
|
19
|
-
:fixed_assets,
|
20
|
-
:fixed_cost,
|
21
|
-
:gross_profit,
|
22
|
-
:income_before_income_tax,
|
23
11
|
:link_pdf,
|
24
|
-
:long_termed_liability,
|
25
|
-
:lots_and_sites,
|
26
|
-
:net_outcome,
|
27
12
|
:number_of_employees,
|
28
|
-
:placings,
|
29
|
-
:profit,
|
30
|
-
:profit_for_the_year,
|
31
|
-
:profit_ratio,
|
32
13
|
:published_date,
|
33
|
-
:return_on_assets,
|
34
|
-
:share_holders_funds_of_interest,
|
35
|
-
:shareholders_funds,
|
36
|
-
:short_termed_liability,
|
37
|
-
:solvency_ratio,
|
38
|
-
:stock,
|
39
|
-
:trade_debitors,
|
40
|
-
:turnover,
|
41
14
|
:year
|
15
|
+
|
16
|
+
float_attributes :assets,
|
17
|
+
:available_funds,
|
18
|
+
:available_funds_ratio,
|
19
|
+
:balance,
|
20
|
+
:capacity_ratio,
|
21
|
+
:contribution_ratio,
|
22
|
+
:current_assets,
|
23
|
+
:depreciations,
|
24
|
+
:fixed_assets,
|
25
|
+
:fixed_cost,
|
26
|
+
:gross_profit,
|
27
|
+
:income_before_income_tax,
|
28
|
+
:long_termed_liability,
|
29
|
+
:lots_and_sites,
|
30
|
+
:net_outcome,
|
31
|
+
:placings,
|
32
|
+
:profit,
|
33
|
+
:profit_for_the_year,
|
34
|
+
:profit_ratio,
|
35
|
+
:return_on_assets,
|
36
|
+
:share_holders_funds_of_interest,
|
37
|
+
:shareholders_funds,
|
38
|
+
:short_termed_liability,
|
39
|
+
:solvency_ratio,
|
40
|
+
:stock,
|
41
|
+
:trade_debitors,
|
42
|
+
:turnover
|
42
43
|
end
|
43
44
|
end
|
data/lib/nne_client/request.rb
CHANGED
@@ -15,6 +15,9 @@ module NNEClient
|
|
15
15
|
retries = 3
|
16
16
|
begin
|
17
17
|
ResultSet.new(perform_request(&block))
|
18
|
+
rescue HTTPClient::ReceiveTimeoutError => e
|
19
|
+
retries -= 1
|
20
|
+
retry if retries > 0
|
18
21
|
rescue Net::HTTPRequestTimeOut => e
|
19
22
|
retries -= 1
|
20
23
|
retry if retries > 0
|
@@ -45,12 +48,10 @@ module NNEClient
|
|
45
48
|
{ "env:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" }
|
46
49
|
end
|
47
50
|
|
48
|
-
def wsdl_url
|
49
|
-
'http://service.nnerhverv.dk/nne-ws/3.1/NNE?WSDL'
|
50
|
-
end
|
51
|
-
|
52
51
|
def client
|
53
|
-
@client ||= Savon::Client.new
|
52
|
+
@client ||= Savon::Client.new do
|
53
|
+
wsdl.document = File.expand_path("../../../wsdl/nne.wsdl", __FILE__)
|
54
|
+
end
|
54
55
|
end
|
55
56
|
end
|
56
57
|
end
|
@@ -33,5 +33,14 @@ module NNEClient
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
# Create a method that converts to float for each key listed in attrs
|
38
|
+
def float_attributes(*attrs)
|
39
|
+
attrs.each do |attribute|
|
40
|
+
define_method(attribute) do
|
41
|
+
@hash[attribute].to_f unless @hash[attribute].kind_of?(Hash)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
data/lib/nne_client/version.rb
CHANGED
data/lib/nne_client.rb
CHANGED
data/spec/finance_spec.rb
CHANGED
@@ -44,36 +44,36 @@ describe NNEClient::Finance do
|
|
44
44
|
subject { NNEClient::Finance.new(hash) }
|
45
45
|
|
46
46
|
its(:accounting_date) { should == hash[:accounting_date] }
|
47
|
-
its(:assets) { should == hash[:assets] }
|
48
|
-
its(:available_funds) { should == hash[:available_funds] }
|
49
|
-
its(:available_funds_ratio) { should == hash[:available_funds_ratio] }
|
50
|
-
its(:balance) { should == hash[:balance] }
|
51
|
-
its(:capacity_ratio) { should == hash[:capacity_ratio] }
|
52
|
-
its(:contribution_ratio) { should == hash[:contribution_ratio] }
|
47
|
+
its(:assets) { should == hash[:assets].to_f }
|
48
|
+
its(:available_funds) { should == hash[:available_funds].to_f }
|
49
|
+
its(:available_funds_ratio) { should == hash[:available_funds_ratio].to_f }
|
50
|
+
its(:balance) { should == hash[:balance].to_f }
|
51
|
+
its(:capacity_ratio) { should == hash[:capacity_ratio].to_f }
|
52
|
+
its(:contribution_ratio) { should == hash[:contribution_ratio].to_f }
|
53
53
|
its(:credit_rating) { should be_nil }
|
54
|
-
its(:current_assets) { should == hash[:current_assets] }
|
55
|
-
its(:depreciations) { should == hash[:depreciations] }
|
56
|
-
its(:fixed_assets) { should == hash[:fixed_assets] }
|
57
|
-
its(:fixed_cost) { should == hash[:fixed_cost] }
|
58
|
-
its(:gross_profit) { should == hash[:gross_profit] }
|
59
|
-
its(:income_before_income_tax) { should == hash[:income_before_income_tax] }
|
54
|
+
its(:current_assets) { should == hash[:current_assets].to_f }
|
55
|
+
its(:depreciations) { should == hash[:depreciations].to_f }
|
56
|
+
its(:fixed_assets) { should == hash[:fixed_assets].to_f }
|
57
|
+
its(:fixed_cost) { should == hash[:fixed_cost].to_f }
|
58
|
+
its(:gross_profit) { should == hash[:gross_profit].to_f }
|
59
|
+
its(:income_before_income_tax) { should == hash[:income_before_income_tax].to_f }
|
60
60
|
its(:link_pdf) { should == hash[:link_pdf] }
|
61
|
-
its(:long_termed_liability) { should == hash[:long_termed_liability] }
|
62
|
-
its(:lots_and_sites) { should == hash[:lots_and_sites] }
|
63
|
-
its(:net_outcome) { should == hash[:net_outcome] }
|
61
|
+
its(:long_termed_liability) { should == hash[:long_termed_liability].to_f }
|
62
|
+
its(:lots_and_sites) { should == hash[:lots_and_sites].to_f }
|
63
|
+
its(:net_outcome) { should == hash[:net_outcome].to_f }
|
64
64
|
its(:number_of_employees) { should == hash[:number_of_employees] }
|
65
|
-
its(:placings) { should == hash[:placings] }
|
66
|
-
its(:profit) { should == hash[:profit] }
|
67
|
-
its(:profit_for_the_year) { should == hash[:profit_for_the_year] }
|
68
|
-
its(:profit_ratio) { should == hash[:profit_ratio] }
|
65
|
+
its(:placings) { should == hash[:placings].to_f }
|
66
|
+
its(:profit) { should == hash[:profit].to_f }
|
67
|
+
its(:profit_for_the_year) { should == hash[:profit_for_the_year].to_f }
|
68
|
+
its(:profit_ratio) { should == hash[:profit_ratio].to_f }
|
69
69
|
its(:published_date) { should == hash[:published_date] }
|
70
|
-
its(:return_on_assets) { should == hash[:return_on_assets] }
|
71
|
-
its(:share_holders_funds_of_interest) { should == hash[:share_holders_funds_of_interest] }
|
72
|
-
its(:shareholders_funds) { should == hash[:shareholders_funds] }
|
73
|
-
its(:short_termed_liability) { should == hash[:short_termed_liability] }
|
74
|
-
its(:solvency_ratio) { should == hash[:solvency_ratio] }
|
75
|
-
its(:stock) { should == hash[:stock] }
|
76
|
-
its(:trade_debitors) { should == hash[:trade_debitors] }
|
77
|
-
its(:turnover) { should == hash[:turnover] }
|
70
|
+
its(:return_on_assets) { should == hash[:return_on_assets].to_f }
|
71
|
+
its(:share_holders_funds_of_interest) { should == hash[:share_holders_funds_of_interest].to_f }
|
72
|
+
its(:shareholders_funds) { should == hash[:shareholders_funds].to_f }
|
73
|
+
its(:short_termed_liability) { should == hash[:short_termed_liability].to_f }
|
74
|
+
its(:solvency_ratio) { should == hash[:solvency_ratio].to_f }
|
75
|
+
its(:stock) { should == hash[:stock].to_f }
|
76
|
+
its(:trade_debitors) { should == hash[:trade_debitors].to_f }
|
77
|
+
its(:turnover) { should == hash[:turnover].to_f }
|
78
78
|
its(:year) { should == hash[:year] }
|
79
79
|
end
|
data/spec/result_spec.rb
CHANGED
@@ -94,7 +94,7 @@ describe NNEClient::Result do
|
|
94
94
|
its(:homepage) { should be_nil }
|
95
95
|
its(:founded_year) { should == '2009' }
|
96
96
|
its(:number_of_employees) { should == '0' }
|
97
|
-
its(:tdf_name) { should == '
|
97
|
+
its(:tdf_name) { should == 'Jacob Atzen' }
|
98
98
|
its(:status_text) { should == 'Selskabet er i normal drift.' }
|
99
99
|
end
|
100
100
|
|
@@ -109,7 +109,7 @@ describe NNEClient::Result do
|
|
109
109
|
its(:homepage) { should be_nil }
|
110
110
|
its(:founded_year) { should == '2009' }
|
111
111
|
its(:number_of_employees) { should == '0' }
|
112
|
-
its(:tdf_name) { should == '
|
112
|
+
its(:tdf_name) { should == 'Jacob Atzen' }
|
113
113
|
its(:status_text) { should == 'Selskabet er i normal drift.' }
|
114
114
|
end
|
115
115
|
end
|
@@ -257,14 +257,17 @@ describe NNEClient::Result do
|
|
257
257
|
|
258
258
|
it "knows all names" do
|
259
259
|
soap_vcr('result_names') do
|
260
|
-
result = NNEClient::Result.new(:official_name => 'Name', :tdc_id => '
|
260
|
+
result = NNEClient::Result.new(:official_name => 'Name', :tdc_id => '100055268')
|
261
261
|
result.additional_names.should == [
|
262
|
-
"
|
262
|
+
"A/S Kalundborg Folkeblad",
|
263
|
+
"Aktieselskabet Holbæk Amts Venstreblad",
|
263
264
|
"A/S Trykkeriet Nordvest",
|
264
265
|
"A/S Trykkeriet Nordvestsjælland",
|
266
|
+
"Havision A/S",
|
265
267
|
"Nordvestsjællands Media Selskab A/S",
|
266
|
-
"Radio Holbæk A/S"
|
267
|
-
|
268
|
+
"Radio Holbæk A/S",
|
269
|
+
"Tv Holbæk A/S"
|
270
|
+
]
|
268
271
|
end
|
269
272
|
end
|
270
273
|
|