Class: CodecFastSms::Client
Overview
Client
Instance Attribute Summary
Attributes inherited from Core
#attributes, #connection, #message, #profile, #response, #to
Instance Method Summary collapse
- #assign_recipient_information(to, message) ⇒ Object
- #deliver(to, message) ⇒ Object
- #generate_optional_parameters ⇒ Object
- #iys_params ⇒ Object
- #params ⇒ Object
-
#request_uri ⇒ Object
Api endpoint.
Methods inherited from Core
#current_config, #initialize, #perform
Constructor Details
This class inherits a constructor from CodecFastSms::Core
Instance Method Details
#assign_recipient_information(to, message) ⇒ Object
30 31 32 33 |
# File 'lib/codec_fast_sms/client.rb', line 30 def assign_recipient_information(to, ) self.to = to self. = end |
#deliver(to, message) ⇒ Object
35 36 37 38 |
# File 'lib/codec_fast_sms/client.rb', line 35 def deliver(to, ) assign_recipient_information(to, ) perform end |
#generate_optional_parameters ⇒ Object
40 41 42 43 44 45 |
# File 'lib/codec_fast_sms/client.rb', line 40 def generate_optional_parameters attr = attributes[:optionalParameters] return attr.to_json if attr.is_a?(Hash) && !attr.empty? attr.to_s end |
#iys_params ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/codec_fast_sms/client.rb', line 22 def iys_params { iysMessageType: (attributes[:iys_message_type] || 'BILGILENDIRME'), iysRecipientType: attributes[:iys_recipient_type].to_s, iysBrandCode: attributes[:iys_brand_code].to_s } end |
#params ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/codec_fast_sms/client.rb', line 11 def params { userName: current_config.username, password: current_config.password, sender: current_config.sender, phone: to, messageContent: , msgSpecialId: '', isOtn: 'True', headerCode: '', responseType: '3', optionalParameters: generate_optional_parameters }.merge(iys_params) end |
#request_uri ⇒ Object
Api endpoint.
7 8 9 |
# File 'lib/codec_fast_sms/client.rb', line 7 def request_uri '/Soap.asmx/SendSms' end |