Class: SMS::Client
- Inherits:
-
Object
show all
- Defined in:
- lib/sms_client/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name) {|_self| ... } ⇒ Client
Returns a new instance of Client.
25
26
27
28
29
30
|
# File 'lib/sms_client/base.rb', line 25
def initialize(name)
klass = "#{name}_client".downcase.camelize
raise InvalidClientError unless SMS.const_defined?(klass)
@client = SMS.const_get(klass).new
yield self if block_given?
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *params, &block) ⇒ Object
39
40
41
|
# File 'lib/sms_client/base.rb', line 39
def method_missing(method, *params, &block)
@client.send(method, *params)
end
|
Class Method Details
.method_missing(method, *params) ⇒ Object
48
49
50
51
52
|
# File 'lib/sms_client/base.rb', line 48
def method_missing(method, *params)
Client.new(method)
rescue InvalidClientError
super
end
|
Instance Method Details
#log ⇒ Object
35
36
37
|
# File 'lib/sms_client/base.rb', line 35
def log
self.class.log
end
|
#log=(l) ⇒ Object
32
33
34
|
# File 'lib/sms_client/base.rb', line 32
def log=(l)
self.class.log = l
end
|
#to_s ⇒ Object
43
44
45
|
# File 'lib/sms_client/base.rb', line 43
def to_s
@client.to_s
end
|