Class: Paypal::AdaptivePaymentsRequest
- Inherits:
-
Request
- Object
- Request
- Paypal::AdaptivePaymentsRequest
show all
- Defined in:
- lib/paypal_api/apis/adaptive_payments.rb
Constant Summary
Constants inherited
from Request
Request::PAYPAL_VERSION
Instance Attribute Summary collapse
Attributes inherited from Request
#error_message, #payload, #test_request
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Request
#initialize, #make, #paypal_endpoint_with_defaults, #request_host, #request_string, required_keys, sequential_keys, #sequentials_string, #valid?
Methods included from Formatters
#escape_uri_component
Instance Attribute Details
#ip_address ⇒ Object
customize validation here
81
82
83
|
# File 'lib/paypal_api/apis/adaptive_payments.rb', line 81
def ip_address
@ip_address
end
|
Class Method Details
.api_endpoint ⇒ Object
83
84
85
|
# File 'lib/paypal_api/apis/adaptive_payments.rb', line 83
def self.api_endpoint
"https://svcs.paypal.com/AdaptivePayments/#{api_method.capitalize}"
end
|
.api_sandbox_endpoint ⇒ Object
87
88
89
|
# File 'lib/paypal_api/apis/adaptive_payments.rb', line 87
def self.api_sandbox_endpoint
"https://svcs.sandbox.paypal.com/AdaptivePayments/#{api_method.capitalize}"
end
|
Instance Method Details
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/paypal_api/apis/adaptive_payments.rb', line 91
def
{
"X-PAYPAL-SECURITY-USERID" => user,
"X-PAYPAL-SECURITY-PASSWORD" => password,
"X-PAYPAL-SECURITY-SIGNATURE" => signature,
"X-PAYPAL-DEVICE-IPADDRESS" => @ip_address,
"X-PAYPAL-REQUEST-DATA-FORMAT" => "NV",
"X-PAYPAL-RESPONSE-DATA-FORMAT" => "NV",
"X-PAYPAL-APPLICATION-ID" => application_id
}
end
|
#make_request ⇒ Object
107
108
109
110
111
112
113
|
# File 'lib/paypal_api/apis/adaptive_payments.rb', line 107
def make_request
if @ip_address.nil?
throw Paypal::InvalidRequest, "need an ip address"
else
super
end
end
|
#process_response(response) ⇒ Object
103
104
105
|
# File 'lib/paypal_api/apis/adaptive_payments.rb', line 103
def process_response(response)
return AdaptivePaymentsResponse.new(response)
end
|
#to_key(symbol) ⇒ Object
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/paypal_api/apis/adaptive_payments.rb', line 115
def to_key(symbol)
if symbol.is_a?(String)
return symbol
else
case symbol
when :request_envelope_error_language then
return "requestEnvelope.errorLanguage"
when :request_envelope_detail_level then
return "requestEnvelope.detailLevel"
when :sender_use_credentials
return "sender.useCredentials"
when :method
return "METHOD"
else
return Paypal::Api.symbol_to_lower_camel(symbol)
end
end
end
|