Class: Porteo::Twitter_protocol

Inherits:
Protocol
  • Object
show all
Defined in:
lib/protocols/twitter_protocol.rb

Overview

Implementation of Twitter protocol to be used in Porteo system. It only define specific behavior for this protocol.

Instance Attribute Summary

Attributes inherited from Protocol

#gw_config, #receiver

Instance Method Summary collapse

Methods inherited from Protocol

#initialize, #message, #send_message, #set_template, #set_template_params

Constructor Details

This class inherits a constructor from Porteo::Protocol

Instance Method Details

#check_message_sectionsnil

Check for the required fields to exists.

Returns:

  • (nil)

Raises:

  • (ArgumentError)

    if message cannot be sent.



33
34
35
36
37
# File 'lib/protocols/twitter_protocol.rb', line 33

def check_message_sections
  raise ArgumentError, "Protocol Error. There are no body section" if @message_sections[:body] == nil
  # the twitt must be shorter than 140 chars.
  raise ArgumentError, "Protocol Error. The message is too long" if @message_sections[:body].length > 140
end