Class: Guidestar::Client
- Inherits:
-
Object
- Object
- Guidestar::Client
- Extended by:
- Forwardable
- Includes:
- Search, Connection, Request
- Defined in:
- lib/guidestar/client.rb,
lib/guidestar/client/search.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Search
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#proxy ⇒ Object
readonly
Returns the value of attribute proxy.
Instance Method Summary collapse
-
#api_url ⇒ Object
Internal: Provides the URL for accessing the API.
-
#initialize(options = {}) ⇒ Client
constructor
Public: Sets up the core Client object that can be reused throughout the request.
-
#method_missing(method_name, *args) ⇒ Object
Internal: Allows method chaining of parameters to create template objects.
Methods included from Search
#charity_check, #detailed_search, #npo_validation, #search
Methods included from Connection
Methods included from Request
Constructor Details
#initialize(options = {}) ⇒ Client
Public: Sets up the core Client object that can be reused throughout the request.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/guidestar/client.rb', line 22 def initialize(={}) @api_url = .delete(:endpoint) || Guidestar.default_endpoint @proxy = .delete(:proxy) || Guidestar.proxy @username = .delete(:username) || Guidestar.username @password = .delete(:password) || Guidestar.password @ssl_options = .delete(:ssl_options) || Guidestar. @options = { :version => 1.0, :page_size => 25, :page => 1 }.merge end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
Internal: Allows method chaining of parameters to create template objects.
Returns a Guidestar::Chain object that mimics the Client.
44 45 46 47 48 49 50 51 52 |
# File 'lib/guidestar/client.rb', line 44 def method_missing(method_name, *args) chain = Chain.new({ :publisher => @publisher, :endpoint => @api_url, :proxy => @proxy }.merge(@options)) chain.send(method_name.to_sym, *args) chain end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
18 19 20 |
# File 'lib/guidestar/client.rb', line 18 def @options end |
#proxy ⇒ Object (readonly)
Returns the value of attribute proxy.
16 17 18 |
# File 'lib/guidestar/client.rb', line 16 def proxy @proxy end |
Instance Method Details
#api_url ⇒ Object
Internal: Provides the URL for accessing the API
Returns a String to the API root url.
36 37 38 |
# File 'lib/guidestar/client.rb', line 36 def api_url @api_url ||= 'https://gsservices.guidestar.org' end |