Class: WalmartApIs::ReportsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/walmart_ap_is/apis/reports_api.rb

Overview

ReportsApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from WalmartApIs::BaseApi

Instance Method Details

#cancel_report(report_id) ⇒ ApiResponse

TODO: type endpoint description here here

Parameters:

  • report_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/walmart_ap_is/apis/reports_api.rb', line 200

def cancel_report(report_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/reports/v4/reports/{reportId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(report_id, key: 'reportId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CancelReportResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#create_report(body) ⇒ ApiResponse

Submits a report request. Poll GET /reports/{reportId} for status. Report type taxonomy TBD — coordinate with Pod 5 for financial reports. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/walmart_ap_is/apis/reports_api.rb', line 130

def create_report(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/reports/v4/reports',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreateReportResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#download_new_report(partner_id, report_date) ⇒ ApiResponse

Downloads the current-format settlement summary report ZIP. Delegates to mp-payment-reporting GET /v3/report/reconreport/v1/reconFile (Swift v1 storage). format (e.g. 06172026)

Parameters:

  • partner_id (String)

    Required parameter: Numeric partner/seller ID

  • report_date (String)

    Required parameter: Report date in MMddyyyy

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/walmart_ap_is/apis/reports_api.rb', line 16

def download_new_report(partner_id,
                        report_date)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/disbursements/v4/payment/summary/newReportDownload',
                                 Server::DEFAULT1)
               .query_param(new_parameter(partner_id, key: 'partnerId')
                             .is_required(true))
               .query_param(new_parameter(report_date, key: 'reportDate')
                             .is_required(true))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#download_old_report(partner_id, report_date) ⇒ ApiResponse

Downloads the legacy-format settlement summary report ZIP. Delegates to mp-payment-reporting GET /v3/report/reconreport/reconFile (legacy Swift storage). format (e.g. 06172026)

Parameters:

  • partner_id (String)

    Required parameter: Numeric partner/seller ID

  • report_date (String)

    Required parameter: Report date in MMddyyyy

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/walmart_ap_is/apis/reports_api.rb', line 48

def download_old_report(partner_id,
                        report_date)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/disbursements/v4/payment/summary/oldReportDownload',
                                 Server::DEFAULT1)
               .query_param(new_parameter(partner_id, key: 'partnerId')
                             .is_required(true))
               .query_param(new_parameter(report_date, key: 'reportDate')
                             .is_required(true))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#get_report(report_id) ⇒ ApiResponse

TODO: type endpoint description here here

Parameters:

  • report_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/walmart_ap_is/apis/reports_api.rb', line 164

def get_report(report_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reports/v4/reports/{reportId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(report_id, key: 'reportId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Report.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#get_report_document(report_document_id) ⇒ ApiResponse

Returns a pre-signed URL for downloading the completed report. Do not log the pre-signed URL. description here

Parameters:

  • report_document_id (String)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/walmart_ap_is/apis/reports_api.rb', line 237

def get_report_document(report_document_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reports/v4/documents/{reportDocumentId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(report_document_id, key: 'reportDocumentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ReportDocument.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#get_reports(report_types: nil, processing_statuses: nil, created_since: nil, created_until: nil, page_size: 10, next_token: nil) ⇒ ApiResponse

TODO: type endpoint description here report type. Values are Walmart Partner Reporting Platform enum names. Runtime availability is CCM-controlled; consult PRP docs for current PROD-enabled types. TODO: type description here here here here

Parameters:

  • report_types (Array[ReportType1]) (defaults to: nil)

    Optional parameter: Filter by

  • processing_statuses (Array[ProcessingStatus]) (defaults to: nil)

    Optional parameter:

  • created_since (DateTime) (defaults to: nil)

    Optional parameter: TODO: type description

  • created_until (DateTime) (defaults to: nil)

    Optional parameter: TODO: type description

  • page_size (Integer) (defaults to: 10)

    Optional parameter: Example:10

  • next_token (String) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/walmart_ap_is/apis/reports_api.rb', line 88

def get_reports(report_types: nil,
                processing_statuses: nil,
                created_since: nil,
                created_until: nil,
                page_size: 10,
                next_token: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reports/v4/reports',
                                 Server::DEFAULT1)
               .query_param(new_parameter(report_types, key: 'reportTypes'))
               .query_param(new_parameter(processing_statuses, key: 'processingStatuses'))
               .query_param(new_parameter(created_since, key: 'createdSince'))
               .query_param(new_parameter(created_until, key: 'createdUntil'))
               .query_param(new_parameter(page_size, key: 'pageSize'))
               .query_param(new_parameter(next_token, key: 'nextToken'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetReportsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end