guidestar 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +31 -4
- data/lib/guidestar.rb +1 -1
- data/lib/guidestar/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -22,17 +22,43 @@ Then configure it with an initializer like `/config/initializers/guidestar.rb`:
|
|
22
22
|
|
23
23
|
Once you initialize it, you can use it in your code via:
|
24
24
|
|
25
|
+
results = Guidestar.search(:keyword => 'monkeys', :limit => 20)
|
26
|
+
|
27
|
+
Or you can create a Guidestar::Client object and go from there:
|
28
|
+
|
25
29
|
client = Guidestar::Client.new
|
26
30
|
results = client.search(:keyword => 'monkeys', :limit => 20)
|
31
|
+
# OR
|
32
|
+
results = client.keyword('monkeys').per(20).search
|
33
|
+
# or any combination of the above methods
|
34
|
+
|
35
|
+
There are four main API methods that you can use:
|
36
|
+
|
37
|
+
Guidestar.search # this is the only tested method on this repo
|
38
|
+
Guidestar.detailed_search
|
39
|
+
Guidestar.charity_check
|
40
|
+
Guidestar.npo_validation
|
41
|
+
|
42
|
+
See https://gsservices.guidestar.org/GuideStar_SearchService/WebServiceSearchQuery.xsd
|
43
|
+
for detailed search parameters.
|
44
|
+
|
45
|
+
The Guidestar::Result object behaves like an array, but includes some extra
|
46
|
+
fields for your usage:
|
27
47
|
|
28
48
|
results.xml
|
29
49
|
# => raw xml data
|
30
50
|
|
31
51
|
results.search_time
|
32
52
|
# => 0.12
|
53
|
+
|
33
54
|
results.total_count
|
34
55
|
# => 1292
|
35
56
|
|
57
|
+
results.total_pages
|
58
|
+
# => 52
|
59
|
+
|
60
|
+
You can iterate through the results like any Enumerable:
|
61
|
+
|
36
62
|
results.each do |org|
|
37
63
|
org.name
|
38
64
|
# => 'Monkey Paradise'
|
@@ -46,14 +72,15 @@ Once you initialize it, you can use it in your code via:
|
|
46
72
|
|
47
73
|
For getting the next page of results, it behaves similarly to kaminari or will_paginate:
|
48
74
|
|
49
|
-
results.
|
75
|
+
results.page(2).each { |more_orgs| puts more_orgs.name }
|
50
76
|
|
51
|
-
If you need
|
77
|
+
If you should ever need direct access to the array of results, just hit:
|
52
78
|
|
53
79
|
results.organizations
|
54
80
|
|
55
|
-
|
56
|
-
chain them
|
81
|
+
Ruby APIs should be super flexible in usage, so this gem lets you access the
|
82
|
+
data how you want. Pass in your options all at once or chain them. Create a new
|
83
|
+
search or use the result to paginate or adjust the search as needed.
|
57
84
|
|
58
85
|
## Contributing
|
59
86
|
|
data/lib/guidestar.rb
CHANGED
data/lib/guidestar/version.rb
CHANGED