class Alma::Electronic::Business
Holds some custom business logic for our Alma
Electronic
API. This class is not intended for public use.
Public Instance Methods
service_id(collection_id)
click to toggle source
The Service ID is usually the Collection ID grouped by 2 digits with the first number incremented by 1 and the fifth number decremented by 1.
@note However, this pattern does not hold for all cases.
@param collection_id [String] The electronic collection id.
# File lib/alma/electronic/business.rb, line 17 def service_id(collection_id) collection_id.scan(/.{1,2}/).each_with_index.map { |char, index| if index == 0 "%02d" % (char.to_i + 1) elsif index == 4 "%02d" % (char.to_i - 1) else char end }.join end