Class: WalmartApIs::FeedsApi

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

Overview

FeedsApi

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

#create_feed(feed_type, file, marketplace_id: 'WALMART_US', content_type: nil) ⇒ ApiResponse

Upload a feed file and submit it for asynchronous processing in a single call. The server handles document storage internally. Use the returned feedId to poll processing status via GET /feeds/v4/feeds/feedId. submitted upload and process Defaults to WALMART_US. uploaded feed content. If omitted, the server infers from the file's Content-Type in the multipart header.

Parameters:

  • feed_type (FeedType)

    Required parameter: The type of feed being

  • file (File | UploadIO)

    Required parameter: The feed content file to

  • marketplace_id (String) (defaults to: 'WALMART_US')

    Optional parameter: Marketplace identifier.

  • content_type (ContentType) (defaults to: nil)

    Optional parameter: MIME type of the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/walmart_ap_is/apis/feeds_api.rb', line 73

def create_feed(feed_type,
                file,
                marketplace_id: 'WALMART_US',
                content_type: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/feeds/v4/feeds',
                                 Server::DEFAULT1)
               .query_param(new_parameter(feed_type, key: 'feedType')
                             .is_required(true))
               .multipart_param(new_parameter(file, key: 'file')
                                 .is_required(true)
                                 .default_content_type('application/octet-stream'))
               .query_param(new_parameter(marketplace_id, key: 'marketplaceId'))
               .form_param(new_parameter(content_type, key: 'contentType'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreateFeedResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListError1Exception)
                .local_error('403',
                             'Forbidden',
                             ErrorListError1Exception)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListError1Exception)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListError1Exception))
    .execute
end

#get_feed(feed_id) ⇒ ApiResponse

TODO: type endpoint description here

Parameters:

  • feed_id (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/walmart_ap_is/apis/feeds_api.rb', line 112

def get_feed(feed_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/feeds/v4/feeds/{feedId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(feed_id, key: 'feedId')
                                .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(Feed.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListError1Exception)
                .local_error('403',
                             'Forbidden',
                             ErrorListError1Exception)
                .local_error('404',
                             'Not Found',
                             ErrorListError1Exception)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListError1Exception)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListError1Exception))
    .execute
end

#get_feed_document(feed_id) ⇒ ApiResponse

Downloads the raw feed document file. The response is a binary stream (application/octet-stream). The Content-Disposition header contains the original filename when available. Content-Length header is always set to enable download progress tracking. An IDOR check is performed before the download — the authenticated seller must own the feed referenced by feedId.

Parameters:

  • feed_id (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/walmart_ap_is/apis/feeds_api.rb', line 152

def get_feed_document(feed_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/feeds/v4/feeds/{feedId}/document',
                                 Server::DEFAULT1)
               .template_param(new_parameter(feed_id, key: 'feedId')
                                .is_required(true)
                                .should_encode(true))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListError1Exception)
                .local_error('403',
                             'Forbidden',
                             ErrorListError1Exception)
                .local_error('404',
                             'Not Found',
                             ErrorListError1Exception)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListError1Exception)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListError1Exception))
    .execute
end

#get_feeds(feed_types: nil, feed_statuses: nil, created_since: nil, created_until: nil, page_size: 10, next_token: nil) ⇒ ApiResponse

TODO: type endpoint description here description here here here here

Parameters:

  • feed_types (Array[FeedType]) (defaults to: nil)

    Optional parameter: Feed type filter

  • feed_statuses (Array[FeedStatus]) (defaults to: nil)

    Optional parameter: TODO: type

  • 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.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/walmart_ap_is/apis/feeds_api.rb', line 21

def get_feeds(feed_types: nil,
              feed_statuses: nil,
              created_since: nil,
              created_until: nil,
              page_size: 10,
              next_token: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/feeds/v4/feeds',
                                 Server::DEFAULT1)
               .query_param(new_parameter(feed_types, key: 'feedTypes'))
               .query_param(new_parameter(feed_statuses, key: 'feedStatuses'))
               .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(GetFeedsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListError1Exception)
                .local_error('403',
                             'Forbidden',
                             ErrorListError1Exception)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListError1Exception)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListError1Exception))
    .execute
end