open_graph_reader 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +22 -0
- data/README.md +95 -0
- data/lib/open_graph_reader/builder.rb +12 -0
- data/lib/open_graph_reader/configuration.rb +12 -2
- data/lib/open_graph_reader/definitions.rb +1 -1
- data/lib/open_graph_reader/object/dsl/types.rb +1 -1
- data/lib/open_graph_reader/parser.rb +1 -3
- data/lib/open_graph_reader/version.rb +1 -1
- data/spec/fixtures/real_world/missing_title.html +338 -336
- data/spec/fixtures/real_world/missing_url.html +1764 -0
- data/spec/integration/real_world_spec.rb +24 -2
- metadata +6 -2
@@ -442,8 +442,8 @@ DESCRIPTION
|
|
442
442
|
}.to raise_error OpenGraphReader::InvalidObjectError, /does not start with/
|
443
443
|
end
|
444
444
|
|
445
|
-
it "parses with
|
446
|
-
OpenGraphReader.config.
|
445
|
+
it "parses with paths turned on" do
|
446
|
+
OpenGraphReader.config.synthesize_full_url = true
|
447
447
|
OpenGraphReader.config.synthesize_image_url = true
|
448
448
|
|
449
449
|
object = OpenGraphReader.parse!(
|
@@ -459,4 +459,26 @@ DESCRIPTION
|
|
459
459
|
)
|
460
460
|
end
|
461
461
|
end
|
462
|
+
|
463
|
+
describe "missing_url" do
|
464
|
+
it "does not parse" do
|
465
|
+
expect {
|
466
|
+
OpenGraphReader.parse! fixture_html "real_world/missing_url"
|
467
|
+
}.to raise_error OpenGraphReader::InvalidObjectError, /Missing required/
|
468
|
+
end
|
469
|
+
|
470
|
+
it "parses with url synthesization turned on" do
|
471
|
+
OpenGraphReader.config.synthesize_url = true
|
472
|
+
|
473
|
+
object = OpenGraphReader.parse!(
|
474
|
+
fixture_html("real_world/missing_url"),
|
475
|
+
"http://taz.de/!159273"
|
476
|
+
)
|
477
|
+
|
478
|
+
expect(object.og.title).to eq "Wandel im Biohandel: Alnatura weitet Vertrieb im Netz aus"
|
479
|
+
expect(object.og.type).to eq "article"
|
480
|
+
expect(object.og.image.url).to eq "http://www.taz.de/uploads/images/948/0634n.jpg"
|
481
|
+
expect(object.og.url).to eq "http://taz.de/!159273"
|
482
|
+
end
|
483
|
+
end
|
462
484
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_graph_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonne Haß
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -105,6 +105,8 @@ files:
|
|
105
105
|
- ".gitmodules"
|
106
106
|
- ".rspec"
|
107
107
|
- ".yardopts"
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
108
110
|
- lib/open_graph_reader.rb
|
109
111
|
- lib/open_graph_reader/base.rb
|
110
112
|
- lib/open_graph_reader/builder.rb
|
@@ -171,6 +173,7 @@ files:
|
|
171
173
|
- spec/fixtures/real_world/invalid_datetime.html
|
172
174
|
- spec/fixtures/real_world/missing_image.html
|
173
175
|
- spec/fixtures/real_world/missing_title.html
|
176
|
+
- spec/fixtures/real_world/missing_url.html
|
174
177
|
- spec/fixtures/real_world/mixed_case_properties.html
|
175
178
|
- spec/fixtures/real_world/mixed_case_type.html
|
176
179
|
- spec/fixtures/real_world/not_a_reference.html
|
@@ -262,6 +265,7 @@ test_files:
|
|
262
265
|
- spec/fixtures/real_world/invalid_datetime.html
|
263
266
|
- spec/fixtures/real_world/missing_image.html
|
264
267
|
- spec/fixtures/real_world/missing_title.html
|
268
|
+
- spec/fixtures/real_world/missing_url.html
|
265
269
|
- spec/fixtures/real_world/mixed_case_properties.html
|
266
270
|
- spec/fixtures/real_world/mixed_case_type.html
|
267
271
|
- spec/fixtures/real_world/not_a_reference.html
|