Sha256: 15e7a872654b18d9e0b655b63e2a96b767649c028e3930d8f39bd39d33c0fc12

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

require 'salesforce_id/version'
require 'salesforce_id/salesforce_id'
require 'salesforce_id/safe'
require 'salesforce_id/random'

module SalesforceId
  extend self

  # [FixNum] SENSITIVE_SIZE
  # [FixNum] INSENSITIVE_SIZE
  # [Array<String>] VALID_CHARACTERS array of valid characters
  #   for salesforce id

  # to_sensitive
  # @param id [String]
  # @return [String]

  # to_insensitive
  # @param id [String]
  # @return [String]

  # valid?
  # @param id [String]
  # @return [Boolean]

  # repair_casing
  # @param id [String]
  # @return [String]

  # sensitive?
  # @param id [String]
  # @return [Boolean]

  # insensitive?
  # @param id [String]
  # @return [Boolean]

  # Creates a salesforce id based on string
  # @param salesforce_id [#to_s] An object that converts to a valid salesforce
  #   id in string format
  # @return [SalesforceId::Safe] the original object if it's already a
  #   {SalesforceId::Safe}, otherwise a generated salesforce id
  # @raise [ArgumentError] if passed id is not valid
  def id(salesforce_id)
    return salesforce_id if salesforce_id.kind_of?(::SalesforceId::Safe)

    ::SalesforceId::Safe.new(salesforce_id)
  end

  # Provides a randomly generated salesforce id.
  # Alias of {Salesforce::Random#safe}
  # @param prefix [String] prefix to be prepended to the id, see
  #   {Salesforce::Random#safe} for additional details
  # @return [SalesforceId::Safe]
  def random(prefix = '')
    ::SalesforceId::Random.safe(prefix)
  end

end

# Shortcut for {SalesforceId#id}
def SalesforceId(salesforce_id)
  SalesforceId.id(salesforce_id)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
salesforce_id-1.4.0 lib/salesforce_id.rb
salesforce_id-1.3.4 lib/salesforce_id.rb
salesforce_id-1.3.3 lib/salesforce_id.rb