Class: Garbanzo::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/garbanzo/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_mode) ⇒ Request

Returns a new instance of Request.



9
10
11
# File 'lib/garbanzo/request.rb', line 9

def initialize(test_mode)
  @test_mode = test_mode
end

Class Method Details

.post(xml, test_mode = true) ⇒ Object



5
6
7
# File 'lib/garbanzo/request.rb', line 5

def self.post(xml, test_mode = true)
  new(test_mode).post(xml).body
end

Instance Method Details

#post(xml) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/garbanzo/request.rb', line 13

def post(xml)
  connection.post do |p|
    p.url Garbanzo::API_URI
    p.headers['Content-Type'] = 'text/xml'
    p.body = xml
  end
end