Sha256: 906ddabe3ba9c174d75e98ac6629376388a63b23e9c988166e1467a64d9241f0
Contents?: true
Size: 645 Bytes
Versions: 2
Compression:
Stored size: 645 Bytes
Contents
require 'nokogiri' module Esendex class DispatcherResult attr_reader :batch_id, :messages def initialize(batch_id, messages) @batch_id = batch_id @messages = messages end def self.from_xml(source) doc = Nokogiri::XML source batch_id = doc.at_xpath('//api:messageheaders', 'api' => Esendex::API_NAMESPACE)['batchid'] messages = doc.xpath('//api:messageheader', 'api' => Esendex::API_NAMESPACE).map do |header| { id: header['id'], uri: header['uri'] } end DispatcherResult.new batch_id, messages end def to_s batch_id end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
esendex-0.6.0 | lib/esendex/dispatcher_result.rb |
esendex-0.5.0 | lib/esendex/dispatcher_result.rb |