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 CHANGED
@@ -1,3 +1,5 @@
1
+ v0.0.9. fixes bug preventing multiple sic codes being returned in query response
2
+
1
3
  v0.0.8. use Nokogiri instead of Hpricot
2
4
 
3
5
  v0.0.7. fixes bug preventing unique transaction ids being created when api called frequently
@@ -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.8"
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{2010-12-18}
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"]
@@ -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.8" unless defined? CompaniesHouse::VERSION
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><sic_codes><sic_text>9261 - Operate sports arenas &amp; stadiums</sic_text></sic_codes></company_details></Body>'
21
+ xml = '<Body><company_details><SICCodes><SicText>9261 - Operate sports arenas &amp; 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 &amp; 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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
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: 2010-12-18 00:00:00 +00:00
18
+ date: 2011-01-11 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency