companies-house 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/companies-house.gemspec +2 -2
- data/lib/companies_house.rb +3 -1
- data/spec/lib/companies_house_spec.rb +8 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
data/companies-house.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{companies-house}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.9"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Rob McKinnon"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2011-01-11}
|
10
10
|
s.description = %q{Ruby API to UK Companies House XML Gateway.
|
11
11
|
}
|
12
12
|
s.email = ["rob ~@nospam@~ rubyforge.org"]
|
data/lib/companies_house.rb
CHANGED
@@ -14,7 +14,7 @@ require File.dirname(__FILE__) + '/companies_house/exception'
|
|
14
14
|
$KCODE = 'UTF8' unless RUBY_VERSION >= "1.9"
|
15
15
|
|
16
16
|
module CompaniesHouse
|
17
|
-
VERSION = "0.0.
|
17
|
+
VERSION = "0.0.9" unless defined? CompaniesHouse::VERSION
|
18
18
|
|
19
19
|
class << self
|
20
20
|
|
@@ -124,6 +124,8 @@ module CompaniesHouse
|
|
124
124
|
sic_codes = object.sic_codes
|
125
125
|
if sic_codes.respond_to?(:sic_text) && sic_codes.sic_text
|
126
126
|
sic_codes.morph(:sic_texts, [sic_codes.sic_text])
|
127
|
+
elsif sic_codes.respond_to?(:sic_texts) && sic_codes.sic_texts
|
128
|
+
# leave as is
|
127
129
|
else
|
128
130
|
object.morph(:sic_codes, Morph.from_hash({:sic_codes => {'sic_texts' => []} }) )
|
129
131
|
end
|
@@ -18,7 +18,7 @@ describe CompaniesHouse do
|
|
18
18
|
end
|
19
19
|
describe 'and xml contains single sic_text' do
|
20
20
|
it 'should convert to sic_code sic_texts' do
|
21
|
-
xml = '<Body><company_details><
|
21
|
+
xml = '<Body><company_details><SICCodes><SicText>9261 - Operate sports arenas & stadiums</SicText></SICCodes></company_details></Body>'
|
22
22
|
|
23
23
|
object = CompaniesHouse.objectify xml
|
24
24
|
object.sic_codes.sic_text.should == '9261 - Operate sports arenas & stadiums'
|
@@ -37,6 +37,13 @@ describe CompaniesHouse do
|
|
37
37
|
object.sic_codes.sic_texts.should == []
|
38
38
|
end
|
39
39
|
end
|
40
|
+
describe 'and xml contains multiple sic codes' do
|
41
|
+
it 'should return array of sic codes' do
|
42
|
+
xml = '<Body><CompanyDetails><SICCodes><SicText>2960 - Manufacture of weapons & ammunition</SicText><SicText>3410 - Manufacture of motor vehicles</SicText></SICCodes></CompanyDetails></Body>'
|
43
|
+
object = CompaniesHouse.objectify xml
|
44
|
+
object.sic_codes.sic_texts.should == ['2960 - Manufacture of weapons & ammunition','3410 - Manufacture of motor vehicles']
|
45
|
+
end
|
46
|
+
end
|
40
47
|
end
|
41
48
|
|
42
49
|
describe 'and xml contains Error' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: companies-house
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rob McKinnon
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-11 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|