Class: SocialMedia::Service::Base
- Inherits:
-
Object
- Object
- SocialMedia::Service::Base
show all
- Defined in:
- lib/social_media/service/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(connection_params) ⇒ Base
Returns a new instance of Base.
10
11
12
|
# File 'lib/social_media/service/base.rb', line 10
def initialize connection_params
@connection_params = connection_params
end
|
Instance Attribute Details
#connection_params ⇒ Object
Returns the value of attribute connection_params.
8
9
10
|
# File 'lib/social_media/service/base.rb', line 8
def connection_params
@connection_params
end
|
Class Method Details
.name ⇒ Object
4
5
6
|
# File 'lib/social_media/service/base.rb', line 4
def self.name
raise NotImplementedError.new "#{self.to_s}::name not implemented"
end
|
Instance Method Details
#cast_error(error) ⇒ Object
14
15
16
|
# File 'lib/social_media/service/base.rb', line 14
def cast_error error
return Error
end
|
#handle_error(&block) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/social_media/service/base.rb', line 18
def handle_error &block
begin
yield
rescue Exception => error
wrapped_error = SocialMedia::convert_exception_class(error, cast_error(error) || Error)
raise wrapped_error
end
end
|