bbc_data_service 0.1.20 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency("activemodel", "~>3.1.0")
23
23
  #s.add_dependency("rdf-rdfxml", "~>0.3.4")
24
24
  s.add_dependency("rdf-json", "~>0.3.0")
25
+ s.add_dependency("nokogiri", "1.5.0")
25
26
  # Development Dependencies
26
27
  s.add_development_dependency("rspec", "~>2.6.0")
27
28
  s.add_development_dependency("turn", "~>0.8.2")
@@ -27,6 +27,8 @@ module BBCDataService
27
27
  end
28
28
  when :json
29
29
  return BBCDataService::JSONParser.parse_feed(app_fixture)
30
+ when :xml
31
+ return BBCDataService::XMLParser.parse_feed(app_fixture)
30
32
  end
31
33
  end
32
34
  end
@@ -1,3 +1,3 @@
1
1
  module BBCDataService
2
- VERSION = "0.1.20"
2
+ VERSION = "0.2"
3
3
  end
@@ -0,0 +1,7 @@
1
+ module BBCDataService
2
+ class XMLParser
3
+ def self.parse_feed(app_fixture)
4
+ return Nokogiri::Slop(File.open(app_fixture[:feed_url]))
5
+ end
6
+ end
7
+ end
@@ -1,11 +1,13 @@
1
1
  require "rubygems"
2
2
  require "sinatra"
3
+ require "nokogiri"
3
4
  require "active_model"
4
5
  require "bbc_data_service/service_config"
5
6
  require "bbc_data_service/version"
6
7
  require "bbc_data_service/rdf_parser"
7
8
  require "bbc_data_service/json_parser"
8
9
  require "bbc_data_service/app_fixture"
10
+ require "bbc_data_service/xml_parser"
9
11
  require "bbc_data_service/fixture_loader"
10
12
 
11
13
  module BBCDataService
@@ -50,4 +50,9 @@ describe BBCDataService::FixtureLoader do
50
50
  object.name.should == "Athletics"
51
51
  end
52
52
 
53
+ it "should allow parsing of XML" do
54
+ object = BBCDataService::FixtureLoader.load_fixture(:xml_test)
55
+ object.class.should == Nokogiri::HTML::Document
56
+ end
57
+
53
58
  end
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <feed xmlns="http://www.w3.org/2005/Atom">
4
+
5
+ <title>Example Feed</title>
6
+ <subtitle>A subtitle.</subtitle>
7
+ <link href="http://example.org/feed/" rel="self" />
8
+ <link href="http://example.org/" />
9
+ <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
10
+ <updated>2003-12-13T18:30:02Z</updated>
11
+ <author>
12
+ <name>John Doe</name>
13
+ <email>johndoe@example.com</email>
14
+ </author>
15
+
16
+ <entry>
17
+ <title>Atom-Powered Robots Run Amok</title>
18
+ <link href="http://example.org/2003/12/13/atom03" />
19
+ <link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"/>
20
+ <link rel="edit" href="http://example.org/2003/12/13/atom03/edit"/>
21
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
22
+ <updated>2003-12-13T18:30:02Z</updated>
23
+ <summary>Some text.</summary>
24
+ </entry>
25
+
26
+ </feed>
@@ -127,4 +127,8 @@ BBCDataService::AppFixture.register_fixture :relationships, {
127
127
  # }
128
128
  # }
129
129
  # }
130
+ }
131
+ BBCDataService::AppFixture.register_fixture :xml_test, {
132
+ :type => :xml,
133
+ :feed_url => File.expand_path("../test-xml-feed.xml", __FILE__)
130
134
  }
metadata CHANGED
@@ -1,90 +1,143 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bbc_data_service
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.20
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ version: "0.2"
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Matthew Crouch
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2011-10-07 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2011-10-12 00:00:00 Z
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
15
20
  name: sinatra
16
- requirement: &2152009980 !ruby/object:Gem::Requirement
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
17
23
  none: false
18
- requirements:
24
+ requirements:
19
25
  - - ~>
20
- - !ruby/object:Gem::Version
26
+ - !ruby/object:Gem::Version
27
+ hash: 19
28
+ segments:
29
+ - 1
30
+ - 2
31
+ - 6
21
32
  version: 1.2.6
22
33
  type: :runtime
23
- prerelease: false
24
- version_requirements: *2152009980
25
- - !ruby/object:Gem::Dependency
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
26
36
  name: activemodel
27
- requirement: &2152009480 !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
28
39
  none: false
29
- requirements:
40
+ requirements:
30
41
  - - ~>
31
- - !ruby/object:Gem::Version
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 3
46
+ - 1
47
+ - 0
32
48
  version: 3.1.0
33
49
  type: :runtime
34
- prerelease: false
35
- version_requirements: *2152009480
36
- - !ruby/object:Gem::Dependency
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
37
52
  name: rdf-json
38
- requirement: &2152009020 !ruby/object:Gem::Requirement
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
39
55
  none: false
40
- requirements:
56
+ requirements:
41
57
  - - ~>
42
- - !ruby/object:Gem::Version
58
+ - !ruby/object:Gem::Version
59
+ hash: 19
60
+ segments:
61
+ - 0
62
+ - 3
63
+ - 0
43
64
  version: 0.3.0
