Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template changes #131

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/gocardless_pro/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ def default_options
'User-Agent' => "#{user_agent}",
'Content-Type' => 'application/json',
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
'GoCardless-Client-Version' => '2.57.0',
},
'GoCardless-Client-Version' => '3.0.0'
}
}
end

Expand All @@ -254,7 +254,7 @@ def user_agent
comment = [
"#{ruby_engine}/#{ruby_version}",
"#{RUBY_ENGINE}/#{interpreter_version}",
"#{RUBY_PLATFORM}",
"#{RUBY_PLATFORM}"
]
comment << "faraday/#{Faraday::VERSION}"
"#{gem_info} #{comment.join(' ')}"
Expand Down
6 changes: 3 additions & 3 deletions lib/gocardless_pro/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def message

def to_s
if errors.any?
errors.
map { |err| "#{err['field']} #{err['message']}" }.
join(', ')
errors
.map { |err| "#{err['field']} #{err['message']}" }
.join(', ')
else
@error['message']
end
Expand Down
6 changes: 3 additions & 3 deletions lib/gocardless_pro/middlewares/raise_gocardless_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def error_class_for_status(code)
{
401 => GoCardlessPro::AuthenticationError,
403 => GoCardlessPro::PermissionError,
429 => GoCardlessPro::RateLimitError,
429 => GoCardlessPro::RateLimitError
}.fetch(code, nil)
end

Expand All @@ -35,7 +35,7 @@ def error_class_for_type(type)
validation_failed: GoCardlessPro::ValidationError,
gocardless: GoCardlessPro::GoCardlessError,
invalid_api_usage: GoCardlessPro::InvalidApiUsageError,
invalid_state: GoCardlessPro::InvalidStateError,
invalid_state: GoCardlessPro::InvalidStateError
}.fetch(type.to_sym)
end

Expand All @@ -45,7 +45,7 @@ def generate_error_data(env)
"code: #{env.status}\n" \
"headers: #{env.response_headers}\n" \
"body: #{env.body}",
'code' => env.status,
'code' => env.status
}
end

Expand Down
11 changes: 2 additions & 9 deletions lib/gocardless_pro/resources/bank_authorisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,8 @@ module Resources
# (see Billing Request Flows) to ensure we meet regulatory requirements for
# checkout flows.
class BankAuthorisation
attr_reader :authorisation_type
attr_reader :authorised_at
attr_reader :created_at
attr_reader :expires_at
attr_reader :id
attr_reader :last_visited_at
attr_reader :qr_code_url
attr_reader :redirect_uri
attr_reader :url
attr_reader :authorisation_type, :authorised_at, :created_at, :expires_at, :id, :last_visited_at, :qr_code_url,
:redirect_uri, :url

# Initialize a bank_authorisation resource instance
# @param object [Hash] an object returned from the API
Expand Down
4 changes: 1 addition & 3 deletions lib/gocardless_pro/resources/bank_details_lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ module Resources

# Look up the name and reachability of a bank account.
class BankDetailsLookup
attr_reader :available_debit_schemes
attr_reader :bank_name
attr_reader :bic
attr_reader :available_debit_schemes, :bank_name, :bic

# Initialize a bank_details_lookup resource instance
# @param object [Hash] an object returned from the API
Expand Down
17 changes: 7 additions & 10 deletions lib/gocardless_pro/resources/billing_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,8 @@ module Resources
# Overview](https://developer.gocardless.com/getting-started/billing-requests/overview/)
# for how-to's, explanations and tutorials.
class BillingRequest
attr_reader :actions
attr_reader :created_at
attr_reader :fallback_enabled
attr_reader :id
attr_reader :mandate_request
attr_reader :metadata
attr_reader :payment_request
attr_reader :purpose_code
attr_reader :resources
attr_reader :status
attr_reader :actions, :created_at, :fallback_enabled, :id, :mandate_request, :metadata, :payment_request,
:purpose_code, :resources, :status, :subscription_request

# Initialize a billing_request resource instance
# @param object [Hash] an object returned from the API
Expand All @@ -47,6 +39,7 @@ def initialize(object, response = nil)
@purpose_code = object['purpose_code']
@resources = object['resources']
@status = object['status']
@subscription_request = object['subscription_request']
@response = response
end

Expand Down Expand Up @@ -112,6 +105,10 @@ def payment_request
def payment_request_payment
@links['payment_request_payment']
end

