snap_business 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/snap_business/api/conversion_api.rb +244 -0
- data/lib/snap_business/api/default_api.rb +266 -0
- data/lib/snap_business/api_client.rb +428 -0
- data/lib/snap_business/api_error.rb +57 -0
- data/lib/snap_business/configuration.rb +318 -0
- data/lib/snap_business/models/capi_event.rb +590 -0
- data/lib/snap_business/models/capi_event_ext.rb +58 -0
- data/lib/snap_business/models/response.rb +237 -0
- data/lib/snap_business/models/response_error_records.rb +228 -0
- data/lib/snap_business/models/response_logs.rb +237 -0
- data/lib/snap_business/models/response_logs_log.rb +284 -0
- data/lib/snap_business/models/response_stats.rb +235 -0
- data/lib/snap_business/models/response_stats_data.rb +226 -0
- data/lib/snap_business/models/response_stats_test.rb +226 -0
- data/lib/snap_business/models/test_response.rb +259 -0
- data/lib/snap_business/models/validated_fields.rb +226 -0
- data/lib/snap_business/models/validated_fields_items.rb +262 -0
- data/lib/snap_business/models/validated_fields_validated_fields.rb +262 -0
- data/lib/snap_business/util/capi_hash.rb +61 -0
- data/lib/snap_business/util/constants.rb +16 -0
- data/lib/snap_business/version.rb +15 -0
- data/lib/snap_business.rb +52 -0
- data/spec/api/conversion_api_spec.rb +203 -0
- data/spec/api/default_api_spec.rb +45 -0
- data/spec/api_client_spec.rb +188 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/capi_event_spec.rb +127 -0
- data/spec/spec_helper.rb +111 -0
- data/spec/util/capi_hash_spec.rb +62 -0
- metadata +178 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e44e1b1969ef6262afe8131d70bc0a09eba90569ce3bafdd6816304242781704
|
4
|
+
data.tar.gz: cbed17683de06c931200188a3c9a62a8044993017e0cbe5da858922aa4e0ea32
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e38542907ffdccab41f2412a3bd5e7888b02832e0c41b98d2b5abcb76c6f1dc798e37e7d81014586f53ac570285cb138dca917fea14e677abc72a14cca738f93
|
7
|
+
data.tar.gz: c0be57a7ab1f309b3ff578cf72c5c557f1a543218a676c00ddb01bbe5793960742b9d6037dee80d68e9906b079d0a78d05eda5214d1c7cdec043ed53ee440471
|
@@ -0,0 +1,244 @@
|
|
1
|
+
require 'concurrent'
|
2
|
+
require_relative '../util/constants'
|
3
|
+
|
4
|
+
module SnapBusinessSDK
|
5
|
+
class ConversionApi
|
6
|
+
attr_reader :use_launchpad
|
7
|
+
attr_accessor :config
|
8
|
+
attr_accessor :client
|
9
|
+
attr_accessor :default_api
|
10
|
+
|
11
|
+
# Creates a CAPI object to send conversion events with
|
12
|
+
#
|
13
|
+
# @param [String] long_lived_token token for authentication
|
14
|
+
# @option opts [String] :launchpad_url endpoint for launchpand
|
15
|
+
# @option opts [Boolean] :test_mode send events to test endpoints or not
|
16
|
+
# @option opts [Boolean] :is_debugging enable debugging logs
|
17
|
+
# @option opts [Logger] :logger custom logger
|
18
|
+
def initialize(long_lived_token, opts = {})
|
19
|
+
@is_debugging = false
|
20
|
+
@use_launchpad = false
|
21
|
+
|
22
|
+
@config = Configuration.new
|
23
|
+
config.access_token = long_lived_token
|
24
|
+
@client = ApiClient.new config
|
25
|
+
client.user_agent = SnapBusinessSDK::Constants::USER_AGENT
|
26
|
+
client.default_headers[SnapBusinessSDK::Constants::METRICS_HEADER] = SnapBusinessSDK::Constants::METRICS_HEADER_VALUE
|
27
|
+
client.default_headers['accept-encoding'] = ''
|
28
|
+
|
29
|
+
if opts.key?(:'is_debugging')
|
30
|
+
self.is_debugging = opts[:'is_debugging']
|
31
|
+
end
|
32
|
+
|
33
|
+
if opts.key?(:'launchpad_url')
|
34
|
+
set_launchpad_url opts[:'launchpad_url']
|
35
|
+
end
|
36
|
+
|
37
|
+
if opts.key?(:'logger')
|
38
|
+
self.logger = opts[:'logger']
|
39
|
+
end
|
40
|
+
|
41
|
+
# override host for certain endpoints
|
42
|
+
@config.server_operation_index = {
|
43
|
+
"DefaultApi.send_data": nil,
|
44
|
+
"DefaultApi.send_test_data": nil,
|
45
|
+
"DefaultApi.conversion_validate_logs": nil,
|
46
|
+
"DefaultApi.conversion_validate_stats": nil,
|
47
|
+
}
|
48
|
+
|
49
|
+
@default_api = DefaultApi.new client
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Boolean]
|
53
|
+
def is_debugging
|
54
|
+
config.debugging
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [Logger]
|
58
|
+
def logger
|
59
|
+
config.logger
|
60
|
+
end
|
61
|
+
|
62
|
+
# Send a single conversion event to CAPI asynchronously
|
63
|
+
#
|
64
|
+
# @param [CapiEvent] capi_event
|
65
|
+
# @return [Concurrent::Promise]
|
66
|
+
def send_event(capi_event)
|
67
|
+
send_events [capi_event]
|
68
|
+
end
|
69
|
+
|
70
|
+
# Send multiple conversion event to CAPI asynchronously
|
71
|
+
#
|
72
|
+
# @param [Array<CapiEvent>] capi_events
|
73
|
+
# @return [Concurrent::Promise]
|
74
|
+
def send_events(capi_events)
|
75
|
+
Concurrent::Promise.execute do
|
76
|
+
send_events_sync(capi_events)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Send a single conversion event to CAPI synchronously
|
81
|
+
#
|
82
|
+
# @param [CapiEvent] capi_event
|
83
|
+
# @return [Response]
|
84
|
+
def send_event_sync(capi_event)
|
85
|
+
send_events_sync [capi_event]
|
86
|
+
end
|
87
|
+
|
88
|
+
# Send multiple conversion event to CAPI synchronously
|
89
|
+
#
|
90
|
+
# @param [Array<CapiEvent>] capi_events
|
91
|
+
# @return [Response]
|
92
|
+
def send_events_sync(capi_events)
|
93
|
+
headers = {}
|
94
|
+
if use_launchpad
|
95
|
+
headers[SnapBusinessSDK::Constants::CAPI_PATH_HEADER] = SnapBusinessSDK::Constants::CAPI_PATH
|
96
|
+
end
|
97
|
+
|
98
|
+
capi_events.each do |event|
|
99
|
+
if is_debugging
|
100
|
+
logger.info "[Snap Business SDK] Sending event: #{event.to_s}"
|
101
|
+
end
|
102
|
+
event.integration = SnapBusinessSDK::Constants::INTEGRATION_SDK
|
103
|
+
end
|
104
|
+
|
105
|
+
begin
|
106
|
+
@default_api.send_data body: capi_events, header_params: headers
|
107
|
+
rescue SnapBusinessSDK::ApiError => error
|
108
|
+
if is_debugging
|
109
|
+
logger.error "[Snap Business SDK] Failed to send event: #{error.to_s}"
|
110
|
+
end
|
111
|
+
SnapBusinessSDK::Response.new status: error.code.to_s, reason: error.response_body
|
112
|
+
rescue => error
|
113
|
+
if is_debugging
|
114
|
+
logger.error "[Snap Business SDK] Exception occured: #{error.to_s}"
|
115
|
+
end
|
116
|
+
SnapBusinessSDK::Response.new status: 'FAILED', reason: error.to_s
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Send a single conversion event to CAPI synchronously
|
121
|
+
#
|
122
|
+
# @param [CapiEvent] capi_event
|
123
|
+
# @return [TestResponse]
|
124
|
+
def send_test_event(capi_event)
|
125
|
+
send_test_events [capi_event]
|
126
|
+
end
|
127
|
+
|
128
|
+
# Send multiple test conversion event to CAPI synchronously
|
129
|
+
#
|
130
|
+
# @param [Array<CapiEvent>] capi_events
|
131
|
+
# @return [TestResponse]
|
132
|
+
def send_test_events(capi_events)
|
133
|
+
headers = {}
|
134
|
+
if use_launchpad
|
135
|
+
headers[SnapBusinessSDK::Constants::CAPI_PATH_HEADER] = SnapBusinessSDK::Constants::CAPI_PATH_TEST
|
136
|
+
end
|
137
|
+
|
138
|
+
capi_events.each do |event|
|
139
|
+
if is_debugging
|
140
|
+
logger.info "[Snap Business SDK] Sending test event: #{event.to_s}"
|
141
|
+
end
|
142
|
+
event.integration = SnapBusinessSDK::Constants::INTEGRATION_SDK
|
143
|
+
end
|
144
|
+
|
145
|
+
begin
|
146
|
+
@default_api.send_test_data body: capi_events, header_params: headers
|
147
|
+
rescue SnapBusinessSDK::ApiError => error
|
148
|
+
if is_debugging
|
149
|
+
logger.error "[Snap Business SDK] Failed to send test event: #{error.to_s}"
|
150
|
+
end
|
151
|
+
SnapBusinessSDK::TestResponse.new status: error.code.to_s, reason: error.response_body
|
152
|
+
rescue => error
|
153
|
+
if is_debugging
|
154
|
+
logger.error "[Snap Business SDK] Exception occured: #{error.to_s}"
|
155
|
+
end
|
156
|
+
SnapBusinessSDK::TestResponse.new status: 'FAILED', reason: error.to_s
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# Get test event logs
|
161
|
+
#
|
162
|
+
# @param [String] asset_id
|
163
|
+
# @return [ResponseLogs]
|
164
|
+
def get_test_event_logs(asset_id)
|
165
|
+
headers = {}
|
166
|
+
|
167
|
+
begin
|
168
|
+
@default_api.conversion_validate_logs asset_id, header_params: headers
|
169
|
+
rescue SnapBusinessSDK::ApiError => error
|
170
|
+
if is_debugging
|
171
|
+
logger.error "[Snap Business SDK] Failed to get test event logs: #{error.to_s}"
|
172
|
+
end
|
173
|
+
SnapBusinessSDK::ResponseLogs.new status: error.code.to_s, reason: error.response_body
|
174
|
+
rescue => error
|
175
|
+
if is_debugging
|
176
|
+
logger.error "[Snap Business SDK] Exception occured: #{error.to_s}"
|
177
|
+
end
|
178
|
+
SnapBusinessSDK::ResponseLogs.new status: 'FAILED', reason: error.to_s
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Get test event stats
|
183
|
+
#
|
184
|
+
# @param [String] asset_id
|
185
|
+
# @return [ResponseStats]
|
186
|
+
def get_test_event_stats(asset_id)
|
187
|
+
headers = {}
|
188
|
+
|
189
|
+
begin
|
190
|
+
@default_api.conversion_validate_stats asset_id, header_params: headers
|
191
|
+
rescue SnapBusinessSDK::ApiError => error
|
192
|
+
if is_debugging
|
193
|
+
logger.error "[Snap Business SDK] Failed to get test event stats: #{error.to_s}"
|
194
|
+
end
|
195
|
+
SnapBusinessSDK::ResponseStats.new status: error.code.to_s, reason: error.response_body
|
196
|
+
rescue => error
|
197
|
+
if is_debugging
|
198
|
+
logger.error "[Snap Business SDK] Exception occured: #{error.to_s}"
|
199
|
+
end
|
200
|
+
SnapBusinessSDK::ResponseStats.new status: 'FAILED', reason: error.to_s
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
private
|
205
|
+
|
206
|
+
# Set the launchpad url to use if instead of the public Snapchat endpoint
|
207
|
+
#
|
208
|
+
# @param [String] launchpad_url
|
209
|
+
def set_launchpad_url(launchpad_url)
|
210
|
+
@use_launchpad = !(launchpad_url.nil? || launchpad_url.strip.empty?)
|
211
|
+
|
212
|
+
if use_launchpad
|
213
|
+
client.user_agent = SnapBusinessSDK::Constants::USER_AGENT_WITH_PAD
|
214
|
+
config.host = launchpad_url.strip
|
215
|
+
|
216
|
+
if is_debugging
|
217
|
+
logger.info "[Snap Business SDK] Launchpad host is set to #{@config.host}"
|
218
|
+
end
|
219
|
+
else
|
220
|
+
client.user_agent = SnapBusinessSDK::Constants::USER_AGENT
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
# Enables/disables logging
|
225
|
+
#
|
226
|
+
# @param [Boolean] is_enabled
|
227
|
+
def is_debugging=(is_enabled)
|
228
|
+
config.debugging = is_enabled
|
229
|
+
if is_debugging
|
230
|
+
config.logger.info "[Snap Business SDK] Debug mode is set to #{is_enabled}"
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
# Set the logger used
|
235
|
+
#
|
236
|
+
# @param [Logger] logger
|
237
|
+
def logger=(logger)
|
238
|
+
config.logger = logger
|
239
|
+
if is_debugging
|
240
|
+
logger.info '[Snap Business SDK] Logger set'
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
=begin
|
2
|
+
#Snap Conversions API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module SnapBusinessSDK
|
16
|
+
class DefaultApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Returns a list of test events in last 24 hours
|
23
|
+
# @param asset_id [String]
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @return [ResponseLogs]
|
26
|
+
def conversion_validate_logs(asset_id, opts = {})
|
27
|
+
data, _status_code, _headers = conversion_validate_logs_with_http_info(asset_id, opts)
|
28
|
+
data
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns a list of test events in last 24 hours
|
32
|
+
# @param asset_id [String]
|
33
|
+
# @param [Hash] opts the optional parameters
|
34
|
+
# @return [Array<(ResponseLogs, Integer, Hash)>] ResponseLogs data, response status code and response headers
|
35
|
+
def conversion_validate_logs_with_http_info(asset_id, opts = {})
|
36
|
+
if @api_client.config.debugging
|
37
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.conversion_validate_logs ...'
|
38
|
+
end
|
39
|
+
# verify the required parameter 'asset_id' is set
|
40
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
41
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling DefaultApi.conversion_validate_logs"
|
42
|
+
end
|
43
|
+
# resource path
|
44
|
+
local_var_path = '/v2/conversion/validate/logs'
|
45
|
+
|
46
|
+
# query parameters
|
47
|
+
query_params = opts[:query_params] || {}
|
48
|
+
query_params[:'asset_id'] = asset_id
|
49
|
+
|
50
|
+
# header parameters
|
51
|
+
header_params = opts[:header_params] || {}
|
52
|
+
# HTTP header 'Accept' (if needed)
|
53
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
54
|
+
|
55
|
+
# form parameters
|
56
|
+
form_params = opts[:form_params] || {}
|
57
|
+
|
58
|
+
# http body (model)
|
59
|
+
post_body = opts[:debug_body]
|
60
|
+
|
61
|
+
# return_type
|
62
|
+
return_type = opts[:debug_return_type] || 'ResponseLogs'
|
63
|
+
|
64
|
+
# auth_names
|
65
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
66
|
+
|
67
|
+
new_options = opts.merge(
|
68
|
+
:operation => :"DefaultApi.conversion_validate_logs",
|
69
|
+
:header_params => header_params,
|
70
|
+
:query_params => query_params,
|
71
|
+
:form_params => form_params,
|
72
|
+
:body => post_body,
|
73
|
+
:auth_names => auth_names,
|
74
|
+
:return_type => return_type
|
75
|
+
)
|
76
|
+
|
77
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
78
|
+
if @api_client.config.debugging
|
79
|
+
@api_client.config.logger.debug "API called: DefaultApi#conversion_validate_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
80
|
+
end
|
81
|
+
return data, status_code, headers
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns the stats on test and non-test events in the past hour
|
85
|
+
# @param asset_id [String]
|
86
|
+
# @param [Hash] opts the optional parameters
|
87
|
+
# @return [ResponseStats]
|
88
|
+
def conversion_validate_stats(asset_id, opts = {})
|
89
|
+
data, _status_code, _headers = conversion_validate_stats_with_http_info(asset_id, opts)
|
90
|
+
data
|
91
|
+
end
|
92
|
+
|
93
|
+
# Returns the stats on test and non-test events in the past hour
|
94
|
+
# @param asset_id [String]
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @return [Array<(ResponseStats, Integer, Hash)>] ResponseStats data, response status code and response headers
|
97
|
+
def conversion_validate_stats_with_http_info(asset_id, opts = {})
|
98
|
+
if @api_client.config.debugging
|
99
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.conversion_validate_stats ...'
|
100
|
+
end
|
101
|
+
# verify the required parameter 'asset_id' is set
|
102
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
103
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling DefaultApi.conversion_validate_stats"
|
104
|
+
end
|
105
|
+
# resource path
|
106
|
+
local_var_path = '/v2/conversion/validate/stats'
|
107
|
+
|
108
|
+
# query parameters
|
109
|
+
query_params = opts[:query_params] || {}
|
110
|
+
query_params[:'asset_id'] = asset_id
|
111
|
+
|
112
|
+
# header parameters
|
113
|
+
header_params = opts[:header_params] || {}
|
114
|
+
# HTTP header 'Accept' (if needed)
|
115
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
116
|
+
|
117
|
+
# form parameters
|
118
|
+
form_params = opts[:form_params] || {}
|
119
|
+
|
120
|
+
# http body (model)
|
121
|
+
post_body = opts[:debug_body]
|
122
|
+
|
123
|
+
# return_type
|
124
|
+
return_type = opts[:debug_return_type] || 'ResponseStats'
|
125
|
+
|
126
|
+
# auth_names
|
127
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
128
|
+
|
129
|
+
new_options = opts.merge(
|
130
|
+
:operation => :"DefaultApi.conversion_validate_stats",
|
131
|
+
:header_params => header_params,
|
132
|
+
:query_params => query_params,
|
133
|
+
:form_params => form_params,
|
134
|
+
:body => post_body,
|
135
|
+
:auth_names => auth_names,
|
136
|
+
:return_type => return_type
|
137
|
+
)
|
138
|
+
|
139
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
140
|
+
if @api_client.config.debugging
|
141
|
+
@api_client.config.logger.debug "API called: DefaultApi#conversion_validate_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
142
|
+
end
|
143
|
+
return data, status_code, headers
|
144
|
+
end
|
145
|
+
|
146
|
+
# @param [Hash] opts the optional parameters
|
147
|
+
# @option opts [Array<CapiEvent>] :body Snap Conversions API
|
148
|
+
# @return [Response]
|
149
|
+
def send_data(opts = {})
|
150
|
+
data, _status_code, _headers = send_data_with_http_info(opts)
|
151
|
+
data
|
152
|
+
end
|
153
|
+
|
154
|
+
# @param [Hash] opts the optional parameters
|
155
|
+
# @option opts [Array<CapiEvent>] :body Snap Conversions API
|
156
|
+
# @return [Array<(Response, Integer, Hash)>] Response data, response status code and response headers
|
157
|
+
def send_data_with_http_info(opts = {})
|
158
|
+
if @api_client.config.debugging
|
159
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.send_data ...'
|
160
|
+
end
|
161
|
+
# resource path
|
162
|
+
local_var_path = '/v2/conversion'
|
163
|
+
|
164
|
+
# query parameters
|
165
|
+
query_params = opts[:query_params] || {}
|
166
|
+
|
167
|
+
# header parameters
|
168
|
+
header_params = opts[:header_params] || {}
|
169
|
+
# HTTP header 'Accept' (if needed)
|
170
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
171
|
+
# HTTP header 'Content-Type'
|
172
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
173
|
+
if !content_type.nil?
|
174
|
+
header_params['Content-Type'] = content_type
|
175
|
+
end
|
176
|
+
|
177
|
+
# form parameters
|
178
|
+
form_params = opts[:form_params] || {}
|
179
|
+
|
180
|
+
# http body (model)
|
181
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
|
182
|
+
|
183
|
+
# return_type
|
184
|
+
return_type = opts[:debug_return_type] || 'Response'
|
185
|
+
|
186
|
+
# auth_names
|
187
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
188
|
+
|
189
|
+
new_options = opts.merge(
|
190
|
+
:operation => :"DefaultApi.send_data",
|
191
|
+
:header_params => header_params,
|
192
|
+
:query_params => query_params,
|
193
|
+
:form_params => form_params,
|
194
|
+
:body => post_body,
|
195
|
+
:auth_names => auth_names,
|
196
|
+
:return_type => return_type
|
197
|
+
)
|
198
|
+
|
199
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
200
|
+
if @api_client.config.debugging
|
201
|
+
@api_client.config.logger.debug "API called: DefaultApi#send_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
202
|
+
end
|
203
|
+
return data, status_code, headers
|
204
|
+
end
|
205
|
+
|
206
|
+
# @param [Hash] opts the optional parameters
|
207
|
+
# @option opts [Array<CapiEvent>] :body Snap Conversions API
|
208
|
+
# @return [TestResponse]
|
209
|
+
def send_test_data(opts = {})
|
210
|
+
data, _status_code, _headers = send_test_data_with_http_info(opts)
|
211
|
+
data
|
212
|
+
end
|
213
|
+
|
214
|
+
# @param [Hash] opts the optional parameters
|
215
|
+
# @option opts [Array<CapiEvent>] :body Snap Conversions API
|
216
|
+
# @return [Array<(TestResponse, Integer, Hash)>] TestResponse data, response status code and response headers
|
217
|
+
def send_test_data_with_http_info(opts = {})
|
218
|
+
if @api_client.config.debugging
|
219
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.send_test_data ...'
|
220
|
+
end
|
221
|
+
# resource path
|
222
|
+
local_var_path = '/v2/conversion/validate'
|
223
|
+
|
224
|
+
# query parameters
|
225
|
+
query_params = opts[:query_params] || {}
|
226
|
+
|
227
|
+
# header parameters
|
228
|
+
header_params = opts[:header_params] || {}
|
229
|
+
# HTTP header 'Accept' (if needed)
|
230
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
231
|
+
# HTTP header 'Content-Type'
|
232
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
233
|
+
if !content_type.nil?
|
234
|
+
header_params['Content-Type'] = content_type
|
235
|
+
end
|
236
|
+
|
237
|
+
# form parameters
|
238
|
+
form_params = opts[:form_params] || {}
|
239
|
+
|
240
|
+
# http body (model)
|
241
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
|
242
|
+
|
243
|
+
# return_type
|
244
|
+
return_type = opts[:debug_return_type] || 'TestResponse'
|
245
|
+
|
246
|
+
# auth_names
|
247
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
248
|
+
|
249
|
+
new_options = opts.merge(
|
250
|
+
:operation => :"DefaultApi.send_test_data",
|
251
|
+
:header_params => header_params,
|
252
|
+
:query_params => query_params,
|
253
|
+
:form_params => form_params,
|
254
|
+
:body => post_body,
|
255
|
+
:auth_names => auth_names,
|
256
|
+
:return_type => return_type
|
257
|
+
)
|
258
|
+
|
259
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
260
|
+
if @api_client.config.debugging
|
261
|
+
@api_client.config.logger.debug "API called: DefaultApi#send_test_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
262
|
+
end
|
263
|
+
return data, status_code, headers
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|