Class: GoCardlessPro::Resources::Webhook

Inherits:
Object
  • Object
show all
Defined in:
lib/gocardless_pro/resources/webhook.rb

Overview

Basic description of a webhook

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ Webhook

Initialize a webhook resource instance

Parameters:

  • object (Hash)

    an object returned from the API



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/gocardless_pro/resources/webhook.rb', line 20

def initialize(object, response = nil)
  @object = object

  @created_at = object['created_at']
  @id = object['id']
  @is_test = object['is_test']
  @request_body = object['request_body']
  @request_headers = object['request_headers']
  @response_body = object['response_body']
  @response_body_truncated = object['response_body_truncated']
  @response_code = object['response_code']
  @response_headers = object['response_headers']
  @response_headers_content_truncated = object['response_headers_content_truncated']
  @response_headers_count_truncated = object['response_headers_count_truncated']
  @successful = object['successful']
  @url = object['url']
  @response = response
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def id
  @id
end

#is_testObject (readonly)

Returns the value of attribute is_test.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def is_test
  @is_test
end

#request_bodyObject (readonly)

Returns the value of attribute request_body.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def request_body
  @request_body
end

#request_headersObject (readonly)

Returns the value of attribute request_headers.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def request_headers
  @request_headers
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def response_body
  @response_body
end

#response_body_truncatedObject (readonly)

Returns the value of attribute response_body_truncated.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def response_body_truncated
  @response_body_truncated
end

#response_codeObject (readonly)

Returns the value of attribute response_code.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def response_code
  @response_code
end

#response_headersObject (readonly)

Returns the value of attribute response_headers.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def response_headers
  @response_headers
end

#response_headers_content_truncatedObject (readonly)

Returns the value of attribute response_headers_content_truncated.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def response_headers_content_truncated
  @response_headers_content_truncated
end

#response_headers_count_truncatedObject (readonly)

Returns the value of attribute response_headers_count_truncated.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def response_headers_count_truncated
  @response_headers_count_truncated
end

#successfulObject (readonly)

Returns the value of attribute successful.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def successful
  @successful
end

#urlObject (readonly)

Returns the value of attribute url.



15
16
17
# File 'lib/gocardless_pro/resources/webhook.rb', line 15

def url
  @url
end

Instance Method Details

#api_responseObject



39
40
41
# File 'lib/gocardless_pro/resources/webhook.rb', line 39

def api_response
  ApiResponse.new(@response)
end

#to_hObject

Provides the webhook resource as a hash of all its readable attributes



44
45
46
# File 'lib/gocardless_pro/resources/webhook.rb', line 44

def to_h
  @object
end