Class: Zotero::Entities::Creator
- Inherits:
-
Object
- Object
- Zotero::Entities::Creator
- Defined in:
- lib/zotero/entities/creator.rb
Instance Attribute Summary collapse
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
Instance Method Summary collapse
- #author? ⇒ Boolean
- #editor? ⇒ Boolean
-
#initialize(data) ⇒ Creator
constructor
A new instance of Creator.
- #to_h ⇒ Object
- #translator? ⇒ Boolean
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_name ⇒ Object (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 |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
2 3 4 |
# File 'lib/zotero/entities/creator.rb', line 2 def kind @kind end |
#last_name ⇒ Object (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
10 11 12 |
# File 'lib/zotero/entities/creator.rb', line 10 def 'author' == kind end |
#editor? ⇒ Boolean
14 15 16 |
# File 'lib/zotero/entities/creator.rb', line 14 def editor? 'editor' == kind end |
#to_h ⇒ Object
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
18 19 20 |
# File 'lib/zotero/entities/creator.rb', line 18 def translator? 'translator' == kind end |