Class: AuthorizeNet::Request
- Inherits:
-
Object
- Object
- AuthorizeNet::Request
- Defined in:
- lib/authorize_net/request.rb
Overview
This class represents a request to the Authorize.Net API
Add any logic that applies to ALL requests here
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#getRequest ⇒ Object
Uses the given data to make a GET request =============================================.
-
#initialize(type, data, uri) ⇒ Request
constructor
A new instance of Request.
-
#postRequest ⇒ Object
Uses the given data to make a POST request =============================================.
-
#toLog(log_body) ⇒ Object
Make a log string for this request =============================================.
Constructor Details
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
11 12 13 |
# File 'lib/authorize_net/request.rb', line 11 def response @response end |
Instance Method Details
#getRequest ⇒ Object
Uses the given data to make a GET request
36 37 38 39 40 41 |
# File 'lib/authorize_net/request.rb', line 36 def getRequest assertRequestType req = Net::HTTP::Get.new(@uri.request_uri) req.add_field('Content-Type', 'text/xml') req.body = buildXmlRequest end |
#postRequest ⇒ Object
Uses the given data to make a POST request
23 24 25 26 27 28 29 30 31 |
# File 'lib/authorize_net/request.rb', line 23 def postRequest assertRequestData assertRequestType req = Net::HTTP::Post.new(@uri.request_uri) req.add_field('Content-Type', 'text/xml') req.body = buildXmlRequest @response = sendRequest(req) return @response end |
#toLog(log_body) ⇒ Object
Make a log string for this request
46 47 48 49 50 51 52 53 54 |
# File 'lib/authorize_net/request.rb', line 46 def toLog(log_body) log = "[AuthorizeNet] HTTP Request type=#{@request_type} uri=#{@uri}" if log_body log += " body=\"#{buildXmlRequest}\"" end return log end |