Class: Aspire::Object::Resource
- Includes:
- ResourcePropertyMixin, ResourceShortcutsMixin
- Defined in:
- lib/aspire/object/resource.rb
Overview
Represents a resource in the Aspire API
Constant Summary collapse
- PAGE_RANGE =
/(?<start>[\da-zA-Z]*)\s*-\s*(?<end>[\da-zA-Z]*)/
Constants included from ResourcePropertyMixin
Aspire::Object::ResourcePropertyMixin::CITATION_PROPERTIES
Constants inherited from Base
Constants included from Util
Instance Attribute Summary collapse
-
#authors ⇒ Array<String>
The list of authors of the resource.
-
#book_jacket_url ⇒ String
The book jacket image URL.
-
#date ⇒ String
The date of publication.
-
#doi ⇒ String
The DOI for the resource.
-
#edition ⇒ String
The edition.
-
#edition_data ⇒ Boolean
True if edition data is available.
-
#eissn ⇒ String
The electronic ISSN for the resource.
-
#has_part ⇒ Array<Aspire::Object::Resource>
Child resources.
-
#is_part_of ⇒ Array<Aspire::Object::Resource>
Parent resources.
-
#isbn10 ⇒ String
The 10-digit ISBN for the resource.
-
#isbn13 ⇒ String
The 13-digit ISBN for the resource.
-
#isbns ⇒ Array<String>
The list of ISBNs for the resource.
-
#issn ⇒ Array<String>
The ISSN for the resource.
-
#issue ⇒ String
The issue.
-
#issued ⇒ String
The issue date.
-
#latest_edition ⇒ Boolean
True if this is the latest edition.
-
#local_control_number ⇒ String
The local control number in the library catalogue.
-
#online_resource ⇒ Boolean
True if this is an online resource.
-
#page ⇒ String
The page range.
-
#page_end ⇒ String
The end page.
-
#page_start ⇒ String
The start page.
-
#place_of_publication ⇒ String
The place of publication.
-
#publisher ⇒ String
The publisher.
-
#title ⇒ String
The title of the resource.
-
#type ⇒ String
The type of the resource.
-
#url ⇒ String
The URL of the resource.
-
#volume ⇒ String
The volume.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(uri = nil, factory = nil, json: nil, ld: nil) ⇒ void
constructor
Initialises a new Resource instance.
-
#page_range ⇒ String
Returns the page range spanned by the page_start and page_end properties.
-
#to_s ⇒ String
Returns a string representation of the resource (the title).
Methods included from ResourceShortcutsMixin
#article_title, #book_title, #chapter_title, #citation_title, #journal_title, #part_of_title, #part_of_title_by_type, #part_title, #part_title_by_type
Methods included from ResourcePropertyMixin
#get_property_name_from_method, #method_missing, #respond_to_missing?
Methods inherited from Base
#get_boolean, #get_date, #get_property
Methods included from Util
#child_url?, #duration, #id_from_uri, #item?, #linked_data, #linked_data_path, #list?, #list_url?, #module?, #parent_url?, #parse_url, #resource?, #section?, #url_for_comparison, #url_path, #user?
Constructor Details
#initialize(uri = nil, factory = nil, json: nil, ld: nil) ⇒ void
Initialises a new Resource instance
250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/aspire/object/resource.rb', line 250 def initialize(uri = nil, factory = nil, json: nil, ld: nil) uri ||= json ? json['uri'] : nil super(uri, factory) return unless json init_general(json) init_components(json) init_edition(json) init_identifiers(json) init_part(json) init_publication(json) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Aspire::Object::ResourcePropertyMixin
Instance Attribute Details
#authors ⇒ Array<String>
Returns the list of authors of the resource.
140 141 142 |
# File 'lib/aspire/object/resource.rb', line 140 def @authors end |
#book_jacket_url ⇒ String
Returns the book jacket image URL.
144 145 146 |
# File 'lib/aspire/object/resource.rb', line 144 def book_jacket_url @book_jacket_url end |
#date ⇒ String
Returns the date of publication.
148 149 150 |
# File 'lib/aspire/object/resource.rb', line 148 def date @date end |
#doi ⇒ String
Returns the DOI for the resource.
152 153 154 |
# File 'lib/aspire/object/resource.rb', line 152 def doi @doi end |
#edition ⇒ String
Returns the edition.
156 157 158 |
# File 'lib/aspire/object/resource.rb', line 156 def edition @edition end |
#edition_data ⇒ Boolean
Returns true if edition data is available.
160 161 162 |
# File 'lib/aspire/object/resource.rb', line 160 def edition_data @edition_data end |
#eissn ⇒ String
Returns the electronic ISSN for the resource.
164 165 166 |
# File 'lib/aspire/object/resource.rb', line 164 def eissn @eissn end |
#has_part ⇒ Array<Aspire::Object::Resource>
Returns child resources.
168 169 170 |
# File 'lib/aspire/object/resource.rb', line 168 def has_part @has_part end |
#is_part_of ⇒ Array<Aspire::Object::Resource>
Returns parent resources.
172 173 174 |
# File 'lib/aspire/object/resource.rb', line 172 def is_part_of @is_part_of end |
#isbn10 ⇒ String
Returns the 10-digit ISBN for the resource.
176 177 178 |
# File 'lib/aspire/object/resource.rb', line 176 def isbn10 @isbn10 end |
#isbn13 ⇒ String
Returns the 13-digit ISBN for the resource.
180 181 182 |
# File 'lib/aspire/object/resource.rb', line 180 def isbn13 @isbn13 end |
#isbns ⇒ Array<String>
Returns the list of ISBNs for the resource.
184 185 186 |
# File 'lib/aspire/object/resource.rb', line 184 def isbns @isbns end |
#issn ⇒ Array<String>
Returns the ISSN for the resource.
188 189 190 |
# File 'lib/aspire/object/resource.rb', line 188 def issn @issn end |
#issue ⇒ String
Returns the issue.
192 193 194 |
# File 'lib/aspire/object/resource.rb', line 192 def issue @issue end |
#issued ⇒ String
Returns the issue date.
196 197 198 |
# File 'lib/aspire/object/resource.rb', line 196 def issued @issued end |
#latest_edition ⇒ Boolean
Returns true if this is the latest edition.
200 201 202 |
# File 'lib/aspire/object/resource.rb', line 200 def latest_edition @latest_edition end |
#local_control_number ⇒ String
Returns the local control number in the library catalogue.
204 205 206 |
# File 'lib/aspire/object/resource.rb', line 204 def local_control_number @local_control_number end |
#online_resource ⇒ Boolean
Returns true if this is an online resource.
208 209 210 |
# File 'lib/aspire/object/resource.rb', line 208 def online_resource @online_resource end |
#page ⇒ String
Returns the page range.
212 213 214 |
# File 'lib/aspire/object/resource.rb', line 212 def page @page end |
#page_end ⇒ String
Returns the end page.
216 217 218 |
# File 'lib/aspire/object/resource.rb', line 216 def page_end @page_end end |
#page_start ⇒ String
Returns the start page.
220 221 222 |
# File 'lib/aspire/object/resource.rb', line 220 def page_start @page_start end |
#place_of_publication ⇒ String
Returns the place of publication.
224 225 226 |
# File 'lib/aspire/object/resource.rb', line 224 def place_of_publication @place_of_publication end |
#publisher ⇒ String
Returns the publisher.
228 229 230 |
# File 'lib/aspire/object/resource.rb', line 228 def publisher @publisher end |
#title ⇒ String
Returns the title of the resource.
232 233 234 |
# File 'lib/aspire/object/resource.rb', line 232 def title @title end |
#type ⇒ String
Returns the type of the resource.
236 237 238 |
# File 'lib/aspire/object/resource.rb', line 236 def type @type end |
#url ⇒ String
Returns the URL of the resource.
240 241 242 |
# File 'lib/aspire/object/resource.rb', line 240 def url @url end |
#volume ⇒ String
Returns the volume.
244 245 246 |
# File 'lib/aspire/object/resource.rb', line 244 def volume @volume end |
Instance Method Details
#page_range ⇒ String
Returns the page range spanned by the page_start and page_end properties
282 283 284 285 286 |
# File 'lib/aspire/object/resource.rb', line 282 def page_range return @page_start if @page_end.nil? || @page_start == @page_end return @page_end if @page_start.nil? "#{@page_start}-#{@page_end}" end |
#to_s ⇒ String
Returns a string representation of the resource (the title)
290 291 292 |
# File 'lib/aspire/object/resource.rb', line 290 def to_s title end |