Class: Infobeep::SMSRequest

Inherits:
BaseRequestModel show all
Defined in:
lib/infobeep/requests/sms_request.rb

Instance Method Summary collapse

Methods inherited from BaseRequestModel

#headers

Instance Method Details

#hash_attributesObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/infobeep/requests/sms_request.rb', line 15

def hash_attributes
  h = super
  h[:destinations] = []
  h[:destinations] =  h[:destinations] + destinations.collect{ |destination| destination.hash_attributes }
  unless to.empty?
    h[:destinations] << {to: to}
  end
  h.delete(:to)
  h
end

#http_methodObject



30
31
32
# File 'lib/infobeep/requests/sms_request.rb', line 30

def http_method
  :post
end

#payloadObject



34
35
36
37
38
# File 'lib/infobeep/requests/sms_request.rb', line 34

def payload
  bulk_sms_request = Infobeep::BulkSMSRequest.new
  bulk_sms_request.messages = [self]
  bulk_sms_request.payload
end

#response_classObject



40
41
42
# File 'lib/infobeep/requests/sms_request.rb', line 40

def response_class
  SMSResponse
end

#routeObject



26
27
28
# File 'lib/infobeep/requests/sms_request.rb', line 26

def route
  'sms/1/text/advanced'
end