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.
20 21 22 23 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 20 def initialize(, env = nil, = {}) @message = set_config(env, ) end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
18 19 20 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 18 def @message end |
Instance Method Details
#default_ipn_endpoint ⇒ Object
Default IPN end point
31 32 33 34 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 31 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
26 27 28 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 26 def ipn_endpoint config.ipn_endpoint || default_ipn_endpoint end |
#request ⇒ Object
Request IPN service for validating the content
Return
return http response object
39 40 41 42 43 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 39 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
48 49 50 |
# File 'lib/paypal-sdk/core/api/ipn.rb', line 48 def valid? request.body == VERIFIED end |