Class: GoCardlessPro::Resources::Block
- Inherits:
-
Object
- Object
- GoCardlessPro::Resources::Block
- 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
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#block_type ⇒ Object
readonly
Returns the value of attribute block_type.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#reason_description ⇒ Object
readonly
Returns the value of attribute reason_description.
-
#reason_type ⇒ Object
readonly
Returns the value of attribute reason_type.
-
#resource_reference ⇒ Object
readonly
Returns the value of attribute resource_reference.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #api_response ⇒ Object
-
#initialize(object, response = nil) ⇒ Block
constructor
Initialize a block resource instance.
-
#to_h ⇒ Object
Provides the block resource as a hash of all its readable attributes.
Constructor Details
#initialize(object, response = nil) ⇒ Block
Initialize a block resource instance
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
#active ⇒ Object (readonly)
Returns the value of attribute active.
41 42 43 |
# File 'lib/gocardless_pro/resources/block.rb', line 41 def active @active end |
#block_type ⇒ Object (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_at ⇒ Object (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 |
#id ⇒ Object (readonly)
Returns the value of attribute id.
44 45 46 |
# File 'lib/gocardless_pro/resources/block.rb', line 44 def id @id end |
#reason_description ⇒ Object (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_type ⇒ Object (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_reference ⇒ Object (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_at ⇒ Object (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_response ⇒ Object
66 67 68 |
# File 'lib/gocardless_pro/resources/block.rb', line 66 def api_response ApiResponse.new(@response) end |
#to_h ⇒ Object
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 |