def subscription_request
@links['subscription_request']
end
end
end
end
Expand Down
19 changes: 2 additions & 17 deletions lib/gocardless_pro/resources/billing_request_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,8 @@ module Resources
# payment created for a scheme with strong payer
# authorisation (such as open banking single payments).
class BillingRequestFlow
attr_reader :authorisation_url
attr_reader :auto_fulfil
attr_reader :created_at
attr_reader :customer_details_captured
attr_reader :exit_uri
attr_reader :expires_at
attr_reader :id
attr_reader :language
attr_reader :lock_bank_account
attr_reader :lock_currency
attr_reader :lock_customer_details
attr_reader :prefilled_bank_account
attr_reader :prefilled_customer
attr_reader :redirect_uri
attr_reader :session_token
attr_reader :show_redirect_buttons
attr_reader :show_success_redirect_button
attr_reader :authorisation_url, :auto_fulfil, :created_at, :customer_details_captured, :exit_uri, :expires_at,
:id, :language, :lock_bank_account, :lock_currency, :lock_customer_details, :prefilled_bank_account, :prefilled_customer, :redirect_uri, :session_token, :show_redirect_buttons, :show_success_redirect_button

# Initialize a billing_request_flow resource instance
# @param object [Hash] an object returned from the API
Expand Down
19 changes: 2 additions & 17 deletions lib/gocardless_pro/resources/billing_request_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,8 @@ module Resources
# for single-use and is designed to cater to the unique needs of individual
# customers.
class BillingRequestTemplate
attr_reader :authorisation_url
attr_reader :created_at
attr_reader :id
attr_reader :mandate_request_currency
attr_reader :mandate_request_description
attr_reader :mandate_request_metadata
attr_reader :mandate_request_scheme
attr_reader :mandate_request_verify
attr_reader :metadata
attr_reader :name
attr_reader :payment_request_amount
attr_reader :payment_request_currency
attr_reader :payment_request_description
attr_reader :payment_request_metadata
attr_reader :payment_request_scheme
attr_reader :redirect_uri
attr_reader :updated_at
attr_reader :authorisation_url, :created_at, :id, :mandate_request_currency, :mandate_request_description,
:mandate_request_metadata, :mandate_request_scheme, :mandate_request_verify, :metadata, :name, :payment_request_amount, :payment_request_currency, :payment_request_description, :payment_request_metadata, :payment_request_scheme, :redirect_uri, :updated_at

# Initialize a billing_request_template resource instance
# @param object [Hash] an object returned from the API
Expand Down
10 changes: 2 additions & 8 deletions lib/gocardless_pro/resources/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,8 @@ module Resources
# 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
attr_reader :active, :block_type, :created_at, :id, :reason_description, :reason_type, :resource_reference,
:updated_at

# Initialize a block resource instance
# @param object [Hash] an object returned from the API
Expand Down
22 changes: 2 additions & 20 deletions lib/gocardless_pro/resources/creditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,8 @@ module Resources
# Currently, for Anti Money Laundering reasons, any creditors you add must
# be directly related to your organisation.
class Creditor
attr_reader :address_line1
attr_reader :address_line2
attr_reader :address_line3
attr_reader :bank_reference_prefix
attr_reader :can_create_refunds
attr_reader :city
attr_reader :country_code
attr_reader :created_at
attr_reader :creditor_type
attr_reader :custom_payment_pages_enabled
attr_reader :fx_payout_currency
attr_reader :id
attr_reader :logo_url
attr_reader :mandate_imports_enabled
attr_reader :merchant_responsible_for_notifications
attr_reader :name
attr_reader :postal_code
attr_reader :region
attr_reader :scheme_identifiers
attr_reader :verification_status
attr_reader :address_line1, :address_line2, :address_line3, :bank_reference_prefix, :can_create_refunds, :city,
:country_code, :created_at, :creditor_type, :custom_payment_pages_enabled, :fx_payout_currency, :id, :logo_url, :mandate_imports_enabled, :merchant_responsible_for_notifications, :name, :postal_code, :region, :scheme_identifiers, :verification_status

# Initialize a creditor resource instance
# @param object [Hash] an object returned from the API
Expand Down
13 changes: 2 additions & 11 deletions lib/gocardless_pro/resources/creditor_bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,8 @@ module Resources
# <p class="restricted-notice"><strong>Restricted</strong>: This API is not
# available for partner integrations.</p>
class CreditorBankAccount
attr_reader :account_holder_name
attr_reader :account_number_ending
attr_reader :account_type
attr_reader :bank_name
attr_reader :country_code
attr_reader :created_at
attr_reader :currency
attr_reader :enabled
attr_reader :id
attr_reader :metadata
attr_reader :verification_status
attr_reader :account_holder_name, :account_number_ending, :account_type, :bank_name, :country_code, :created_at,
:currency, :enabled, :id, :metadata, :verification_status

# Initialize a creditor_bank_account resource instance
# @param object [Hash] an object returned from the API
Expand Down
5 changes: 1 addition & 4 deletions lib/gocardless_pro/resources/currency_exchange_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ module Resources

# Currency exchange rates from our foreign exchange provider.
class CurrencyExchangeRate
attr_reader :rate
attr_reader :source
attr_reader :target
attr_reader :time
attr_reader :rate, :source, :target, :time

