require_relative '../service'
module Adyen
class AccountStoreLevelApi < Service
attr_accessor :service, :version
def initialize(client, version = DEFAULT_VERSION)
super(client, version, 'Management')
end
def create_store(request, headers: {})
endpoint = '/stores'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint)
action = { method: 'post', url: endpoint }
@client.call_adyen_api(@service, action, request, headers, @version)
end
def create_store_by_merchant_id(request, merchant_id, headers: {})
endpoint = '/merchants/{merchantId}/stores'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, merchant_id)
action = { method: 'post', url: endpoint }
@client.call_adyen_api(@service, action, request, headers, @version)
end
def get_store(merchant_id, store_id, headers: {})
endpoint = '/merchants/{merchantId}/stores/{storeId}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, merchant_id, store_id)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def get_store_by_id(store_id, headers: {})
endpoint = '/stores/{storeId}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, store_id)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def list_stores(headers: {}, query_params: {})
endpoint = '/stores'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint)
endpoint += create_query_string(query_params)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def list_stores_by_merchant_id(merchant_id, headers: {}, query_params: {})
endpoint = '/merchants/{merchantId}/stores'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, merchant_id)
endpoint += create_query_string(query_params)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def update_store(request, merchant_id, store_id, headers: {})
endpoint = '/merchants/{merchantId}/stores/{storeId}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, merchant_id, store_id)
action = { method: 'patch', url: endpoint }
@client.call_adyen_api(@service, action, request, headers, @version)
end
def update_store_by_id(request, store_id, headers: {})
endpoint = '/stores/{storeId}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, store_id)
action = { method: 'patch', url: endpoint }
@client.call_adyen_api(@service, action, request, headers, @version)
end
end
end