Module: Bluevia::Messaging
- Included in:
- Sms
- Defined in:
- lib/bluevia/messaging.rb
Overview
This module is a mixin used by SMS client to get some basic messaging features
Instance Method Summary collapse
-
#get_attachment(registration_id, message_id, attachment_id) ⇒ Object
This method allows to retrieved a specific attachment belonging to a message [registration_id] MO Registration Identifier [message_id] message unique identifier [attachment_id] attachment identifier (corresponding to the specific message.
-
#get_delivery_status(id) ⇒ Object
This method returns the delivery status of a SMS sent by the user [id] message unique identifier.
-
#get_received_message(registration_id, message_id = nil, attachments = false) ⇒ Object
This method is used to retrieve MO messages that belongs to a specific registration ID [registration_id] MO Registration Identifier Mandatory [message_id] message unique identifier [attachments] bool flag to get message attachments (if true) returns a collection of messages.
Instance Method Details
#get_attachment(registration_id, message_id, attachment_id) ⇒ Object
This method allows to retrieved a specific attachment belonging to a message
- registration_id
-
MO Registration Identifier
- message_id
-
message unique identifier
- attachment_id
-
attachment identifier (corresponding to the specific message
44 45 46 47 48 49 |
# File 'lib/bluevia/messaging.rb', line 44 def (registration_id, , ) Utils.check_attribute(registration_id, "Registration id must be provided") Utils.check_attribute(, "Message id must be provided") Utils.check_attribute(, "Attachment id must be provided") GET("#{get_basepath}/inbound/#{registration_id}/messages/#{}/attachments/#{}") end |
#get_delivery_status(id) ⇒ Object
This method returns the delivery status of a SMS sent by the user
- id
-
message unique identifier
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bluevia/messaging.rb', line 56 def get_delivery_status (id) Utils.check_attribute id, "#{self.class.to_s.upcase} identifier cannot be null" if is_url?(id) id = id.split("/").last(2).first end response = GET("#{get_basepath}/outbound/requests/#{id}/deliverystatus", nil, nil) # Clean duplicated key if response.instance_of?(Hash) if response.has_key?("smsDeliveryStatus") return response["smsDeliveryStatus"] elsif response.has_ley?("messageDeliveryStatus") return response["messageDeliveryStatus"] else return response end end end |
#get_received_message(registration_id, message_id = nil, attachments = false) ⇒ Object
This method is used to retrieve MO messages that belongs to a specific registration ID
- registration_id
-
MO Registration Identifier Mandatory
- message_id
-
message unique identifier
- attachments
-
bool flag to get message attachments (if true)
returns a collection of messages
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bluevia/messaging.rb', line 21 def (registration_id, = nil, = false) Utils.check_attribute(registration_id, "Provisioning registration id must be provided") unless .nil? = "/#{}" unless == false = "/attachments" else = "" end else = "" = "" end GET("#{get_basepath}/inbound/#{registration_id}/messages#{}#{}") end |