44
65
  type: :runtime
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: nokogiri
45
69
  prerelease: false
46
- version_requirements: *2152009020
47
- - !ruby/object:Gem::Dependency
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - "="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 1
78
+ - 5
79
+ - 0
80
+ version: 1.5.0
81
+ type: :runtime
82
+ version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
48
84
  name: rspec
49
- requirement: &2152008560 !ruby/object:Gem::Requirement
85
+ prerelease: false
86
+ requirement: &id005 !ruby/object:Gem::Requirement
50
87
  none: false
51
- requirements:
88
+ requirements:
52
89
  - - ~>
53
- - !ruby/object:Gem::Version
90
+ - !ruby/object:Gem::Version
91
+ hash: 23
92
+ segments:
93
+ - 2
94
+ - 6
95
+ - 0
54
96
  version: 2.6.0
55
97
  type: :development
56
- prerelease: false
57
- version_requirements: *2152008560
58
- - !ruby/object:Gem::Dependency
98
+ version_requirements: *id005
99
+ - !ruby/object:Gem::Dependency
59
100
  name: turn
60
- requirement: &2152008100 !ruby/object:Gem::Requirement
101
+ prerelease: false
102
+ requirement: &id006 !ruby/object:Gem::Requirement
61
103
  none: false
62
- requirements:
104
+ requirements:
63
105
  - - ~>
64
- - !ruby/object:Gem::Version
106
+ - !ruby/object:Gem::Version
107
+ hash: 59
108
+ segments:
109
+ - 0
110
+ - 8
111
+ - 2
65
112
  version: 0.8.2
66
113
  type: :development
67
- prerelease: false
68
- version_requirements: *2152008100
69
- - !ruby/object:Gem::Dependency
114
+ version_requirements: *id006
115
+ - !ruby/object:Gem::Dependency
70
116
  name: rake
71
- requirement: &2152007640 !ruby/object:Gem::Requirement
117
+ prerelease: false
118
+ requirement: &id007 !ruby/object:Gem::Requirement
72
119
  none: false
73
- requirements:
120
+ requirements:
74
121
  - - ~>
75
- - !ruby/object:Gem::Version
122
+ - !ruby/object:Gem::Version
123
+ hash: 63
124
+ segments:
125
+ - 0
126
+ - 9
127
+ - 2
76
128
  version: 0.9.2
77
129
  type: :development
78
- prerelease: false
79
- version_requirements: *2152007640
130
+ version_requirements: *id007
80
131
  description: BBC Data Service for fixture management
81
- email:
132
+ email:
82
133
  - matthew.crouch@bbc.co.uk
83
- executables:
134
+ executables:
84
135
  - bbc_data_service
85
136
  extensions: []
137
+
86
138
  extra_rdoc_files: []
87
- files:
139
+
140
+ files:
88
141
  - .gitignore
89
142
  - Gemfile
90
143
  - Rakefile
@@ -100,44 +153,56 @@ files:
100
153
  - lib/bbc_data_service/service_config.rb
101
154
  - lib/bbc_data_service/version.rb
102
155
  - lib/bbc_data_service/vocabulary.rb
156
+ - lib/bbc_data_service/xml_parser.rb
103
157
  - spec/fixture_loader_spec.rb
104
158
  - spec/fixtures/countries.rdf.json
105
159
  - spec/fixtures/country.rdf.json
106
160
  - spec/fixtures/groups-individual.json
107
161
  - spec/fixtures/groups.json
108
162
  - spec/fixtures/sports.json
163
+ - spec/fixtures/test-xml-feed.xml
109
164
  - spec/fixtures/test_config.rb
110
165
  - spec/spec_helper.rb
111
166
  homepage: https://github.com/mobzilla/bbc-data-service
112
167
  licenses: []
168
+
113
169
  post_install_message:
114
170
  rdoc_options: []
115
- require_paths:
171
+
172
+ require_paths:
116
173
  - lib
117
- required_ruby_version: !ruby/object:Gem::Requirement
174
+ required_ruby_version: !ruby/object:Gem::Requirement
118
175
  none: false
119
- requirements:
120
- - - ! '>='
121
- - !ruby/object:Gem::Version
122
- version: '0'
123
- required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ hash: 3
180
+ segments:
181
+ - 0
182
+ version: "0"
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
184
  none: false
125
- requirements:
126
- - - ! '>='
127
- - !ruby/object:Gem::Version
128
- version: '0'
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ hash: 3
189
+ segments:
190
+ - 0
191
+ version: "0"
129
192
  requirements: []
193
+
130
194
  rubyforge_project: bbc-data-service
131
195
  rubygems_version: 1.8.10
132
196
  signing_key:
133
197
  specification_version: 3
134
198
  summary: BBC Data Service
135
- test_files:
199
+ test_files:
136
200
  - spec/fixture_loader_spec.rb
137
201
  - spec/fixtures/countries.rdf.json
138
202
  - spec/fixtures/country.rdf.json
139
203
  - spec/fixtures/groups-individual.json
140
204
  - spec/fixtures/groups.json
141
205
  - spec/fixtures/sports.json
206
+ - spec/fixtures/test-xml-feed.xml
142
207
  - spec/fixtures/test_config.rb
143
208
  - spec/spec_helper.rb