Class: Smart::REST::Client

Inherits:
Object
  • Object
show all
Includes:
ClassSupportMixin, Configuration
Defined in:
lib/smart/rest/client.rb

Constant Summary collapse

HTTP_HEADERS =
{
  'Content-Type' => 'application/json',
  'Accept' => 'application/json', 
  'Authorization' => 'WSSE realm="SDP",profile="UsernameToken"' 
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configuration

included

Methods included from ClassSupportMixin

included

Instance Attribute Details

#access_codeObject (readonly)

Returns the value of attribute access_code.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def access_code
  @access_code
end

#creation_timeObject (readonly)

Returns the value of attribute creation_time.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def creation_time
  @creation_time
end

#mobile_numberObject (readonly)

Returns the value of attribute mobile_number.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def mobile_number
  @mobile_number
end

#nonceObject (readonly)

Returns the value of attribute nonce.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def nonce
  @nonce
end

#path_to_certObject (readonly)

Returns the value of attribute path_to_cert.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def path_to_cert
  @path_to_cert
end

#sp_idObject (readonly)

Returns the value of attribute sp_id.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def sp_id
  @sp_id
end

#sp_passwordObject (readonly)

Returns the value of attribute sp_password.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def sp_password
  @sp_password
end

#sp_service_idObject (readonly)

Returns the value of attribute sp_service_id.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def sp_service_id
  @sp_service_id
end

#trans_idObject (readonly)

Returns the value of attribute trans_id.



30
31
32
# File 'lib/smart/rest/client.rb', line 30

def trans_id
  @trans_id
end

Instance Method Details

#headersObject



32
33
34
35
36
37
# File 'lib/smart/rest/client.rb', line 32

def headers
  HTTP_HEADERS.merge! ({
    'X-WSSE' => %{ "UsernameToken Username="#{self.sp_id}",PasswordDigest="#{self.sp_password}",Nonce="#{self.nonce}", Created="#{self.creation_time}"}, 
    'X-RequestHeader' => %{ "request TransId="",ServiceId="#{self.service_id}" }
  })
end

#send_sms(args = {}) ⇒ Object



39
40
41
42
# File 'lib/smart/rest/client.rb', line 39

def send_sms(args = {})
  request = setup_connection(args)
  response = connect(request)
end