substancelab/rconomic

View on GitHub
lib/economic/proxies/actions/find_by_handle_with_number.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

# Use FindByHandleWithNumber when the SOAP action to find entity requires
# `Number` to be passed rather than the default `Id`
module FindByHandleWithNumber
  def find(handle)
    handle = if handle.respond_to?(:to_i)
      Economic::Entity::Handle.build(:number => handle)
    else
      Economic::Entity::Handle.build(handle)
    end
    super(handle)
  end
end