Class: GoCardlessPro::Resources::Block

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

Overview

Blocks are created to prevent certain customer details from being used when creating mandates.

The details used to create blocks can be exact matches, like a bank account or an email, or a more generic match such as an email domain. New block types may be added over time.

A block object is in essence a simple rule that is used to match against details in a newly created mandate. If there is a successful match then the mandate is transitioned to a “blocked” state.

Payments and subscriptions cannot be created against a mandate in blocked state.

A mandate can never be transitioned out of the blocked state.

<p class=“notice”>

This API is currently only available for approved integrators - please

<a href=“[email protected]”>get in touch</a> if you would like to use this API. </p>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ Block

Initialize a block resource instance

Parameters:

  • object (Hash)

    an object returned from the API



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/gocardless_pro/resources/block.rb', line 52

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

  @active = object['active']
  @block_type = object['block_type']
  @created_at = object['created_at']
  @id = object['id']
  @reason_description = object['reason_description']
  @reason_type = object['reason_type']
  @resource_reference = object['resource_reference']
  @updated_at = object['updated_at']
  @response = response
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



41
42
43
# File 'lib/gocardless_pro/resources/block.rb', line 41

def active
  @active
end

#block_typeObject (readonly)

Returns the value of attribute block_type.



42
43
44
# File 'lib/gocardless_pro/resources/block.rb', line 42

def block_type
  @block_type
end

#created_atObject (readonly)

Returns the value of attribute created_at.



43
44
45
# File 'lib/gocardless_pro/resources/block.rb', line 43

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#reason_descriptionObject (readonly)

Returns the value of attribute reason_description.



45
46
47
# File 'lib/gocardless_pro/resources/block.rb', line 45

def reason_description
  @reason_description
end

#reason_typeObject (readonly)

Returns the value of attribute reason_type.



46
47
48
# File 'lib/gocardless_pro/resources/block.rb', line 46

def reason_type
  @reason_type
end

#resource_referenceObject (readonly)

Returns the value of attribute resource_reference.



47
48
49
# File 'lib/gocardless_pro/resources/block.rb', line 47

def resource_reference
  @resource_reference
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



48
49
50
# File 'lib/gocardless_pro/resources/block.rb', line 48

def updated_at
  @updated_at
end

Instance Method Details

#api_responseObject



66
67
68
# File 'lib/gocardless_pro/resources/block.rb', line 66

def api_response
  ApiResponse.new(@response)
end

#to_hObject

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



71
72
73
# File 'lib/gocardless_pro/resources/block.rb', line 71

def to_h
  @object
end