Class: Guidestar::Result
- Inherits:
-
Object
- Object
- Guidestar::Result
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/guidestar/result.rb
Defined Under Namespace
Classes: EIN
Instance Method Summary collapse
-
#all ⇒ Object
(also: #organizations)
Public: Contains the data we retrieve, or gets new data if there are new parameters on the request.
-
#data ⇒ Object
Internal: Contains a few extra details that might be desired, like the total_count and search_time, which are also available via delegation.
-
#each(&block) ⇒ Object
Public: Iterates through the inner array to make data more accessible.
-
#initialize(path, client) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(path, client) ⇒ Result
Returns a new instance of Result.
10 11 12 13 14 15 |
# File 'lib/guidestar/result.rb', line 10 def initialize(path, client) @path = path @client = client @options = {} @data = Hashie::Mash.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object (private)
127 128 129 130 131 |
# File 'lib/guidestar/result.rb', line 127 def method_missing(method_name, *args) @options[method_name.to_sym]=args.first @organizations = nil self end |
Instance Method Details
#all ⇒ Object Also known as: organizations
Public: Contains the data we retrieve, or gets new data if there are new parameters on the request.
Returns an Array of organizations from the search
21 22 23 24 25 |
# File 'lib/guidestar/result.rb', line 21 def all return @organizations if @organizations load_response @organizations end |
#data ⇒ Object
Internal: Contains a few extra details that might be desired, like the total_count and search_time, which are also available via delegation
Returns a Hash of extra data
33 34 35 36 37 |
# File 'lib/guidestar/result.rb', line 33 def data return @data if @organizations load_response @data end |
#each(&block) ⇒ Object
Public: Iterates through the inner array to make data more accessible
40 41 42 |
# File 'lib/guidestar/result.rb', line 40 def each(&block) organizations.each(&block) end |