# Initialize a currency_exchange_rate resource instance
# @param object [Hash] an object returned from the API
Expand Down
20 changes: 2 additions & 18 deletions lib/gocardless_pro/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,8 @@ module Resources
# accounts](#core-endpoints-customer-bank-accounts), which in turn can have
# several Direct Debit [mandates](#core-endpoints-mandates).
class Customer
attr_reader :address_line1
attr_reader :address_line2
attr_reader :address_line3
attr_reader :city
attr_reader :company_name
attr_reader :country_code
attr_reader :created_at
attr_reader :danish_identity_number
attr_reader :email
attr_reader :family_name
attr_reader :given_name
attr_reader :id
attr_reader :language
attr_reader :metadata
attr_reader :phone_number
attr_reader :postal_code
attr_reader :region
attr_reader :swedish_identity_number
attr_reader :address_line1, :address_line2, :address_line3, :city, :company_name, :country_code, :created_at,
:danish_identity_number, :email, :family_name, :given_name, :id, :language, :metadata, :phone_number, :postal_code, :region, :swedish_identity_number

# Initialize a customer resource instance
# @param object [Hash] an object returned from the API
Expand Down
13 changes: 3 additions & 10 deletions lib/gocardless_pro/resources/customer_bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,8 @@ module Resources
# [bank_details_lookups](#bank-details-lookups-perform-a-bank-details-lookup),
# before proceeding with creating the accounts
class CustomerBankAccount
attr_reader :account_holder_name
attr_reader :account_number_ending
attr_reader :account_type
attr_reader :bank_name
attr_reader :country_code
attr_reader :created_at
attr_reader :currency
attr_reader :enabled
attr_reader :id
attr_reader :metadata
attr_reader :account_holder_name, :account_number_ending, :account_type, :bank_account_token, :bank_name,
:country_code, :created_at, :currency, :enabled, :id, :metadata

# Initialize a customer_bank_account resource instance
# @param object [Hash] an object returned from the API
Expand All @@ -47,6 +39,7 @@ def initialize(object, response = nil)
@account_holder_name = object['account_holder_name']
@account_number_ending = object['account_number_ending']
@account_type = object['account_type']
@bank_account_token = object['bank_account_token']
@bank_name = object['bank_name']
@country_code = object['country_code']
@created_at = object['created_at']
Expand Down
6 changes: 1 addition & 5 deletions lib/gocardless_pro/resources/customer_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ module Resources
# href="mailto:[email protected]">get in touch</a> if you would like to
# use this API.</p>
class CustomerNotification
attr_reader :action_taken
attr_reader :action_taken_at
attr_reader :action_taken_by
attr_reader :id
attr_reader :type
attr_reader :action_taken, :action_taken_at, :action_taken_by, :id, :type

# Initialize a customer_notification resource instance
# @param object [Hash] an object returned from the API
Expand Down
10 changes: 2 additions & 8 deletions lib/gocardless_pro/resources/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ module Resources
# corresponding event getting included in API responses. See
# [here](#event-actions) for a complete list of event types.
class Event
attr_reader :action
attr_reader :created_at
attr_reader :customer_notifications
attr_reader :details
attr_reader :id
attr_reader :metadata
attr_reader :resource_metadata
attr_reader :resource_type
attr_reader :action, :created_at, :customer_notifications, :details, :id, :metadata, :resource_metadata,
:resource_type

# Initialize a event resource instance
# @param object [Hash] an object returned from the API
Expand Down
6 changes: 1 addition & 5 deletions lib/gocardless_pro/resources/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ module Resources

# File-based exports of data
class Export
attr_reader :created_at
attr_reader :currency
attr_reader :download_url
attr_reader :export_type
attr_reader :id
attr_reader :created_at, :currency, :download_url, :export_type, :id

# Initialize a export resource instance
# @param object [Hash] an object returned from the API
Expand Down
9 changes: 1 addition & 8 deletions lib/gocardless_pro/resources/instalment_schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ module Resources
# of collection.
#
class InstalmentSchedule
attr_reader :created_at
attr_reader :currency
attr_reader :id
attr_reader :metadata
attr_reader :name
attr_reader :payment_errors
attr_reader :status
attr_reader :total_amount
attr_reader :created_at, :currency, :id, :metadata, :name, :payment_errors, :status, :total_amount

# Initialize a instalment_schedule resource instance
# @param object [Hash] an object returned from the API
Expand Down
7 changes: 1 addition & 6 deletions lib/gocardless_pro/resources/institution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ module Resources
# Not all institutions support both Payment Initiation (PIS) and Account
# Information (AIS) services.
class Institution
attr_reader :autocompletes_collect_bank_account
attr_reader :country_code
attr_reader :icon_url
attr_reader :id
attr_reader :logo_url
attr_reader :name
attr_reader :autocompletes_collect_bank_account, :country_code, :icon_url, :id, :logo_url, :name

# Initialize a institution resource instance
# @param object [Hash] an object returned from the API
Expand Down
Loading
Loading