Class: Kave::SendRequestSimple
- Inherits:
-
Object
- Object
- Kave::SendRequestSimple
- Defined in:
- lib/kave/send_request.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#mobile ⇒ Object
Returns the value of attribute mobile.
-
#msgmode ⇒ Object
Returns the value of attribute msgmode.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#unixdate ⇒ Object
Returns the value of attribute unixdate.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = {}) ⇒ SendRequestSimple
constructor
A new instance of SendRequestSimple.
Constructor Details
#initialize(args = {}) ⇒ SendRequestSimple
Returns a new instance of SendRequestSimple.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/kave/send_request.rb', line 8 def initialize(args = {}) args[:unixdate] ||= nil args[:msgmode] ||= nil @mobile = args.fetch(:mobile) = args.fetch(:message) @unixdate = args.fetch(:unixdate) || 0 @wsdl = Savon.client(wsdl: Kave.configuration.wsdl, pretty_print_xml: true) @response = ResponseRequestSimple.new @msgmode = args.fetch(:msgmode) || 1 @username = Kave.configuration.username || '' @password = Kave.configuration.password || '' end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/kave/send_request.rb', line 5 def end |
#mobile ⇒ Object
Returns the value of attribute mobile.
5 6 7 |
# File 'lib/kave/send_request.rb', line 5 def mobile @mobile end |
#msgmode ⇒ Object
Returns the value of attribute msgmode.
5 6 7 |
# File 'lib/kave/send_request.rb', line 5 def msgmode @msgmode end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/kave/send_request.rb', line 6 def response @response end |
#unixdate ⇒ Object
Returns the value of attribute unixdate.
5 6 7 |
# File 'lib/kave/send_request.rb', line 5 def unixdate @unixdate end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/kave/send_request.rb', line 21 def call @send_simple_by= unless Kave.configuration.api_key.nil? :send_simple_by_apikey else :send_simple_by_login_info end response = @wsdl.call @send_simple_by, message: { 'apikey' =>Kave.configuration.api_key, 'username'=>@username, 'password'=>@password, 'receptor'=> {string:@mobile}, 'message' => , 'sender' => Kave.configuration.sender, 'unixdate'=>@unixdate, 'msgmode'=>@msgmode } @response.validate(response.body,@send_simple_by) end |