Class: Braintree::WebhookNotification

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/webhook_notification.rb

Defined Under Namespace

Modules: Kind

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

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

#disbursementObject (readonly)

Returns the value of attribute disbursement.



31
32
33
# File 'lib/braintree/webhook_notification.rb', line 31

def disbursement
  @disbursement
end

#disputeObject (readonly)

Returns the value of attribute dispute.



31
32
33
# File 'lib/braintree/webhook_notification.rb', line 31

def dispute
  @dispute
end

#kindObject (readonly)

Returns the value of attribute kind.



31
32
33
# File 'lib/braintree/webhook_notification.rb', line 31

def kind
  @kind
end

#partner_merchantObject (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

#subscriptionObject (readonly)

Returns the value of attribute subscription.



31
32
33
# File 'lib/braintree/webhook_notification.rb', line 31

def subscription
  @subscription
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



31
32
33
# File 'lib/braintree/webhook_notification.rb', line 31

def timestamp
  @timestamp
end

#transactionObject (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

#errorsObject



57
58
59
# File 'lib/braintree/webhook_notification.rb', line 57

def errors
  @error_result.errors if @error_result
end

#merchant_accountObject



53
54
55
# File 'lib/braintree/webhook_notification.rb', line 53

def 
  @error_result.nil? ? @merchant_account : @error_result.
end

#messageObject



61
62
63
# File 'lib/braintree/webhook_notification.rb', line 61

def message
  @error_result.message if @error_result
end