class IletimerkeziSMS::REQUEST

Public Class Methods

new(path, params) click to toggle source
# File lib/iletimerkezisms/request.rb, line 8
def initialize(path, params)
  @params = params
  @api_base_url = "http://api.iletimerkezi.com/v1/#{path}"
end

Public Instance Methods

request() click to toggle source
# File lib/iletimerkezisms/request.rb, line 13
def request
  begin
    resource = RestClient::Resource.new(@api_base_url, timeout: 30, open_timeout: 30)
    response = resource.post @params, content_type: :xml, accept: :xml
  rescue RestClient::ExceptionWithResponse => err
    response = err.response
  end
  return Crack::XML.parse(response.body)["response"]
end