Class: CleverReach::Base
- Inherits:
-
Object
- Object
- CleverReach::Base
- Defined in:
- lib/clever_reach/base.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #client ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/clever_reach/base.rb', line 7 def initialize @api_key = CleverReach.config.api_key end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/clever_reach/base.rb', line 15 def method_missing(name, *args) = args.last.is_a?(Hash) ? args.pop : {} response = request(name, ) ResponseDecorator.new(response).tap do |r| raise Errors.lookup(r.status_code) unless r.valid? end end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/clever_reach/base.rb', line 5 def api_key @api_key end |
Instance Method Details
#client ⇒ Object
11 12 13 |
# File 'lib/clever_reach/base.rb', line 11 def client @client ||= Savon.client(CleverReach.config.wsdl_url) end |