Class: Airwallex::GlobalAccountMandate

Inherits:
APIResource show all
Defined in:
lib/airwallex/resources/global_account_mandate.rb

Overview

Represents a direct debit mandate on a GlobalAccount. Always accessed through its parent GlobalAccount, since its API path is scoped by global_account_id.

Instance Attribute Summary

Attributes inherited from APIResource

#attributes, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResource

#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, #to_hash, #to_json, #to_s

Constructor Details

This class inherits a constructor from Airwallex::APIResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Airwallex::APIResource

Class Method Details

.resource_path(global_account_id) ⇒ String

Returns API resource path for this account's mandates.

Parameters:

  • global_account_id (String)

    the parent GlobalAccount's id

Returns:

  • (String)

    API resource path for this account's mandates



10
11
12
# File 'lib/airwallex/resources/global_account_mandate.rb', line 10

def self.resource_path()
  "/api/v1/global_accounts/#{}/mandates"
end

Instance Method Details

#cancel(params = {}) ⇒ GlobalAccountMandate

Cancel this mandate

Parameters:

  • params (Hash) (defaults to: {})

    additional params

Returns:



18
19
20
21
22
23
24
# File 'lib/airwallex/resources/global_account_mandate.rb', line 18

def cancel(params = {})
  response = Airwallex.client.post(
    "#{self.class.resource_path()}/#{id}/cancel", params
  )
  refresh_from(response)
  self
end