Class: Alma::AlmaRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/alma/alma_record.rb

Direct Known Subclasses

Loan, User

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ AlmaRecord

Returns a new instance of AlmaRecord.



4
5
6
7
# File 'lib/alma/alma_record.rb', line 4

def initialize(record)
  @raw_record = record
  post_initialize()
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



9
10
11
12
# File 'lib/alma/alma_record.rb', line 9

def method_missing(name)
  return response[name.to_s] if response.has_key?(name.to_s)
  super.method_missing name
end

Instance Method Details

#post_initializeObject



22
23
24
25
# File 'lib/alma/alma_record.rb', line 22

def post_initialize
  # Subclasses can define this method to perform extra initialization
  # after the super class init.
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/alma/alma_record.rb', line 14

def respond_to_missing?(name, include_private = false)
  response.has_key?(name.to_s) || super
end

#responseObject



18
19
20
# File 'lib/alma/alma_record.rb', line 18

def response
  @raw_record
end