Class: Esendex::DispatcherResult
- Inherits:
-
Object
- Object
- Esendex::DispatcherResult
- Defined in:
- lib/esendex/dispatcher_result.rb
Instance Attribute Summary collapse
-
#batch_id ⇒ Object
readonly
Returns the value of attribute batch_id.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(batch_id, messages) ⇒ DispatcherResult
constructor
A new instance of DispatcherResult.
- #to_s ⇒ Object
Constructor Details
#initialize(batch_id, messages) ⇒ DispatcherResult
Returns a new instance of DispatcherResult.
7 8 9 10 |
# File 'lib/esendex/dispatcher_result.rb', line 7 def initialize(batch_id, ) @batch_id = batch_id @messages = end |
Instance Attribute Details
#batch_id ⇒ Object (readonly)
Returns the value of attribute batch_id.
5 6 7 |
# File 'lib/esendex/dispatcher_result.rb', line 5 def batch_id @batch_id end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
5 6 7 |
# File 'lib/esendex/dispatcher_result.rb', line 5 def @messages end |
Class Method Details
.from_xml(source) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/esendex/dispatcher_result.rb', line 12 def self.from_xml(source) doc = Nokogiri::XML source batch_id = doc.at_xpath('//api:messageheaders', 'api' => Esendex::API_NAMESPACE)['batchid'] = doc.xpath('//api:messageheader', 'api' => Esendex::API_NAMESPACE).map do |header| { id: header['id'], uri: header['uri'] } end DispatcherResult.new batch_id, end |
Instance Method Details
#to_s ⇒ Object
21 22 23 |
# File 'lib/esendex/dispatcher_result.rb', line 21 def to_s batch_id end |