Class: AwsDevUtils::ClientWrapper
- Inherits:
-
Object
- Object
- AwsDevUtils::ClientWrapper
show all
- Includes:
- Utils
- Defined in:
- lib/aws-dev-utils/client_wrapper.rb
Instance Method Summary
collapse
Methods included from Utils
nested_hash, nested_struct
Constructor Details
#initialize(client, options = {}) ⇒ ClientWrapper
Returns a new instance of ClientWrapper.
5
6
7
8
|
# File 'lib/aws-dev-utils/client_wrapper.rb', line 5
def initialize client, options={}
@client = client
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/aws-dev-utils/client_wrapper.rb', line 22
def method_missing m, *args, &block
@client = RetryWrapper.new(@client, @options[:retry]) if retry?
@client = NextTokenWrapper.new(@client, @options[:next_token]) if next_token?
@client = CacheWrapper.new(@client, @options[:cache]) if cache?
nested_struct(@client.send(m, *args, &block))
end
|
Instance Method Details
#with_cache(exp = 60) ⇒ Object
18
19
20
|
# File 'lib/aws-dev-utils/client_wrapper.rb', line 18
def with_cache exp=60
self.class.new(@client, @options.merge(cache: exp))
end
|
#with_next_token(max = 100) ⇒ Object
10
11
12
|
# File 'lib/aws-dev-utils/client_wrapper.rb', line 10
def with_next_token max=100
self.class.new(@client, @options.merge(next_token: max))
end
|
#with_retry(max = 5) ⇒ Object
14
15
16
|
# File 'lib/aws-dev-utils/client_wrapper.rb', line 14
def with_retry max=5
self.class.new(@client, @options.merge(retry: max))
end
|