Class: BrickFTP::Client
- Inherits:
-
Object
- Object
- BrickFTP::Client
- Defined in:
- lib/brick_ftp/client.rb
Overview
To delegate commands.
Instance Attribute Summary collapse
-
#api_client ⇒ Object
readonly
Returns the value of attribute api_client.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#initialize(base_url: nil, subdomain: nil, api_key: nil) ⇒ Client
constructor
A new instance of Client.
- #subdomain ⇒ Object
Constructor Details
#initialize(base_url: nil, subdomain: nil, api_key: nil) ⇒ Client
Returns a new instance of Client.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/brick_ftp/client.rb', line 18 def initialize(base_url: nil, subdomain: nil, api_key: nil) if subdomain warn('DEPRECATION WARNING: The argument `subdomain:` will be deprecated in a future version.' \ ' Please use `base_url:` instead.') end @subdomain = subdomain || ENV['BRICK_FTP_SUBDOMAIN'] @base_url = base_url || ENV['BRICK_FTP_BASE_URL'] @api_key = api_key || ENV['BRICK_FTP_API_KEY'] @api_client = BrickFTP::RESTfulAPI::Client.new(@base_url || @subdomain, @api_key) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
53 54 55 56 57 58 59 60 |
# File 'lib/brick_ftp/client.rb', line 53 def method_missing(name, *args) klass = command_class(name) if klass dispatch_command(klass, *args) else super end end |
Instance Attribute Details
#api_client ⇒ Object (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_key ⇒ Object (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 |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
13 14 15 |
# File 'lib/brick_ftp/client.rb', line 13 def base_url @base_url end |
Instance Method Details
#subdomain ⇒ Object
30 31 32 33 |
# File 'lib/brick_ftp/client.rb', line 30 def subdomain warn("DEPRECATION WARNING: #{self.class.name}##{__method__} will be deprecated in a future version.") @subdomain end |