Class: Braintree::WebhookNotification
- Inherits:
-
Object
- Object
- Braintree::WebhookNotification
- Includes:
- BaseModule
- Defined in:
- lib/braintree/webhook_notification.rb
Defined Under Namespace
Modules: Kind
Instance Attribute Summary collapse
-
#disbursement ⇒ Object
readonly
Returns the value of attribute disbursement.
-
#dispute ⇒ Object
readonly
Returns the value of attribute dispute.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#partner_merchant ⇒ Object
readonly
Returns the value of attribute partner_merchant.
-
#subscription ⇒ Object
readonly
Returns the value of attribute subscription.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#transaction ⇒ Object
readonly
Returns the value of attribute transaction.
Class Method Summary collapse
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(gateway, attributes) ⇒ WebhookNotification
constructor
:nodoc:.
- #merchant_account ⇒ Object
- #message ⇒ Object
Methods included from BaseModule
Methods included from BaseModule::Methods
#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class
Constructor Details
#initialize(gateway, attributes) ⇒ WebhookNotification
:nodoc:
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/braintree/webhook_notification.rb', line 41 def initialize(gateway, attributes) # :nodoc: @gateway = gateway set_instance_variables_from_hash(attributes) @error_result = ErrorResult.new(gateway, @subject[:api_error_response]) if @subject.has_key?(:api_error_response) @merchant_account = MerchantAccount._new(gateway, @subject[:merchant_account]) if @subject.has_key?(:merchant_account) @partner_merchant = OpenStruct.new(@subject[:partner_merchant]) if @subject.has_key?(:partner_merchant) @subscription = Subscription._new(gateway, @subject[:subscription]) if @subject.has_key?(:subscription) @transaction = Transaction._new(gateway, @subject[:transaction]) if @subject.has_key?(:transaction) @disbursement = Disbursement._new(gateway, @subject[:disbursement]) if @subject.has_key?(:disbursement) @dispute = Dispute._new(@subject[:dispute]) if @subject.has_key?(:dispute) end |
Instance Attribute Details
#disbursement ⇒ Object (readonly)
Returns the value of attribute disbursement.
31 32 33 |
# File 'lib/braintree/webhook_notification.rb', line 31 def disbursement @disbursement end |
#dispute ⇒ Object (readonly)
Returns the value of attribute dispute.
31 32 33 |
# File 'lib/braintree/webhook_notification.rb', line 31 def dispute @dispute end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
31 32 33 |
# File 'lib/braintree/webhook_notification.rb', line 31 def kind @kind end |
#partner_merchant ⇒ Object (readonly)
Returns the value of attribute partner_merchant.
31 32 33 |
# File 'lib/braintree/webhook_notification.rb', line 31 def partner_merchant @partner_merchant end |
#subscription ⇒ Object (readonly)
Returns the value of attribute subscription.
31 32 33 |
# File 'lib/braintree/webhook_notification.rb', line 31 def subscription @subscription end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
31 32 33 |
# File 'lib/braintree/webhook_notification.rb', line 31 def @timestamp end |
#transaction ⇒ Object (readonly)
Returns the value of attribute transaction.
31 32 33 |
# File 'lib/braintree/webhook_notification.rb', line 31 def transaction @transaction end |
Class Method Details
._new(*args) ⇒ Object
:nodoc:
67 68 69 |
# File 'lib/braintree/webhook_notification.rb', line 67 def _new(*args) # :nodoc: self.new *args end |
.parse(signature, payload) ⇒ Object
33 34 35 |
# File 'lib/braintree/webhook_notification.rb', line 33 def self.parse(signature, payload) Configuration.gateway.webhook_notification.parse(signature, payload) end |
.verify(challenge) ⇒ Object
37 38 39 |
# File 'lib/braintree/webhook_notification.rb', line 37 def self.verify(challenge) Configuration.gateway.webhook_notification.verify(challenge) end |
Instance Method Details
#errors ⇒ Object
57 58 59 |
# File 'lib/braintree/webhook_notification.rb', line 57 def errors @error_result.errors if @error_result end |
#merchant_account ⇒ Object
53 54 55 |
# File 'lib/braintree/webhook_notification.rb', line 53 def merchant_account @error_result.nil? ? @merchant_account : @error_result.merchant_account end |
#message ⇒ Object
61 62 63 |
# File 'lib/braintree/webhook_notification.rb', line 61 def @error_result. if @error_result end |