Class: Alma::Electronic::Business
- Inherits:
-
Object
- Object
- Alma::Electronic::Business
- Defined in:
- lib/alma/electronic/business.rb
Overview
Holds some custom business logic for our Alma Electronic API. This class is not intended for public use.
Instance Method Summary collapse
-
#service_id(collection_id) ⇒ Object
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.
Instance Method Details
#service_id(collection_id) ⇒ Object
Note:
However, this pattern does not hold for all cases.
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.
17 18 19 20 21 22 23 24 25 26 27 |
# 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 |