parliament-ruby 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/lib/parliament/request.rb +0 -7
- data/lib/parliament/response.rb +14 -2
- data/lib/parliament/version.rb +1 -1
- data/parliament-ruby.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b45e08c7fa2e28c6b5f0c7b9d754cb7cc51449a
|
4
|
+
data.tar.gz: 3e76b4cb267bbd1c5a8bea9e2488dc96e93bd513
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c4f920226cdb58e1f9931fe1768d119762268f89238808491e2c2cfc014ac776e6477c21062a5b44d6beed69b384cd4cd985c8da57f6c8faf338bb592253ca2
|
7
|
+
data.tar.gz: 8cfac53fe11fe6306a5dbe1750d2f89ddd535e1d7b01b644fe600ece78b5adc800335bb3c712f5c7687ae89e88306171b9f265355a596c50c940df3753065ac5
|
data/Gemfile
CHANGED
data/lib/parliament/request.rb
CHANGED
@@ -118,13 +118,6 @@ module Parliament
|
|
118
118
|
h.request api_request
|
119
119
|
end
|
120
120
|
|
121
|
-
# net_response = Net::HTTP.start(endpoint_uri.host, endpoint_uri.port, use_ssl: true).start do |http|
|
122
|
-
# request = Net::HTTP::Get.new(endpoint_uri)
|
123
|
-
# request.add_field('Accept', 'application/n-triples')
|
124
|
-
#
|
125
|
-
# http.request(request)
|
126
|
-
# end
|
127
|
-
|
128
121
|
handle_errors(net_response)
|
129
122
|
|
130
123
|
build_parliament_response(net_response)
|
data/lib/parliament/response.rb
CHANGED
@@ -21,7 +21,7 @@ module Parliament
|
|
21
21
|
|
22
22
|
# Given our array of Grom::Nodes, filter them into arrays of 'types' of nodes.
|
23
23
|
#
|
24
|
-
# Note: this method assumes all of your nodes include a #type attribute.
|
24
|
+
# Note: this method assumes all of your nodes include a #type attribute or are blank nodes.
|
25
25
|
#
|
26
26
|
# @since 0.2.0
|
27
27
|
#
|
@@ -58,6 +58,17 @@ module Parliament
|
|
58
58
|
# type_2 #=> [#<Grom::Node @type='type_2'>]
|
59
59
|
# type_1 #=> [#<Grom::Node @type='type_1'>, #<Grom::Node @type='type_1'>]
|
60
60
|
#
|
61
|
+
# @example Filtering blank nodes
|
62
|
+
# node_1 = Grom::Node.new
|
63
|
+
# node_1.instance_variable_set(:type, 'type_1')
|
64
|
+
# node_2 = Grom::Node.new
|
65
|
+
# node_3 = Grom::Node.new
|
66
|
+
# node_3.instance_variable_set(:type, 'type_1')
|
67
|
+
# nodes = [node_1, node_2, node_3]
|
68
|
+
#
|
69
|
+
# response = Parliament::Response.new(nodes)
|
70
|
+
# response.filter(Grom::Node::BLANK) #=> [#<Grom::Node>]
|
71
|
+
#
|
61
72
|
# @param [Array<String>] types An array of type strings that you are looking for.
|
62
73
|
# @return [Array<Grom::Node> || Array<*Array<Grom::Node>>] If you pass one type, this returns an Array of Grom::Node objects. If you pass multiple, it returns an array, of arrays of Grom::Node objects.
|
63
74
|
def filter(*types)
|
@@ -65,7 +76,8 @@ module Parliament
|
|
65
76
|
|
66
77
|
unless types.empty?
|
67
78
|
@nodes.each do |node|
|
68
|
-
type_index = types.index(node.type)
|
79
|
+
type_index = node.blank? ? types.index(Grom::Node::BLANK) : types.index(node.type)
|
80
|
+
|
69
81
|
filtered_objects[type_index] << node unless type_index.nil?
|
70
82
|
end
|
71
83
|
end
|
data/lib/parliament/version.rb
CHANGED
data/parliament-ruby.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_dependency 'grom', '~> 0.3.
|
24
|
+
spec.add_dependency 'grom', '~> 0.3.6'
|
25
25
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.13'
|
27
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parliament-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Rayner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-29 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.3.
|
19
|
+
version: 0.3.6
|
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.3.
|
26
|
+
version: 0.3.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
190
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.6.
|
191
|
+
rubygems_version: 2.6.6
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: Internal parliamentary API wrapper
|