class Garbanzo::Request
Attributes
test_mode[R]
Public Class Methods
new(test_mode)
click to toggle source
# File lib/garbanzo/request.rb, line 9 def initialize(test_mode) @test_mode = test_mode end
post(xml, test_mode = true)
click to toggle source
# File lib/garbanzo/request.rb, line 5 def self.post(xml, test_mode = true) new(test_mode).post(xml).body end
Public Instance Methods
post(xml)
click to toggle source
# 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
Private Instance Methods
connection()
click to toggle source
# File lib/garbanzo/request.rb, line 25 def connection @connection ||= Faraday.new(url: host) end
host()
click to toggle source
# File lib/garbanzo/request.rb, line 29 def host test_mode ? Garbanzo::TEST_HOST : Garbanzo::LIVE_HOST end