KentaaNL/tikkie-api

View on GitHub

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']
Severity: Minor
Found in lib/tikkie/api/request.rb - About 1 hr to fix

    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]
    Severity: Minor
    Found in lib/tikkie/api/v1/requests/payment_requests.rb - About 1 hr to fix

    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)
    Severity: Minor
    Found in lib/tikkie/api/resources/payments.rb - About 55 mins to fix

    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']
    Severity: Minor
    Found in lib/tikkie/api/request.rb - About 55 mins to fix

    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)
     
     
    Severity: Minor
    Found in lib/tikkie/api/resources/payment_requests.rb - About 45 mins to fix

    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
    Severity: Minor
    Found in lib/tikkie/api/resources/payment_request.rb - About 25 mins to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    def payments
    @payments ||= begin
    payments = []
     
    if body[:payments]
    Severity: Minor
    Found in lib/tikkie/api/resources/payments.rb and 2 other locations - About 25 mins to fix
    lib/tikkie/api/resources/payment.rb on lines 46..58
    lib/tikkie/api/resources/payment_requests.rb on lines 24..36

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    def payment_requests
    @payment_requests ||= begin
    payment_requests = []
     
    if body[:paymentRequests]
    Severity: Minor
    Found in lib/tikkie/api/resources/payment_requests.rb and 2 other locations - About 25 mins to fix
    lib/tikkie/api/resources/payment.rb on lines 46..58
    lib/tikkie/api/resources/payments.rb on lines 32..44

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    def refunds
    @refunds ||= begin
    refunds = []
     
    if body[:refunds]
    Severity: Minor
    Found in lib/tikkie/api/resources/payment.rb and 2 other locations - About 25 mins to fix
    lib/tikkie/api/resources/payment_requests.rb on lines 24..36
    lib/tikkie/api/resources/payments.rb on lines 32..44

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

    def payment_requests
    @payment_requests ||= begin
    payment_requests = []
     
    if data[:paymentRequests]
    Severity: Minor
    Found in lib/tikkie/api/v1/responses/payment_requests.rb and 3 other locations - About 20 mins to fix
    lib/tikkie/api/v1/responses/base.rb on lines 38..50
    lib/tikkie/api/v1/responses/payment_request.rb on lines 51..63
    lib/tikkie/api/v1/responses/user.rb on lines 26..38

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

    def payments
    @payments ||= begin
    payments = []
     
    if data[:payments]
    Severity: Minor
    Found in lib/tikkie/api/v1/responses/payment_request.rb and 3 other locations - About 20 mins to fix
    lib/tikkie/api/v1/responses/base.rb on lines 38..50
    lib/tikkie/api/v1/responses/payment_requests.rb on lines 27..39
    lib/tikkie/api/v1/responses/user.rb on lines 26..38

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

    def bank_accounts
    @bank_accounts ||= begin
    bank_accounts = []
     
    if data[:bankAccounts]
    Severity: Minor
    Found in lib/tikkie/api/v1/responses/user.rb and 3 other locations - About 20 mins to fix
    lib/tikkie/api/v1/responses/base.rb on lines 38..50
    lib/tikkie/api/v1/responses/payment_request.rb on lines 51..63
    lib/tikkie/api/v1/responses/payment_requests.rb on lines 27..39

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

    def errors
    @errors ||= begin
    errors = []
     
    if data[:errors]
    Severity: Minor
    Found in lib/tikkie/api/v1/responses/base.rb and 3 other locations - About 20 mins to fix
    lib/tikkie/api/v1/responses/payment_request.rb on lines 51..63
    lib/tikkie/api/v1/responses/payment_requests.rb on lines 27..39
    lib/tikkie/api/v1/responses/user.rb on lines 26..38
    Severity
    Category
    Status
    Source
    Language