Module: WebHDFS
- Defined in:
- lib/webhdfs/utilities.rb,
lib/webhdfs/ssl.rb,
lib/webhdfs/proxy.rb,
lib/webhdfs/client.rb,
lib/webhdfs/prueba.rb,
lib/webhdfs/request.rb,
lib/webhdfs/kerberos.rb,
lib/webhdfs/client_v1.rb,
lib/webhdfs/client_v2.rb,
lib/webhdfs/fileutils.rb,
lib/webhdfs/exceptions.rb
Overview
Principal module
Defined Under Namespace
Modules: FileUtils Classes: Client, ClientError, ClientV1, ClientV2, Error, FileNotFoundError, IOError, Kerberos, KerberosError, Proxy, Prueba, Request, RequestFailedError, SSL, SecurityError, ServerError
Class Method Summary collapse
-
.api_path(path) ⇒ Object
Path to access API.
-
.check_options(options, optdecl = []) ⇒ Object
Check if options are valid.
-
.check_success_json(res, attr = nil) ⇒ Object
Check if json request is success.
Class Method Details
.api_path(path) ⇒ Object
Path to access API
6 7 8 9 10 11 12 |
# File 'lib/webhdfs/utilities.rb', line 6 def self.api_path(path) if path.start_with?('/') '/webhdfs/v1' + path else '/webhdfs/v1/' + path end end |
.check_options(options, optdecl = []) ⇒ Object
Check if options are valid
21 22 23 24 |
# File 'lib/webhdfs/utilities.rb', line 21 def self.(, optdecl = []) ex = .keys.map(&:to_s) - (optdecl || []) raise ArgumentError, "no such option: #{ex.join(' ')}" unless ex.empty? end |
.check_success_json(res, attr = nil) ⇒ Object
Check if json request is success
15 16 17 18 |
# File 'lib/webhdfs/utilities.rb', line 15 def self.check_success_json(res, attr = nil) res.code == '200' && res.content_type == 'application/json' && (attr.nil? || JSON.parse(res.body)[attr]) end |