Class: Montague::API::Journal

Inherits:
Base
  • Object
show all
Defined in:
lib/montague/api/journal.rb

Overview

Journal API

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Journal

Returns a new instance of Journal.

Parameters:

  • config (Hash) (defaults to: {})

Options Hash (config):

  • :api_url (String)

    URL of the SHERPA/RoMEO service (if it changes)

  • :api_key (String)

    API key of the SHERPA/RoMEO service user


10
11
12
# File 'lib/montague/api/journal.rb', line 10

def initialize(config = {})
  super
end

Instance Method Details

#find_by_issn(issn) ⇒ Montague::Model::JournalReport

Parameters:

  • issn (String)

    International Standard Serial Number e.g. 1234-5678.

Returns:


16
17
18
19
20
# File 'lib/montague/api/journal.rb', line 16

def find_by_issn(issn)
  url = "#{@config[:api_url]}?issn=#{issn}#{common_parameters}"
  response = HTTP.get URI.encode(url)
  journal_report response
end

#find_by_title(text:, filter: :exact) ⇒ Montague::Model::JournalsReport

Parameters:

  • text (String)

    Multiple words treated as a single string. Case insensitive.

  • filter (Symbol) (defaults to: :exact)
    • :exact - Verbatim e.g. 'Journal of Geology'

    • :starts - Starts with e.g. 'machine'

    • :contains - Contains e.g. 'modern language'

Returns:


28
29
30
31
32
# File 'lib/montague/api/journal.rb', line 28

def find_by_title(text:, filter: :exact)
  url = "#{@config[:api_url]}?jtitle=#{text}&qtype=#{filter}#{common_parameters}"
  response = HTTP.get URI.encode(url)
  journals_report response
end