Showing 13 of 13 total issues
Method request
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(http_method, path, params = {}, body = {}) uri = URI.join(config.api_url, path) uri.query = URI.encode_www_form(params) unless params.empty? logger.debug("[Tikkie] Request: #{http_method.upcase} #{uri}") if ENV['TIKKIE_DEBUG']
Method list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def list(platform_token, user_token, options = {}) offset = options[:offset] || 0 limit = options[:limit] || 20 from_date = options[:from_date] to_date = options[:to_date]
- Read upRead up
Method load_resource
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def load_resource params = { pageNumber: page_number, pageSize: page_size } params[:fromDate] = options[:from_date].respond_to?(:utc) ? options[:from_date].utc.iso8601 : options[:from_date] if options.key?(:from_date) params[:toDate] = options[:to_date].respond_to?(:utc) ? options[:to_date].utc.iso8601 : options[:to_date] if options.key?(:to_date) params[:includeRefunds] = options[:include_refunds] if options.key?(:include_refunds)
- Read upRead up
Method request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def request(http_method, path, params = {}, body = {}) uri = URI.join(config.api_url, path) uri.query = URI.encode_www_form(params) unless params.empty? logger.debug("[Tikkie] Request: #{http_method.upcase} #{uri}") if ENV['TIKKIE_DEBUG']
- Read upRead up
Method load_resource
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_resource params = { pageNumber: page_number, pageSize: page_size } params[:fromDate] = options[:from_date].respond_to?(:utc) ? options[:from_date].utc.iso8601 : options[:from_date] if options.key?(:from_date) params[:toDate] = options[:to_date].respond_to?(:utc) ? options[:to_date].utc.iso8601 : options[:to_date] if options.key?(:to_date)
- Read upRead up
Method create_resource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_resource(attributes) params = { description: attributes.fetch(:description) } if attributes.key?(:amount) amount = Tikkie::Api::Amount.new(attributes[:amount]) params[:amountInCents] = amount.to_cents
- Read upRead up
Similar blocks of code found in 3 locations. Consider refactoring. Open
def payments @payments ||= begin payments = [] if body[:payments]
- Read upRead up
Similar blocks of code found in 3 locations. Consider refactoring. Open
def payment_requests @payment_requests ||= begin payment_requests = [] if body[:paymentRequests]
- Read upRead up
Similar blocks of code found in 3 locations. Consider refactoring. Open
def refunds @refunds ||= begin refunds = [] if body[:refunds]
- Read upRead up
Similar blocks of code found in 4 locations. Consider refactoring. Open
def payment_requests @payment_requests ||= begin payment_requests = [] if data[:paymentRequests]
- Read upRead up
Similar blocks of code found in 4 locations. Consider refactoring. Open
def payments @payments ||= begin payments = [] if data[:payments]
- Read upRead up
Similar blocks of code found in 4 locations. Consider refactoring. Open
def bank_accounts @bank_accounts ||= begin bank_accounts = [] if data[:bankAccounts]
- Read upRead up
Similar blocks of code found in 4 locations. Consider refactoring. Open
def errors @errors ||= begin errors = [] if data[:errors]
- Read upRead up