Class: Workarea::Listrak::BogusEmailApi::ProxyClient

Inherits:
Object
  • Object
show all
Defined in:
lib/workarea/listrak/bogus_email_api/proxy_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_name, client) ⇒ ProxyClient

Returns a new instance of ProxyClient.



7
8
9
10
# File 'lib/workarea/listrak/bogus_email_api/proxy_client.rb', line 7

def initialize(client_name, client)
  @client_name = client_name
  @client = client
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/workarea/listrak/bogus_email_api/proxy_client.rb', line 12

def method_missing(method, *args)
  if client.respond_to?(method)
    if BogusEmailApi.store_requests
      BogusEmailApi.requests[client_name][method] << args
    end
    client.send(method, *args)
  else
    super
  end
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/workarea/listrak/bogus_email_api/proxy_client.rb', line 5

def client
  @client
end

#client_nameObject (readonly)

Returns the value of attribute client_name.



5
6
7
# File 'lib/workarea/listrak/bogus_email_api/proxy_client.rb', line 5

def client_name
  @client_name
end

Instance Method Details

#respond_to_missing?(method, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/workarea/listrak/bogus_email_api/proxy_client.rb', line 23

def respond_to_missing?(method, include_all = false)
  client.respond_to?(method) || super
end