Class: Eniyismsapi::REQUEST
- Inherits:
-
Object
- Object
- Eniyismsapi::REQUEST
- Defined in:
- lib/eniyismsapi/request.rb
Instance Method Summary collapse
-
#initialize(path, params) ⇒ REQUEST
constructor
A new instance of REQUEST.
- #request ⇒ Object
Constructor Details
#initialize(path, params) ⇒ REQUEST
Returns a new instance of REQUEST.
8 9 10 11 12 |
# File 'lib/eniyismsapi/request.rb', line 8 def initialize path, params @params = params @api_base_url = "http://eniyisms.com/Api/#{path}" @path = path end |
Instance Method Details
#request ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/eniyismsapi/request.rb', line 14 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 if @path != 'Query' return Crack::XML.parse(response.body) else return response.body.split end end |