Class: TitlePage::Contributor
- Defined in:
- lib/titlepage/utils.rb
Instance Attribute Summary collapse
-
#contributor_role ⇒ Object
Returns the value of attribute contributor_role.
-
#key_names ⇒ Object
Returns the value of attribute key_names.
-
#person_name ⇒ Object
Returns the value of attribute person_name.
-
#person_name_inverted ⇒ Object
Returns the value of attribute person_name_inverted.
-
#sequence_number ⇒ Object
Returns the value of attribute sequence_number.
-
#titles_before_names ⇒ Object
Returns the value of attribute titles_before_names.
Class Method Summary collapse
-
.from_xml(node) ⇒ Object
convert a nokogiri node to a TitlePage::Contributor object.
Instance Attribute Details
#contributor_role ⇒ Object
Returns the value of attribute contributor_role.
71 72 73 |
# File 'lib/titlepage/utils.rb', line 71 def contributor_role @contributor_role end |
#key_names ⇒ Object
Returns the value of attribute key_names.
75 76 77 |
# File 'lib/titlepage/utils.rb', line 75 def key_names @key_names end |
#person_name ⇒ Object
Returns the value of attribute person_name.
72 73 74 |
# File 'lib/titlepage/utils.rb', line 72 def person_name @person_name end |
#person_name_inverted ⇒ Object
Returns the value of attribute person_name_inverted.
73 74 75 |
# File 'lib/titlepage/utils.rb', line 73 def person_name_inverted @person_name_inverted end |
#sequence_number ⇒ Object
Returns the value of attribute sequence_number.
70 71 72 |
# File 'lib/titlepage/utils.rb', line 70 def sequence_number @sequence_number end |
#titles_before_names ⇒ Object
Returns the value of attribute titles_before_names.
74 75 76 |
# File 'lib/titlepage/utils.rb', line 74 def titles_before_names @titles_before_names end |
Class Method Details
.from_xml(node) ⇒ Object
convert a nokogiri node to a TitlePage::Contributor object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/titlepage/utils.rb', line 79 def self.from_xml(node) return nil if node.nil? #<Contributors xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:Contributor[1]"> # <item xsi:type="tns:Contributor"> # <SequenceNumber xsi:type="xsd:integer">1</SequenceNumber> # <ContributorRole xsi:type="xsd:string">A01</ContributorRole> # <PersonNameInverted xsi:type="xsd:string">Palahniuk, Chuck</PersonNameInverted> # </item> #</Contributors> contrib = self.new contrib.sequence_number = node.xpath("//item/SequenceNumber/text()").first.andand.to_s.andand.to_i contrib.contributor_role = node.xpath("//item/ContributorRole/text()").first.andand.to_s contrib.person_name = node.xpath("//item/PersonName/text()").first.andand.to_s contrib.person_name_inverted = node.xpath("//item/PersonNameInverted/text()").first.andand.to_s contrib.titles_before_names = node.xpath("//item/TitlesBeforeNames/text()").first.andand.to_s contrib.key_names = node.xpath("//item/KeyNames/text()").first.andand.to_s contrib end |