rails-gsa 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +54 -11
- data/lib/rails-gsa.rb +5 -0
- metadata +7 -7
data/README.rdoc
CHANGED
@@ -1,24 +1,67 @@
|
|
1
1
|
== RailsGSA
|
2
2
|
|
3
3
|
Rails gem for integrating GSA(Google Search Appliance) with your rails application.
|
4
|
+
Getting search results from your GSA can be done in 2 ways:
|
5
|
+
|
6
|
+
* Send request to the XML API of GSA(XML Response Object)
|
7
|
+
* Send request to the Cluster API of GSA(JSON Response Object)
|
8
|
+
|
9
|
+
== Installation
|
10
|
+
|
11
|
+
gem install rails-gsa
|
4
12
|
|
5
13
|
== Usage
|
6
14
|
|
7
|
-
|
8
|
-
|
9
|
-
|
15
|
+
=== Get JSON Response
|
16
|
+
|
17
|
+
RailsGSA.search(:gsa_url => "http://testgsa.com", :search_term => "hello", :output => "json")
|
18
|
+
# where,
|
19
|
+
# gsa_url is the domain of your GSA
|
20
|
+
# search_term is the query
|
21
|
+
# output is the expected response type
|
22
|
+
|
23
|
+
Here a request will be sent to your GSA and the recieved JSON response will be parsed and returned to you as a Hash
|
10
24
|
|
11
|
-
|
25
|
+
=== Get XML Response
|
12
26
|
|
13
27
|
RailsGSA.search(:gsa_url => "http://testgsa.com", :search_term => "hello", :output => "xml")
|
14
28
|
|
15
|
-
|
16
|
-
1) Sends a request to the GSA with the specified search term.
|
17
|
-
2) Parse the XML response given by the GSA.
|
18
|
-
3) Create and return a Hash object of the resultset generated after parsing the XML response.
|
29
|
+
Here a request will be sent to your GSA and the recieved XML response will be parsed and returned to you as a Hash
|
19
30
|
|
20
|
-
|
31
|
+
== Extra Options to modify the response
|
21
32
|
|
22
|
-
|
33
|
+
=== Access Level
|
34
|
+
|
35
|
+
Specifies whether to search public content, secure content, or both.
|
36
|
+
|
37
|
+
# Default Value: "p"
|
38
|
+
RailsGSA.search(:gsa_url => "http://testgsa.com", :search_term => "hello", :access => "s")
|
39
|
+
# Possible values for the access parameter are:
|
40
|
+
# p - search only public content
|
41
|
+
# s - search only secure content
|
42
|
+
# a - search all content, both public and secure
|
43
|
+
|
44
|
+
=== Change the Collection
|
45
|
+
|
46
|
+
Limits search results to the contents of the specified collection. You can search multiple collections by separating collection names with the OR character, which is notated as the pipe symbol, or the AND character, which is notated as a period. If a user submits a search query without the site parameter, the entire search index is queried.
|
47
|
+
|
48
|
+
# Default Value: "default_collection"
|
49
|
+
RailsGSA.search(:gsa_url => "http://testgsa.com", :search_term => "hello", :site => "myCollection")
|
50
|
+
|
51
|
+
# You can also specify whether you want to search results in multiple collections as given below:
|
52
|
+
|
53
|
+
# The following example uses the AND character:
|
54
|
+
RailsGSA.search(:gsa_url => "http://testgsa.com", :search_term => "hello", :site => "col1.col2")
|
55
|
+
|
56
|
+
# The following example uses the OR character:
|
57
|
+
RailsGSA.search(:gsa_url => "http://testgsa.com", :search_term => "hello", :site => "col1|col2")
|
58
|
+
|
59
|
+
=== Pagination
|
60
|
+
|
61
|
+
You can use the pagination parameters to get results as you desire
|
62
|
+
|
63
|
+
RailsGSA.search(:gsa_url => "http://testgsa.com", :search_term => "hello", :start => 10, :num => 20)
|
64
|
+
# Deafult value: start = 0; num = 10
|
23
65
|
|
24
|
-
|
66
|
+
The above example will give you results starting from 10 and the next 20 results.
|
67
|
+
The maximum number of results available for a query is 1,000, i.e., the value of the start parameter added to the value of the num parameter cannot exceed 1,000.
|
data/lib/rails-gsa.rb
CHANGED
@@ -23,6 +23,11 @@ module RailsGSA
|
|
23
23
|
default_options
|
24
24
|
@default_options.merge!(args)
|
25
25
|
raise ArgumentError, "GSA URL missing. Please provide valid arguments." if @default_options[:gsa_url].empty? || @default_options[:gsa_url].nil?
|
26
|
+
|
27
|
+
@default_options[:access] = "p" unless ["p", "s", "a"].include?(@default_options[:access])
|
28
|
+
@default_options[:start] = 0 unless @default_options[:start].is_a?(Fixnum)
|
29
|
+
@default_options[:num] = 10 unless @default_options[:num].is_a?(Fixnum)
|
30
|
+
|
26
31
|
return perform_search
|
27
32
|
end
|
28
33
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-gsa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-01-23 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: http-requestor
|
16
|
-
requirement: &
|
16
|
+
requirement: &29294292 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *29294292
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &29293980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.7.5
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *29293980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nokogiri
|
38
|
-
requirement: &
|
38
|
+
requirement: &29293656 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 1.5.5
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *29293656
|
47
47
|
description: Integrate GSA(Google Search Appliance) with your ruby/rails application.
|
48
48
|
email: rohit0981989@gmail.com
|
49
49
|
executables: []
|