Method request
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
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.
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]
Method load_resource
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
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)
Method request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
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 load_resource
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
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)
Method create_resource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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