Skip to content

Commit

Permalink
Merge pull request #93 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Template changes
  • Loading branch information
kevthanewversi authored Nov 30, 2021
2 parents 7c6988c + 0fa7cf3 commit 28d8373
Show file tree
Hide file tree
Showing 36 changed files with 1,763 additions and 31 deletions.
3 changes: 3 additions & 0 deletions lib/gocardless_pro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ module GoCardlessPro
require_relative 'gocardless_pro/resources/billing_request_template'
require_relative 'gocardless_pro/services/billing_request_templates_service'

require_relative 'gocardless_pro/resources/block'
require_relative 'gocardless_pro/services/blocks_service'

require_relative 'gocardless_pro/resources/creditor'
require_relative 'gocardless_pro/services/creditors_service'

Expand Down
7 changes: 6 additions & 1 deletion lib/gocardless_pro/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def billing_request_templates
@billing_request_templates ||= Services::BillingRequestTemplatesService.new(@api_service)
end

# Access to the service for block to make API calls
def blocks
@blocks ||= Services::BlocksService.new(@api_service)
end

# Access to the service for creditor to make API calls
def creditors
@creditors ||= Services::CreditorsService.new(@api_service)
Expand Down Expand Up @@ -193,7 +198,7 @@ def default_options
'User-Agent' => user_agent.to_s,
'Content-Type' => 'application/json',
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
'GoCardless-Client-Version' => '2.28.0',
'GoCardless-Client-Version' => '2.29.0',
},
}
end
Expand Down
4 changes: 0 additions & 4 deletions lib/gocardless_pro/resources/bank_authorisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ def billing_request
def institution
@links['institution']
end

def payment_request
@links['payment_request']
end
end
end
end
Expand Down
66 changes: 66 additions & 0 deletions lib/gocardless_pro/resources/block.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# encoding: utf-8

#
# This client is automatically generated from a template and JSON schema definition.
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
#

require 'uri'

module GoCardlessPro
# A module containing classes for each of the resources in the GC Api
module Resources
# Represents an instance of a block resource returned from the API

# A block object is a simple rule, when matched, pushes a newly created
# mandate to a blocked state. These details can be an exact match, 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. Payments and subscriptions can't be created against mandates in
# blocked state.
#
# <p class="notice">
# Client libraries have not yet been updated for this API but will be
# released soon.
# This API is currently only available for approved integrators - please
# <a href="mailto:[email protected]">get in touch</a> if you would like to
# use this API.
# </p>
class Block
attr_reader :active
attr_reader :block_type
attr_reader :created_at
attr_reader :id
attr_reader :reason_description
attr_reader :reason_type
attr_reader :resource_reference
attr_reader :updated_at

# Initialize a block resource instance
# @param object [Hash] an object returned from the API
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

def api_response
ApiResponse.new(@response)
end

# Provides the block resource as a hash of all its readable attributes
def to_h
@object
end
end
end
end
20 changes: 20 additions & 0 deletions lib/gocardless_pro/resources/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ def initialize(links)
@links = links || {}
end

def bank_authorisation
@links['bank_authorisation']
end

def billing_request
@links['billing_request']
end

def billing_request_flow
@links['billing_request_flow']
end

def creditor
@links['creditor']
end
Expand All @@ -80,6 +92,10 @@ def mandate
@links['mandate']
end

def mandate_request_mandate
@links['mandate_request_mandate']
end

def new_customer_bank_account
@links['new_customer_bank_account']
end
Expand All @@ -104,6 +120,10 @@ def payment
@links['payment']
end

def payment_request_payment
@links['payment_request_payment']
end

def payout
@links['payout']
end
Expand Down
2 changes: 2 additions & 0 deletions lib/gocardless_pro/resources/institution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Resources
# Institutions that are supported when creating [Bank
# Authorisations](#billing-requests-bank-authorisations).
class Institution
attr_reader :country_code
attr_reader :icon_url
attr_reader :id
attr_reader :logo_url
Expand All @@ -25,6 +26,7 @@ class Institution
def initialize(object, response = nil)
@object = object

@country_code = object['country_code']
@icon_url = object['icon_url']
@id = object['id']
@logo_url = object['logo_url']
Expand Down
2 changes: 2 additions & 0 deletions lib/gocardless_pro/resources/redirect_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class RedirectFlow
attr_reader :created_at
attr_reader :description
attr_reader :id
attr_reader :mandate_reference
attr_reader :metadata
attr_reader :redirect_url
attr_reader :scheme
Expand All @@ -65,6 +66,7 @@ def initialize(object, response = nil)
@description = object['description']
@id = object['id']
@links = object['links']
@mandate_reference = object['mandate_reference']
@metadata = object['metadata']
@redirect_url = object['redirect_url']
@scheme = object['scheme']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def list(options = {})
)
end

# Get a lazily enumerated list of all the items returned. This is simmilar to the `list` method but will paginate for you automatically.
# Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically.
#
# @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters.
# Otherwise they will be the body of the request.
Expand Down Expand Up @@ -93,12 +93,12 @@ def create(options = {})

# Updates a Billing Request Template, which will affect all future Billing
# Requests created by this template.
# Example URL: /billing_requests/:identity
# Example URL: /billing_request_templates/:identity
#
# @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/billing_requests/:identity', 'identity' => identity)
path = sub_url('/billing_request_templates/:identity', 'identity' => identity)

params = options.delete(:params) || {}
options[:params] = {}
Expand Down
2 changes: 1 addition & 1 deletion lib/gocardless_pro/services/billing_requests_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def list(options = {})
)
end

# Get a lazily enumerated list of all the items returned. This is simmilar to the `list` method but will paginate for you automatically.
# Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically.
#
# @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters.
# Otherwise they will be the body of the request.
Expand Down
Loading

0 comments on commit 28d8373

Please sign in to comment.