Class: PayPal::SDK::Core::API::IPN::Message
- Inherits:
-
Object
- Object
- PayPal::SDK::Core::API::IPN::Message
- Includes:
- Util::HTTPHelper
- Defined in:
- lib/paypal-sdk/core/api/ipn.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
-
#default_ipn_endpoint ⇒ Object
Default IPN end point.
-
#initialize(message, env = nil, options = {}) ⇒ Message
constructor
A new instance of Message.
-
#ipn_endpoint ⇒ Object
Fetch end point.
-
#request ⇒ Object
Request IPN service for validating the content === Return return http response object.
-
#valid? ⇒ Boolean
Validate the given content === Return return true or false.
Methods included from Util::HTTPHelper
#configure_ssl, #create_http_connection, #default_ca_file, #encode_www_form, #handle_response, #http_call, #log_http_call, #map_header_value, #new_http, #url_join
Methods included from PayPal::SDK::Core::Authentication
#add_certificate, #base_credential, #base_credential_type, #credential, #set_config, #third_party_credential
Methods included from Configuration
Methods included from Logging
#log_event, #logger, logger, logger=
Constructor Details
#initialize(message, env = nil, options = {}) ⇒ Message
Returns a new instance of Message.
19 20 21 22 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 19 def initialize(, env = nil, = {}) @message = set_config(env, ) end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
17 18 19 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 17 def @message end |
Instance Method Details
#default_ipn_endpoint ⇒ Object
Default IPN end point
30 31 32 33 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 30 def default_ipn_endpoint endpoint = END_POINTS[(config.mode || :sandbox).to_sym] rescue nil endpoint || END_POINTS[:sandbox] end |
#ipn_endpoint ⇒ Object
Fetch end point
25 26 27 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 25 def ipn_endpoint config.ipn_endpoint || default_ipn_endpoint end |
#request ⇒ Object
Request IPN service for validating the content
Return
return http response object
38 39 40 41 42 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 38 def request uri = URI(ipn_endpoint) query_string = "cmd=_notify-validate&#{}" http_call(:method => :post, :uri => uri, :body => query_string) end |
#valid? ⇒ Boolean
Validate the given content
Return
return true or false
47 48 49 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 47 def valid? request.body == VERIFIED end |