Class: Rafflesia::ArtifactPaper

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/artifacts/artifact_paper.rb

Constant Summary collapse

HASH_ATTRS =
{
  artifacts: :artifacts,
  doi: :doi,
  paper_id: :paper_id,
  source_url: :source_url,
  title: :title
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ ArtifactPaper

Returns a new instance of ArtifactPaper.



23
24
25
26
27
28
29
30
31
# File 'lib/rafflesia/artifacts/artifact_paper.rb', line 23

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @artifacts = (hash[:artifacts] || []).map { |item| item ? Rafflesia::PaperArtifact.new(item) : nil }
  @doi = hash[:doi]
  @paper_id = hash[:paper_id]
  @source_url = hash[:source_url]
  @title = hash[:title]
end

Instance Attribute Details

#artifactsObject

Returns the value of attribute artifacts.



16
17
18
# File 'lib/rafflesia/artifacts/artifact_paper.rb', line 16

def artifacts
  @artifacts
end

#doiObject

Returns the value of attribute doi.



16
17
18
# File 'lib/rafflesia/artifacts/artifact_paper.rb', line 16

def doi
  @doi
end

#paper_idObject

Returns the value of attribute paper_id.



16
17
18
# File 'lib/rafflesia/artifacts/artifact_paper.rb', line 16

def paper_id
  @paper_id
end

#source_urlObject

Returns the value of attribute source_url.



16
17
18
# File 'lib/rafflesia/artifacts/artifact_paper.rb', line 16

def source_url
  @source_url
end

#titleObject

Returns the value of attribute title.



16
17
18
# File 'lib/rafflesia/artifacts/artifact_paper.rb', line 16

def title
  @title
end