Sha256: 18e298391e4c7cbbebac67edaae4775d417a3634496e23c1f61e235ef6cfbf0b
Contents?: true
Size: 618 Bytes
Versions: 7
Compression:
Stored size: 618 Bytes
Contents
module CiviCrm class FinancialType < BaseResource entity :financial_type @@_financial_type_cache = {} def self.[](name, cache: true, create: Rails.env.development?) cache_key = name if cache && @@_financial_type_cache.key?(cache_key) return @@_financial_type_cache[cache_key] end type = find_by("name" => name) type ||= create(name: name) if create if type @@_financial_type_cache[cache_key] = type.id if cache return type.id end raise Errors::NotFound.new( "FinancialType with name=#{name}" ) end end end
Version data entries
7 entries across 7 versions & 1 rubygems