Class: Zotero::Entities::Creator

Inherits:
Object
  • Object
show all
Defined in:
lib/zotero/entities/creator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Creator

Returns a new instance of Creator.



4
5
6
7
8
# File 'lib/zotero/entities/creator.rb', line 4

def initialize(data)
  @last_name = data['lastName']
  @first_name = data['firstName']
  @kind = data['creatorType']
end

Instance Attribute Details

#first_nameObject (readonly)

Returns the value of attribute first_name.



2
3
4
# File 'lib/zotero/entities/creator.rb', line 2

def first_name
  @first_name
end

#kindObject (readonly)

Returns the value of attribute kind.



2
3
4
# File 'lib/zotero/entities/creator.rb', line 2

def kind
  @kind
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



2
3
4
# File 'lib/zotero/entities/creator.rb', line 2

def last_name
  @last_name
end

Instance Method Details

#author?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/zotero/entities/creator.rb', line 10

def author? 
  'author' == kind
end

#editor?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/zotero/entities/creator.rb', line 14

def editor? 
  'editor' == kind
end

#to_hObject



22
23
24
25
26
27
28
# File 'lib/zotero/entities/creator.rb', line 22

def to_h
  {
    first_name: first_name,
    last_name: last_name,
    kind: kind
  }.symbolize_keys
end

#translator?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/zotero/entities/creator.rb', line 18

def translator?
  'translator' == kind
end