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



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/gocardless_pro/resources/webhook.rb', line 31

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.



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

def id
  @id
end

#is_testObject (readonly)

Returns the value of attribute is_test.



17
18
19
# File 'lib/gocardless_pro/resources/webhook.rb', line 17

def is_test
  @is_test
end

#request_bodyObject (readonly)

Returns the value of attribute request_body.



18
19
20
# File 'lib/gocardless_pro/resources/webhook.rb', line 18

def request_body
  @request_body
end

#request_headersObject (readonly)

Returns the value of attribute request_headers.



19
20
21
# File 'lib/gocardless_pro/resources/webhook.rb', line 19

def request_headers
  @request_headers
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



20
21
22
# File 'lib/gocardless_pro/resources/webhook.rb', line 20

def response_body
  @response_body
end

#response_body_truncatedObject (readonly)

Returns the value of attribute response_body_truncated.



21
22
23
# File 'lib/gocardless_pro/resources/webhook.rb', line 21

def response_body_truncated
  @response_body_truncated
end

#response_codeObject (readonly)

Returns the value of attribute response_code.



22
23
24
# File 'lib/gocardless_pro/resources/webhook.rb', line 22

def response_code
  @response_code
end

#response_headersObject (readonly)

Returns the value of attribute response_headers.



23
24
25
# File 'lib/gocardless_pro/resources/webhook.rb', line 23

def response_headers
  @response_headers
end

#response_headers_content_truncatedObject (readonly)

Returns the value of attribute response_headers_content_truncated.



24
25
26
# File 'lib/gocardless_pro/resources/webhook.rb', line 24

def response_headers_content_truncated
  @response_headers_content_truncated
end

#response_headers_count_truncatedObject (readonly)

Returns the value of attribute response_headers_count_truncated.



25
26
27
# File 'lib/gocardless_pro/resources/webhook.rb', line 25

def response_headers_count_truncated
  @response_headers_count_truncated
end

#successfulObject (readonly)

Returns the value of attribute successful.



26
27
28
# File 'lib/gocardless_pro/resources/webhook.rb', line 26

def successful
  @successful
end

#urlObject (readonly)

Returns the value of attribute url.



27
28
29
# File 'lib/gocardless_pro/resources/webhook.rb', line 27

def url
  @url
end

Instance Method Details

#api_responseObject



50
51
52
# File 'lib/gocardless_pro/resources/webhook.rb', line 50

def api_response
  ApiResponse.new(@response)
end

#to_hObject

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



55
56
57
# File 'lib/gocardless_pro/resources/webhook.rb', line 55

def to_h
  @object
end