class Arbetsformedlingen::Packet
Constants
- DEFAULT_PACKET_ID
Public Class Methods
new(attributes:, publication:, document:, position:)
click to toggle source
Calls superclass method
Arbetsformedlingen::Model::new
# File lib/arbetsformedlingen/models/packet.rb, line 25 def initialize(attributes:, publication:, document:, position:) hash = attributes @publication = publication @document = document @position = position id = hash.fetch(:id, DEFAULT_PACKET_ID) super(PacketSchema.call(hash.merge(id: id))) end
Public Instance Methods
to_h()
click to toggle source
Calls superclass method
Arbetsformedlingen::Model#to_h
# File lib/arbetsformedlingen/models/packet.rb, line 34 def to_h hash = super hash[:publication] = @publication.to_h hash[:document] = @document.to_h hash[:position] = @position.to_h hash end
to_xml()
click to toggle source
# File lib/arbetsformedlingen/models/packet.rb, line 42 def to_xml PacketXMLBuilder.new(self).to_xml end