Class: Adyen::AccountStoreLevelApi

Inherits:
Service
  • Object
show all
Defined in:
lib/adyen/services/management/account_store_level_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

action_for_method_name, #create_query_string

Constructor Details

#initialize(client, version = DEFAULT_VERSION) ⇒ AccountStoreLevelApi

Returns a new instance of AccountStoreLevelApi.



6
7
8
# File 'lib/adyen/services/management/account_store_level_api.rb', line 6

def initialize(client, version = DEFAULT_VERSION)
  super(client, version, 'Management')
end

Instance Attribute Details

#serviceObject

Returns the value of attribute service.



4
5
6
# File 'lib/adyen/services/management/account_store_level_api.rb', line 4

def service
  @service
end

#versionObject

Returns the value of attribute version.



4
5
6
# File 'lib/adyen/services/management/account_store_level_api.rb', line 4

def version
  @version
end

Instance Method Details

#create_store(request, headers: {}) ⇒ Object



73
74
75
76
77
78
79
80
# File 'lib/adyen/services/management/account_store_level_api.rb', line 73

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

#create_store_by_merchant_id(request, merchant_id, headers: {}) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/adyen/services/management/account_store_level_api.rb', line 64

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

#get_store(merchant_id, store_id, headers: {}) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/adyen/services/management/account_store_level_api.rb', line 19

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

#get_store_by_id(store_id, headers: {}) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/adyen/services/management/account_store_level_api.rb', line 37

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

#list_stores(headers: {}, query_params: {}) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/adyen/services/management/account_store_level_api.rb', line 28

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

#list_stores_by_merchant_id(merchant_id, headers: {}, query_params: {}) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/adyen/services/management/account_store_level_api.rb', line 10

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

#update_store(request, merchant_id, store_id, headers: {}) ⇒ Object



46
47
48
49
50
51
52
53
# File 'lib/adyen/services/management/account_store_level_api.rb', line 46

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

#update_store_by_id(request, store_id, headers: {}) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/adyen/services/management/account_store_level_api.rb', line 55

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