Module: Airwallex::APIOperations::Update

Included in:
Customer, Customer, PaymentIntent, PaymentMethod, PaymentMethod
Defined in:
lib/airwallex/api_operations/update.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/airwallex/api_operations/update.rb', line 6

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#saveObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/airwallex/api_operations/update.rb', line 31

def save
  return self unless dirty?

  # Only send changed attributes
  params = {}
  changed_attributes.each do |attr|
    params[attr] = @attributes[attr]
  end

  update(params)
end

#update(params = {}) ⇒ Object

Instance methods



22
23
24
25
26
27
28
29
# File 'lib/airwallex/api_operations/update.rb', line 22

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