Method build_request
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def build_request(type, uri, options, api_ver)
case type.downcase.to_sym
when :get
request = Net::HTTP::Get.new(uri.request_uri)
when :post
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method upload_file
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload_file(file_path, path, options = {}, timeout = READ_TIMEOUT)
raise NotFound, "ERROR: File '#{file_path}' not found!" unless File.file?(file_path)
options = Hash[options.map { |k, v| [k.to_s, v] }]
body_params = options['body'] || {}
headers_params = options['header'] || {}
Method response_handler
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def response_handler(response, wait_on_task = true)
case response.code.to_i
when RESPONSE_CODE_OK # Synchronous read/query
begin
return JSON.parse(response.body)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method response_handler
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def response_handler(response, wait_on_task = true)
case response.code.to_i
when RESPONSE_CODE_OK # Synchronous read/query
begin
return JSON.parse(response.body)
Method build_request
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_request(type, uri, options, api_ver)
case type.downcase.to_sym
when :get
request = Net::HTTP::Get.new(uri.request_uri)
when :post
Method rest_api
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def rest_api(type, path, options = {}, api_ver = @api_version, redirect_limit = 3)
@logger.debug "Making :#{type} rest call to #{@url}#{path}"
raise InvalidRequest, 'Must specify path' unless path
uri = URI.parse(Addressable::URI.escape(@url + path))
http = build_http_object(uri)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method rest_api
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def rest_api(type, path, options = {}, api_ver = @api_version, redirect_limit = 3)
Method build_http_object
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_http_object(uri)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
if @ssl_enabled
http.cert_store = @cert_store if @cert_store
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method upload_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def upload_file(file_path, path, options = {}, timeout = READ_TIMEOUT)
raise NotFound, "ERROR: File '#{file_path}' not found!" unless File.file?(file_path)
options = Hash[options.map { |k, v| [k.to_s, v] }]
body_params = options['body'] || {}
headers_params = options['header'] || {}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"