Class: PayTrace::EmailReceiptRequest
- Inherits:
-
Object
- Object
- PayTrace::EmailReceiptRequest
- Defined in:
- lib/paytrace/email_receipt_request.rb
Overview
Methods to request an email receipt for a transaction
Constant Summary collapse
- TRANSACTION_METHOD =
:nodoc:
"EmailReceipt"
Instance Attribute Summary collapse
-
#check_id ⇒ Object
Returns the value of attribute check_id.
-
#email ⇒ Object
Returns the value of attribute email.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ EmailReceiptRequest
constructor
Initializer.
-
#send_request(request = nil) ⇒ Object
Sends the request for the transaction.
-
#set_request(request = nil) ⇒ Object
:nodoc:.
Constructor Details
#initialize(params = {}) ⇒ EmailReceiptRequest
Initializer. Params: :email – the email address to send the receipt to :transaction_id – the transaction ID of the transaction to email :check_id – the check ID of the transaction to email Note: only use :transaction_id or :check_id – not both.
14 15 16 17 18 19 |
# File 'lib/paytrace/email_receipt_request.rb', line 14 def initialize(params = {}) email, id, id_is_check_id = false @email = params[:email] @transaction_id = params[:transaction_id] @check_id = params[:check_id] end |
Instance Attribute Details
#check_id ⇒ Object
Returns the value of attribute check_id.
6 7 8 |
# File 'lib/paytrace/email_receipt_request.rb', line 6 def check_id @check_id end |
#email ⇒ Object
Returns the value of attribute email.
6 7 8 |
# File 'lib/paytrace/email_receipt_request.rb', line 6 def email @email end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
6 7 8 |
# File 'lib/paytrace/email_receipt_request.rb', line 6 def transaction_id @transaction_id end |
Instance Method Details
#send_request(request = nil) ⇒ Object
Sends the request for the transaction. Accepts an existing request object, or creates one if needed.
34 35 36 37 38 39 |
# File 'lib/paytrace/email_receipt_request.rb', line 34 def send_request(request = nil) request ||= set_request gateway = PayTrace::API::Gateway.new gateway.send_request(request) end |
#set_request(request = nil) ⇒ Object
:nodoc:
22 23 24 25 26 27 28 29 30 |
# File 'lib/paytrace/email_receipt_request.rb', line 22 def set_request(request = nil) request ||= PayTrace::API::Request.new request.set_param(:method, TRANSACTION_METHOD) request.set_param(:check_id, @check_id) request.set_param(:transaction_id, @transaction_id) request.set_param(:email, @email) request end |