Class: Emailvision::Notification
- Inherits:
-
Object
- Object
- Emailvision::Notification
- Includes:
- HTTParty
- Defined in:
- lib/emailvision/notification.rb
Class Attribute Summary collapse
-
.debug ⇒ Object
Returns the value of attribute debug.
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
-
#base_uri ⇒ Object
Base uri.
-
#initialize(params = {}) {|_self| ... } ⇒ Notification
constructor
A new instance of Notification.
- #send(body, params = {}) ⇒ Object
Constructor Details
#initialize(params = {}) {|_self| ... } ⇒ Notification
Returns a new instance of Notification.
13 14 15 16 17 |
# File 'lib/emailvision/notification.rb', line 13 def initialize(params = {}) yield(self) if block_given? self.debug ||= params[:debug] || self.class.debug end |
Class Attribute Details
.debug ⇒ Object
Returns the value of attribute debug.
9 10 11 |
# File 'lib/emailvision/notification.rb', line 9 def debug @debug end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
11 12 13 |
# File 'lib/emailvision/notification.rb', line 11 def debug @debug end |
Instance Method Details
#base_uri ⇒ Object
Base uri
33 34 35 |
# File 'lib/emailvision/notification.rb', line 33 def base_uri 'http://api.notificationmessaging.com/NMSXML' end |
#send(body, params = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/emailvision/notification.rb', line 19 def send(body, params = {}) # == Processing body == body_xml = Emailvision::Tools.to_xml_as_is body # == Send request == logger.send "#{base_uri} with body : #{body_xml}" response = self.class.send :post, base_uri, :body => body_xml logger.receive "#{base_uri} with status : #{response.header.inspect}" # == Check result == response.header.code == '200' end |