Class: Airwallex::AccountAmendment

Inherits:
APIResource show all
Extended by:
Airwallex::APIOperations::Create, Airwallex::APIOperations::Retrieve
Defined in:
lib/airwallex/resources/account_amendment.rb

Overview

Represents an amendment to whichever account the request is authenticated as (the platform's own account, or a connected account via x-on-behalf-of). Not nested under /accounts/Airwallex::APIResource#id — scoped implicitly by auth context, same as ConnectedAccount.current.

.create requires Admin-level API key permissions, a separate tier from the normal per-resource Read/Write scopes.

Examples:

Submit an amendment

# `target` identifies the dotted path being amended; the changed
# section is a top-level sibling keyed by its own name (e.g.
# store_details), not wrapped in a generic "changes" key.
amendment = Airwallex::AccountAmendment.create(
  target: "account_details.store_details",
  store_details: { store_name: "New Store Name" }
)

Constant Summary collapse

SIMULATION_PATH =
"/api/v1/simulation/account/amendments"

Instance Attribute Summary

Attributes inherited from APIResource

#attributes, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Airwallex::APIOperations::Create

create

Methods included from Airwallex::APIOperations::Retrieve

retrieve

Methods inherited from APIResource

#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, symbolized_get, symbolized_post, #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 ⇒ String

Returns API resource path for account amendments.

Returns:

  • (String) —

    API resource path for account amendments



28
29
30
# File 'lib/airwallex/resources/account_amendment.rb', line 28

def self.resource_path
  "/api/v1/account/amendments"
end

.simulate_approve(amendment_id) ⇒ AccountAmendment

Simulate approving a PENDING amendment

Parameters:

  • amendment_id (String)

Returns:



36
37
38
39
# File 'lib/airwallex/resources/account_amendment.rb', line 36

def self.simulate_approve(amendment_id)
  response = Airwallex.client.post("#{SIMULATION_PATH}/#{amendment_id}/approve", {})
  new(response)
end

.simulate_reject(amendment_id) ⇒ AccountAmendment

Simulate rejecting a PENDING amendment

Parameters:

  • amendment_id (String)

Returns:



45
46
47
48
# File 'lib/airwallex/resources/account_amendment.rb', line 45

def self.simulate_reject(amendment_id)
  response = Airwallex.client.post("#{SIMULATION_PATH}/#{amendment_id}/reject", {})
  new(response)
end

Instance Method Details

#simulate_approve ⇒ AccountAmendment

Simulate approving this amendment

Returns:



53
54
55
56
57
# File 'lib/airwallex/resources/account_amendment.rb', line 53

def simulate_approve
  response = Airwallex.client.post("#{self.class::SIMULATION_PATH}/#{id}/approve", {})
  refresh_from(response)
  self
end

#simulate_reject ⇒ AccountAmendment

Simulate rejecting this amendment

Returns:



62
63
64
65
66
# File 'lib/airwallex/resources/account_amendment.rb', line 62

def simulate_reject
  response = Airwallex.client.post("#{self.class::SIMULATION_PATH}/#{id}/reject", {})
  refresh_from(response)
  self
end