Class: Lago::Api::Resources::Customers::Wallets::Metadata
- Inherits:
-
Base
- Object
- Base
- Nested
- Base
- Lago::Api::Resources::Customers::Wallets::Metadata
show all
- Defined in:
- lib/lago/api/resources/customers/wallets/metadata.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#base_api_resource
Methods inherited from Nested
#create, #destroy, #get, #get_all, #initialize, #update
Methods inherited from Base
#create, #destroy, #get, #get_all, #initialize, #root_name, #update
Instance Method Details
#api_resource(customer_id, wallet_code) ⇒ Object
9
10
11
|
# File 'lib/lago/api/resources/customers/wallets/metadata.rb', line 9
def api_resource(customer_id, wallet_code)
"#{base_api_resource(customer_id, wallet_code)}/metadata"
end
|
#delete_all(customer_id, wallet_code) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/lago/api/resources/customers/wallets/metadata.rb', line 29
def delete_all(customer_id, wallet_code)
path = api_resource(customer_id, wallet_code)
response = connection.destroy(path, identifier: nil)
response['metadata']
end
|
#delete_key(customer_id, wallet_code, key) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/lago/api/resources/customers/wallets/metadata.rb', line 36
def delete_key(customer_id, wallet_code, key)
path = api_resource(customer_id, wallet_code)
response = connection.destroy(path, identifier: key)
response['metadata']
end
|
#merge(customer_id, wallet_code, metadata) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/lago/api/resources/customers/wallets/metadata.rb', line 21
def merge(customer_id, wallet_code, metadata)
path = api_resource(customer_id, wallet_code)
payload = { metadata: whitelist_params(metadata) }
response = connection.patch(path, identifier: nil, body: payload)
response['metadata']
end
|
#replace(customer_id, wallet_code, metadata) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/lago/api/resources/customers/wallets/metadata.rb', line 13
def replace(customer_id, wallet_code, metadata)
path = api_resource(customer_id, wallet_code)
payload = { metadata: whitelist_params(metadata) }
response = connection.post(payload, path)
response['metadata']
end
|
#whitelist_params(params) ⇒ Object
43
44
45
|
# File 'lib/lago/api/resources/customers/wallets/metadata.rb', line 43
def whitelist_params(params)
WhitelistParams.new.metadata(params)
end
|