Class: Recharge::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/recharge/base.rb

Class Method Summary collapse

Class Method Details

.delete(uri, apiKey = nil) ⇒ Object



14
15
16
17
# File 'lib/recharge/base.rb', line 14

def delete(uri, apiKey=nil)
  client = Client.new()
  return client.request('DELETE', uri, nil, apiKey)
end

.get(uri, apiKey = nil) ⇒ Object



4
5
6
7
# File 'lib/recharge/base.rb', line 4

def get(uri, apiKey=nil)
  client = Client.new()
  return client.request('GET', uri, nil, apiKey)
end

.post(uri, data = nil, apiKey = nil) ⇒ Object



9
10
11
12
# File 'lib/recharge/base.rb', line 9

def post(uri, data=nil, apiKey=nil)
  client = Client.new()
  return client.request('POST', uri, data, apiKey)
end

.returnErrorXML(data) ⇒ Object



30
31
32
33
34
35
# File 'lib/recharge/base.rb', line 30

def returnErrorXML(data)
  require "rexml/document"
  doc = REXML::Document.new(data)
  
  doc.elements["/response/result/resultDescription"].text
end

.returnImportantXML(data) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/recharge/base.rb', line 19

def returnImportantXML(data)
  require "rexml/document"
  doc = REXML::Document.new(data)
  
  if doc.elements[1].elements[3].length == 1
    return doc.elements[1].elements[3].elements[1]
  else 
    return doc.elements[1].elements[3]
  end
end

.returnStatusXML(data) ⇒ Object



37
38
39
40
41
42
# File 'lib/recharge/base.rb', line 37

def returnStatusXML(data)
  require "rexml/document"
  doc = REXML::Document.new(data)
  
  doc.elements["/response/result/resultDescription"]
end