Class: Alexandrite::OCLC

Inherits:
Object
  • Object
show all
Extended by:
OCLCAPI
Defined in:
lib/alexandrite.rb

Overview

Get and Process data from OCLC API

Constant Summary

Constants included from OCLCAPI

Alexandrite::OCLCAPI::BASE_URL

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OCLCAPI

get_book_data, recommend_classification, search_by

Methods included from Helpers::Validation

#define_isbn_type, #valid_isbn_length?, #validate_isbn

Methods included from Helpers::Format

#add_fields, #remove_non_digits

Constructor Details

#initialize(key, query, api: :oclc) ⇒ OCLC

return [Alexandrite::OCLC]



36
37
38
# File 'lib/alexandrite.rb', line 36

def initialize(key, query, api: :oclc)
  @result = search_by(key, query, api: api)
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



33
34
35
# File 'lib/alexandrite.rb', line 33

def result
  @result
end

Class Method Details

.create_book(type, identifier) ⇒ Alexandrite::Book

Returns:



41
42
43
44
45
46
# File 'lib/alexandrite.rb', line 41

def self.create_book(type, identifier)
  query = Alexandrite::OCLC.new(type, identifier)
  response_code = get_response_code(query.result)

  response(response_code, query)
end