guidestar 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.per(50).page(2).each { |more_orgs| puts more_orgs.name }
75
+ results.page(2).each { |more_orgs| puts more_orgs.name }
50
76
 
51
- If you need more direct access to the array of results, just hit:
77
+ If you should ever need direct access to the array of results, just hit:
52
78
 
53
79
  results.organizations
54
80
 
55
- The way you use it is all super-flexible. You can pass in your options beforehand or
56
- chain them along the way.
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
@@ -18,7 +18,7 @@ module Guidestar
18
18
  end
19
19
 
20
20
  def method_missing(method_name, *args)
21
- Guidestar::Client.new.send(method_name.to_sym, *args)
21
+ Guidestar::Chain.new.send(method_name.to_sym, *args)
22
22
  end
23
23
  end
24
24
 
@@ -1,3 +1,3 @@
1
1
  module Guidestar
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guidestar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: