Class: OpenLibraryEntry

Inherits:
Object
  • Object
show all
Includes:
HashMethodable
Defined in:
lib/fetchworks.rb

Overview

Methods common to OpenLibraryBook’s and OpenLibraryAuthor’s Exposes the JSON representation of an OL entry as a hash through @data, and as methods with method_missing,

Direct Known Subclasses

OpenLibraryAuthor, OpenLibraryBook

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashMethodable

#method_missing, #respond_to_missing?

Constructor Details

#initialize(data) ⇒ OpenLibraryEntry

Returns a new instance of OpenLibraryEntry.

Raises:

  • (StandardError)


147
148
149
150
151
# File 'lib/fetchworks.rb', line 147

def initialize(data)
  raise StandardError unless data.is_a? Hash

  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HashMethodable

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



145
146
147
# File 'lib/fetchworks.rb', line 145

def data
  @data
end