Class: BrickFTP::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/brick_ftp/client.rb

Overview

To delegate commands.

Examples:

Call RESTfulAPI::ListUser#call

BrickFTP::Client.new.list_users

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subdomain: nil, api_key: nil) ⇒ Client

Returns a new instance of Client.

Parameters:

  • subdomain (String) (defaults to: nil)
  • api_key (String) (defaults to: nil)


17
18
19
20
21
# File 'lib/brick_ftp/client.rb', line 17

def initialize(subdomain: nil, api_key: nil)
  @subdomain = subdomain || ENV['BRICK_FTP_SUBDOMAIN']
  @api_key = api_key || ENV['BRICK_FTP_API_KEY']
  @api_client = BrickFTP::RESTfulAPI::Client.new(@subdomain, @api_key)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)



40
41
42
43
44
45
46
47
# File 'lib/brick_ftp/client.rb', line 40

def method_missing(name, *args)
  klass = command_class(name)
  if klass
    dispatch_command(klass, *args)
  else
    super
  end
end

Instance Attribute Details

#api_clientObject (readonly)

Returns the value of attribute api_client.



13
14
15
# File 'lib/brick_ftp/client.rb', line 13

def api_client
  @api_client
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



13
14
15
# File 'lib/brick_ftp/client.rb', line 13

def api_key
  @api_key
end

#subdomainObject (readonly)

Returns the value of attribute subdomain.



13
14
15
# File 'lib/brick_ftp/client.rb', line 13

def subdomain
  @subdomain
end