Class: PLOS::ArticleRef

Inherits:
Object
  • Object
show all
Includes:
XmlHelpers
Defined in:
lib/plos/article_ref.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XmlHelpers

#nodes_to_hash, #parse_node, #tag_value

Constructor Details

#initialize(client, node) ⇒ ArticleRef

Returns a new instance of ArticleRef.



22
23
24
25
26
27
28
29
# File 'lib/plos/article_ref.rb', line 22

def initialize(client, node)
  self.node = node

  self.client = client
  node.xpath('./*').each do |child|
    parse_node(child, self)
  end
end

Instance Attribute Details

#abstractObject

Returns the value of attribute abstract.



15
16
17
# File 'lib/plos/article_ref.rb', line 15

def abstract
  @abstract
end

#authorsObject

Returns the value of attribute authors.



9
10
11
# File 'lib/plos/article_ref.rb', line 9

def authors
  @authors
end

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/plos/article_ref.rb', line 6

def client
  @client
end

#eissnObject

Returns the value of attribute eissn.



10
11
12
# File 'lib/plos/article_ref.rb', line 10

def eissn
  @eissn
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/plos/article_ref.rb', line 11

def id
  @id
end

#journalObject

Returns the value of attribute journal.



12
13
14
# File 'lib/plos/article_ref.rb', line 12

def journal
  @journal
end

#nodeObject

Returns the value of attribute node.



5
6
7
# File 'lib/plos/article_ref.rb', line 5

def node
  @node
end

#published_atObject

Returns the value of attribute published_at.



13
14
15
# File 'lib/plos/article_ref.rb', line 13

def published_at
  @published_at
end

#scoreObject

Returns the value of attribute score.



7
8
9
# File 'lib/plos/article_ref.rb', line 7

def score
  @score
end

#titleObject

Returns the value of attribute title.



14
15
16
# File 'lib/plos/article_ref.rb', line 14

def title
  @title
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/plos/article_ref.rb', line 8

def type
  @type
end

Instance Method Details

#articleObject



39
40
41
# File 'lib/plos/article_ref.rb', line 39

def article
  @article ||= PLOS::Article.get(article_id)
end

#article_idObject



31
32
33
# File 'lib/plos/article_ref.rb', line 31

def article_id
  id.split("/")[0..1].join("/") if id
end

#article_partObject



35
36
37
# File 'lib/plos/article_ref.rb', line 35

def article_part
  id.split("/")[2] if id
end

#citation(format = "RIS") ⇒ Object



43
44
45
# File 'lib/plos/article_ref.rb', line 43

def citation(format="RIS")
  PLOS::Article.citation(id, format)
end