parliament-ntriple 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8024f00f6563094b308db99e82840ebf5c85ea9
4
- data.tar.gz: dd98aa9b8bcb5e545a8823195fdf9e33e797199c
3
+ metadata.gz: 959375f5bbe02076050c514ba6e4f7def9aacbd3
4
+ data.tar.gz: 682b57eac0049bd9a92a8d3aca7e4024393892a2
5
5
  SHA512:
6
- metadata.gz: 79c99234bdf184d69550c44917722a63d5495da193e8a698c0c46062feed6daaf5a1f770acb3a04f419293c33a8e72c358d25d16fa964d293a036bd0b93095e6
7
- data.tar.gz: e28e92ab5119d351cd8730c190a32eabdae9d6e5759495f153576818a1844c7d078402a4c8eb3ca4c2d41e85ed09fccefe2af65c3f08eaeba98e30916a2bcb47
6
+ metadata.gz: ceb92a6eba55fda689d0cef11988833563220aa6ba9eb3db6f183245b88a5fe0ab7b2641c5070428fe2ab85146e8e91c3eaf313b088bf0b282b6c88a991de1fb
7
+ data.tar.gz: 23796e4da1efbe568b5f0d2c9bb40f0ba312f0d10ddbceecea652f4686fdcbaf31ba45cb7450f03d9ac874879a49358d26b2c1fb936979299a8ab477e615aabf
@@ -22,11 +22,32 @@ module Parliament
22
22
  #
23
23
  # @return [Parliament::Response::NTripleResponse] a Parliament::Response::NTripleResponse containing decorated Grom::Node objects.
24
24
  def build
25
- objects = ::Grom::Reader.new(@response.body).objects
26
- objects.map! { |object| @decorators.decorate(object) } unless @decorators.nil?
25
+ encoded_body = encode_to_utf8(@response.body)
26
+ encoded_body_without_bom = remove_byte_order_mark(encoded_body)
27
+
28
+ objects = ::Grom::Reader.new(encoded_body_without_bom, @decorators)&.objects
27
29
 
28
30
  Parliament::Response::NTripleResponse.new(objects)
29
31
  end
32
+
33
+ private
34
+
35
+ # Encodes HTTP response body to UTF-8
36
+ #
37
+ # @param [String] HTTP response string containing n-triple data.
38
+ # @return [String] a UTF-8 response body string.
39
+ def encode_to_utf8(response_body)
40
+ response_body.force_encoding('UTF-8')
41
+ end
42
+
43
+ # Removes byte order mark (BOM) from UTF-8 response body string
44
+ #
45
+ # @param [String] UTF-8 HTTP response string containing BOM and n-triple data.
46
+ # @return [String] a UTF-8 response body string without BOM.
47
+ def remove_byte_order_mark(response_body)
48
+ response_body.gsub!("\xEF\xBB\xBF".force_encoding('UTF-8'), '')
49
+ response_body
50
+ end
30
51
  end
31
52
  end
32
53
  end
@@ -1,5 +1,5 @@
1
1
  module Parliament
2
2
  module NTriple
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'parliament/ntriple/version'
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'grom', '~> 0.5'
23
+ spec.add_dependency 'grom', '~> 1.0'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.14'
26
26
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'simplecov', '~> 0.12'
30
30
  spec.add_development_dependency 'vcr', '~> 3.0'
31
31
  spec.add_development_dependency 'webmock', '~> 2.3'
32
- spec.add_development_dependency 'parliament-grom-decorators', '~> 0.14'
32
+ spec.add_development_dependency 'parliament-grom-decorators', '~> 0.31'
33
33
  spec.add_development_dependency 'parliament-ruby', '~> 0.10'
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-ntriple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-05 00:00:00.000000000 Z
11
+ date: 2018-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grom
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.5'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.14'
131
+ version: '0.31'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.14'
138
+ version: '0.31'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: parliament-ruby
141
141
  requirement: !ruby/object:Gem::Requirement