lib/rapa/resources/item_resource.rb in rapa-0.5.6 vs lib/rapa/resources/item_resource.rb in rapa-0.5.7

- old
+ new

@@ -58,17 +58,35 @@ end.map do |browse_node_source| ::Rapa::BrowseNode.new(browse_node_source) end end + # @return [Array<Rapa::Creator>] + def creators + case creator_source_or_sources = source.dig("ItemAttributes", "Creator") + when ::Array + creator_source_or_sources + when ::Hash + [creator_source_or_sources] + else + [] + end.map do |creator_source| + ::Rapa::Creator.new(creator_source) + end + end + # @return [String, nil] def creator_name - source.dig("ItemAttributes", "Creator", "__content__") + if creators.first + creators.first.name + end end # @return [String, nil] def creator_role - source.dig("ItemAttributes", "Creator", "Role") + if creators.first + creators.first.role + end end # @return [String, nil] def ean source.dig("ItemAttributes", "EAN")