gsa 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/gsa.rb +0 -1
- data/lib/gsa/feeder.rb +2 -7
- data/lib/gsa/records_converter.rb +2 -4
- data/lib/gsa/version.rb +1 -1
- data/spec/lib/gsa_spec.rb +3 -5
- metadata +2 -3
- data/lib/gsa/modules/filer.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb7ab83987937bd6e2115d300a904349e76956b6
|
4
|
+
data.tar.gz: c8882dfaeda6c36d68204da988309cb21141ecfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae62141d18608f60d837ad1036d731988361b238c7d7f75a2b58280f12f6ffc8f2254771d96242d6ca64d4ff349418a153d3457d1e8e7d831bd67c233a70af74
|
7
|
+
data.tar.gz: b6c5745215040a1760f81a9aa5ec218dddb49c31f7f3fe609b33ebe9ae95fd39fc0bc2a608158bb1fc51b19117067fbd002a65895dccf3d9b060145fd4b3afb3
|
data/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
## GSA
|
1
|
+
## GSA Ruby Gem
|
2
2
|
* Work in progress.
|
3
|
-
*
|
3
|
+
* Documentation coming tomorrow (09/20/2013)
|
data/lib/gsa.rb
CHANGED
@@ -5,7 +5,6 @@ require 'json'
|
|
5
5
|
require_relative 'gsa/version'
|
6
6
|
require_relative 'gsa/modules/injector'
|
7
7
|
require_relative 'gsa/modules/xmlizer'
|
8
|
-
require_relative 'gsa/modules/filer'
|
9
8
|
require_relative 'gsa/records_converter'
|
10
9
|
require_relative 'gsa/feeder'
|
11
10
|
require_relative 'gsa/searcher'
|
data/lib/gsa/feeder.rb
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
module GSA
|
2
2
|
class Feeder
|
3
|
-
|
4
|
-
|
5
|
-
def self.feed(file_name, datasource_name)
|
6
|
-
|
7
|
-
file = open_file(file_name)
|
8
|
-
|
3
|
+
def self.feed(xml, datasource_name)
|
9
4
|
RestClient.post(
|
10
5
|
"#{GSA.base_uri}#{GSA::FEED_EXTENSION}",
|
11
6
|
{
|
12
7
|
:feedtype => GSA::FEED_TYPE,
|
13
8
|
:datasource => datasource_name,
|
14
|
-
:data =>
|
9
|
+
:data => xml
|
15
10
|
}
|
16
11
|
)
|
17
12
|
end
|
@@ -2,11 +2,9 @@ module GSA
|
|
2
2
|
class RecordsConverter
|
3
3
|
extend XMLizer
|
4
4
|
extend Injector
|
5
|
-
extend Filer
|
6
5
|
|
7
6
|
def self.convert(args)
|
8
7
|
records = args[:records]
|
9
|
-
file_name = args[:file_name]
|
10
8
|
searchable = args[:searchable]
|
11
9
|
datasource_name = args[:datasource_name]
|
12
10
|
datasource_uri = args[:datasource_uri]
|
@@ -16,7 +14,7 @@ module GSA
|
|
16
14
|
# if there is only one record, convert to the expected array.
|
17
15
|
records = [records] if records.is_a? Hash
|
18
16
|
|
19
|
-
|
17
|
+
layout(records, searchable, datasource_name, datasource_uri, datasource_uid, action)
|
20
18
|
end
|
21
19
|
|
22
20
|
#######
|
@@ -55,7 +53,7 @@ module GSA
|
|
55
53
|
end
|
56
54
|
|
57
55
|
def self.record_metadata(record)
|
58
|
-
inject_s(record) {|key, value| tag(:meta, {:name => key, :content => value})}
|
56
|
+
inject_s(record) {|key, value| tag(:meta, {:name => key.to_s, :content => value.to_s})}
|
59
57
|
end
|
60
58
|
end
|
61
59
|
end
|
data/lib/gsa/version.rb
CHANGED
data/spec/lib/gsa_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe GSA do
|
|
16
16
|
it "successfully adds the records to the gsa index" do
|
17
17
|
VCR.use_cassette("many_records") do
|
18
18
|
results = GSA.feed(
|
19
|
-
:
|
19
|
+
:records => many_records,
|
20
20
|
:searchable => [:name, :description],
|
21
21
|
:datasource_name => "products",
|
22
22
|
:datasource_uri => "http://0.0.0.0:3000/products",
|
@@ -32,7 +32,7 @@ describe GSA do
|
|
32
32
|
it "successfully adds the records to the gsa index" do
|
33
33
|
VCR.use_cassette("single_record") do
|
34
34
|
results = GSA.feed(
|
35
|
-
:
|
35
|
+
:records => many_records,
|
36
36
|
:searchable => [:name, :description],
|
37
37
|
:datasource_name => "products",
|
38
38
|
:datasource_uri => "http://0.0.0.0:3000/products",
|
@@ -51,7 +51,7 @@ describe GSA do
|
|
51
51
|
it "successfully deletes the records from the gsa index" do
|
52
52
|
VCR.use_cassette("delete_many_records") do
|
53
53
|
results = GSA.feed(
|
54
|
-
:
|
54
|
+
:records => many_records,
|
55
55
|
:searchable => [:name, :description],
|
56
56
|
:datasource_name => "products",
|
57
57
|
:datasource_uri => "http://0.0.0.0:3000/products",
|
@@ -68,7 +68,6 @@ describe GSA do
|
|
68
68
|
it "successfully deletes the record from the gsa index" do
|
69
69
|
VCR.use_cassette("delete_single_record") do
|
70
70
|
results = GSA.feed(
|
71
|
-
:file_name => "out",
|
72
71
|
:records => one_records,
|
73
72
|
:searchable => [:name, :description],
|
74
73
|
:datasource_name => "products",
|
@@ -92,7 +91,6 @@ describe GSA do
|
|
92
91
|
expect {
|
93
92
|
|
94
93
|
GSA.feed(
|
95
|
-
:file_name => "out",
|
96
94
|
:records => one_records,
|
97
95
|
:searchable => [:name, :description],
|
98
96
|
:datasource_name => "products",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gsa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Long
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -168,7 +168,6 @@ files:
|
|
168
168
|
- lib/gsa/exceptions.rb
|
169
169
|
- lib/gsa/faceter.rb
|
170
170
|
- lib/gsa/feeder.rb
|
171
|
-
- lib/gsa/modules/filer.rb
|
172
171
|
- lib/gsa/modules/injector.rb
|
173
172
|
- lib/gsa/modules/xmlizer.rb
|
174
173
|
- lib/gsa/records_converter.rb
|
data/lib/gsa/modules/filer.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module GSA
|
2
|
-
module Filer
|
3
|
-
|
4
|
-
def build_xml_file(file_name, contents)
|
5
|
-
close_file(
|
6
|
-
add_content_to_file(new_file(file_name), contents)
|
7
|
-
).path
|
8
|
-
end
|
9
|
-
|
10
|
-
def new_file(file_name)
|
11
|
-
File.new("#{file_name}.xml", "w")
|
12
|
-
end
|
13
|
-
|
14
|
-
def open_file(file_name)
|
15
|
-
File.open(file_name)
|
16
|
-
end
|
17
|
-
|
18
|
-
def add_content_to_file(file, content)
|
19
|
-
file.puts(content); file
|
20
|
-
end
|
21
|
-
|
22
|
-
def close_file(file)
|
23
|
-
file.close; file
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|