Class: Itexmo::Sms
- Inherits:
-
Object
- Object
- Itexmo::Sms
- Defined in:
- lib/itexmo/sms.rb
Overview
sms
Constant Summary collapse
- API_ENDPOINT =
'https://www.itexmo.com/php_api'.freeze
- PARAMETERS =
{}
Instance Attribute Summary collapse
-
#api_code ⇒ Object
Returns the value of attribute api_code.
Class Method Summary collapse
- .delete_all_outgoing ⇒ Object
- .delete_message_via_id(originator) ⇒ Object
- .delete_message_via_originator(originator) ⇒ Object
- .delete_messages_all ⇒ Object
- .display_messages ⇒ Object
- .display_messages_via_originator(originator) ⇒ Object
- .display_outgoing(sortby = 'asc') ⇒ Object
Instance Method Summary collapse
- #delete_all_outgoing ⇒ Object
- #delete_message_via_id(id) ⇒ Object
- #delete_message_via_originator(originator) ⇒ Object
- #delete_messages_all ⇒ Object
- #display_messages ⇒ Object
- #display_messages_via_originator(originator) ⇒ Object
- #display_outgoing(sortby = 'asc') ⇒ Object
-
#initialize ⇒ Sms
constructor
A new instance of Sms.
Constructor Details
#initialize ⇒ Sms
Returns a new instance of Sms.
12 13 14 15 |
# File 'lib/itexmo/sms.rb', line 12 def initialize @api_code = Itexmo.configuration.api_code PARAMETERS['apicode'] = api_code end |
Instance Attribute Details
#api_code ⇒ Object
Returns the value of attribute api_code.
7 8 9 |
# File 'lib/itexmo/sms.rb', line 7 def api_code @api_code end |
Class Method Details
.delete_all_outgoing ⇒ Object
38 39 40 41 |
# File 'lib/itexmo/sms.rb', line 38 def self.delete_all_outgoing instance = new instance.delete_all_outgoing end |
.delete_message_via_id(originator) ⇒ Object
92 93 94 95 |
# File 'lib/itexmo/sms.rb', line 92 def self.(originator) instance = new instance.(originator) end |
.delete_message_via_originator(originator) ⇒ Object
78 79 80 81 |
# File 'lib/itexmo/sms.rb', line 78 def self.(originator) instance = new instance.(originator) end |
.delete_messages_all ⇒ Object
104 105 106 107 |
# File 'lib/itexmo/sms.rb', line 104 def self. instance = new instance. end |
.display_messages ⇒ Object
50 51 52 53 |
# File 'lib/itexmo/sms.rb', line 50 def self. instance = new instance. end |
.display_messages_via_originator(originator) ⇒ Object
64 65 66 67 |
# File 'lib/itexmo/sms.rb', line 64 def self.(originator) instance = new instance.(originator) end |
.display_outgoing(sortby = 'asc') ⇒ Object
26 27 28 29 |
# File 'lib/itexmo/sms.rb', line 26 def self.display_outgoing(sortby = 'asc') instance = new instance.display_outgoing(sortby) end |
Instance Method Details
#delete_all_outgoing ⇒ Object
31 32 33 34 35 36 |
# File 'lib/itexmo/sms.rb', line 31 def delete_all_outgoing uri = URI(API_ENDPOINT + '/delete_outgoing_all.php') uri.query = URI.encode_www_form(PARAMETERS) request = Net::HTTP.get_response(uri) ResponseHelper.parse(request.body) end |
#delete_message_via_id(id) ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/itexmo/sms.rb', line 83 def (id) PARAMETERS[:id] = id uri = URI(API_ENDPOINT + '/delete_message_via_id.php') uri.query = URI.encode_www_form(PARAMETERS) request = Net::HTTP.get_response(uri) PARAMETERS.except!(:id) ResponseHelper.parse(request.body) end |
#delete_message_via_originator(originator) ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/itexmo/sms.rb', line 69 def (originator) PARAMETERS[:originator] = originator uri = URI(API_ENDPOINT + '/delete_message_via_originator.php') uri.query = URI.encode_www_form(PARAMETERS) request = Net::HTTP.get_response(uri) PARAMETERS.except!(:originator) ResponseHelper.parse(request.body) end |
#delete_messages_all ⇒ Object
97 98 99 100 101 102 |
# File 'lib/itexmo/sms.rb', line 97 def uri = URI(API_ENDPOINT + '/delete_messages_all.php') uri.query = URI.encode_www_form(PARAMETERS) request = Net::HTTP.get_response(uri) ResponseHelper.parse(request.body) end |
#display_messages ⇒ Object
43 44 45 46 47 48 |
# File 'lib/itexmo/sms.rb', line 43 def uri = URI(API_ENDPOINT + '/display_messages.php') uri.query = URI.encode_www_form(PARAMETERS) request = Net::HTTP.get_response(uri) ResponseHelper.parse(request.body) end |
#display_messages_via_originator(originator) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/itexmo/sms.rb', line 55 def (originator) PARAMETERS[:originator] = originator uri = URI(API_ENDPOINT + '/display_messages_via_originator.php') uri.query = URI.encode_www_form(PARAMETERS) request = Net::HTTP.get_response(uri) PARAMETERS.except!(:originator) ResponseHelper.parse(request.body) end |
#display_outgoing(sortby = 'asc') ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/itexmo/sms.rb', line 17 def display_outgoing(sortby = 'asc') PARAMETERS[:sortby] = sortby uri = URI(API_ENDPOINT + '/display_outgoing.php') uri.query = URI.encode_www_form(PARAMETERS) request = Net::HTTP.get_response(uri) PARAMETERS.except!(:sortby) ResponseHelper.parse(request.body) end |