Exception: Mobitex::DeliveryError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/mobitex/delivery_errors.rb

Overview

Delivery errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, message = nil) ⇒ DeliveryError

Returns a new instance of DeliveryError.



7
8
9
10
# File 'lib/mobitex/delivery_errors.rb', line 7

def initialize(response, message = nil)
  @response = response
  @message  = message
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/mobitex/delivery_errors.rb', line 5

def response
  @response
end

Instance Method Details

#to_sObject



12
13
14
15
16
17
18
# File 'lib/mobitex/delivery_errors.rb', line 12

def to_s
  message = "Delivery Failed."
  message << "  Delivery Status = #{response['Status']}." if response.has_key?('Status')
  message << "  Delivery Id = #{response['Id']}." if response.has_key?('Id')
  message << "  Delivery Number = #{response['Number']}." if response.has_key?('Number')
  message
end