Class: ActiveMerchant::Billing::EveryPayRequest
- Inherits:
-
Object
- Object
- ActiveMerchant::Billing::EveryPayRequest
- Defined in:
- lib/active_merchant/billing/every_pay_request.rb
Instance Attribute Summary collapse
-
#gateway_options ⇒ Object
Returns the value of attribute gateway_options.
-
#params ⇒ Object
Returns the value of attribute params.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
Instance Method Summary collapse
- #basic_auth ⇒ Object
- #data ⇒ Object
- #headers ⇒ Object
-
#initialize(gateway_options, scheme, params) ⇒ EveryPayRequest
constructor
A new instance of EveryPayRequest.
- #method ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(gateway_options, scheme, params) ⇒ EveryPayRequest
Returns a new instance of EveryPayRequest.
6 7 8 9 10 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 6 def initialize , scheme, params self. = self.scheme = scheme self.params = params end |
Instance Attribute Details
#gateway_options ⇒ Object
Returns the value of attribute gateway_options.
4 5 6 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 4 def @gateway_options end |
#params ⇒ Object
Returns the value of attribute params.
4 5 6 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 4 def params @params end |
#scheme ⇒ Object
Returns the value of attribute scheme.
4 5 6 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 4 def scheme @scheme end |
Instance Method Details
#basic_auth ⇒ Object
37 38 39 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 37 def basic_auth "Basic " + Base64.strict_encode64("#{.fetch(:api_username)}:#{.fetch(:api_secret)}") end |
#data ⇒ Object
12 13 14 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 12 def data params.to_json if scheme.post_request? end |
#headers ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 29 def headers { "Content-Type" => "application/json", "Accept" => "application/json", "Authorization" => basic_auth } end |
#method ⇒ Object
25 26 27 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 25 def method scheme.request_method end |
#url ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/active_merchant/billing/every_pay_request.rb', line 16 def url uri = URI(.fetch(:gateway_url)) uri.path += scheme.request_path.gsub(/(:[\w]*)/) {|m| m.gsub(m, params.fetch(m.tr(":", "").to_sym)) } uri.query = URI.encode_www_form(params) if scheme.get_request? uri.to_s end |