Sha256: 646819d70941233612b9511256bd578e839cc9b49cd53aecef343506ecaacaa5
Contents?: true
Size: 620 Bytes
Versions: 1
Compression:
Stored size: 620 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
esendex-0.4.0 | lib/esendex/dispatcher_result.rb |