Class: OpenLibraryAuthor

Inherits:
OpenLibraryEntry show all
Defined in:
lib/fetchworks.rb

Overview

A class that represents authors in the OpenLibrary database

Instance Attribute Summary

Attributes inherited from OpenLibraryEntry

#data

Instance Method Summary collapse

Methods included from HashMethodable

#method_missing, #respond_to_missing?

Constructor Details

#initialize(url) ⇒ OpenLibraryAuthor

Can only access authors at present via the URL provided for them in book data



158
159
160
# File 'lib/fetchworks.rb', line 158

def initialize(url)
  super OpenLibrary.get_author(url)
end

Dynamic Method Handling

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

Instance Method Details

#birth_dateObject



162
163
164
165
# File 'lib/fetchworks.rb', line 162

def birth_date
  str = @data["birth_date"]
  OpenLibrary.partial_date_from_str(str)
end

#death_dateObject



167
168
169
170
# File 'lib/fetchworks.rb', line 167

def death_date
  str = @data["death_date"]
  OpenLibrary.partial_date_from_str(str)
end