walmart-apimatic-sdk 0.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/LICENSE +28 -0
- data/README.md +176 -0
- data/bin/console +15 -0
- data/lib/walmart_ap_is/api_helper.rb +10 -0
- data/lib/walmart_ap_is/apis/base_api.rb +67 -0
- data/lib/walmart_ap_is/apis/cppreference_api.rb +60 -0
- data/lib/walmart_ap_is/apis/detail_api.rb +58 -0
- data/lib/walmart_ap_is/apis/feeds_api.rb +79 -0
- data/lib/walmart_ap_is/apis/feeds_feed_type_incentive_enrollment_api.rb +66 -0
- data/lib/walmart_ap_is/apis/feeds_feed_type_price_and_promotion_api.rb +86 -0
- data/lib/walmart_ap_is/apis/feeds_feed_type_walmart_funded_incentives_enrollment_api.rb +75 -0
- data/lib/walmart_ap_is/apis/get_pricing_insights_api.rb +60 -0
- data/lib/walmart_ap_is/apis/incentives_api.rb +93 -0
- data/lib/walmart_ap_is/apis/m_strategy_collection_id_api.rb +118 -0
- data/lib/walmart_ap_is/apis/misc_api.rb +23 -0
- data/lib/walmart_ap_is/apis/price_api.rb +63 -0
- data/lib/walmart_ap_is/apis/repricer_feeds_api.rb +64 -0
- data/lib/walmart_ap_is/apis/strategies_api.rb +56 -0
- data/lib/walmart_ap_is/apis/strategy_api.rb +63 -0
- data/lib/walmart_ap_is/apis/token_api.rb +98 -0
- data/lib/walmart_ap_is/apis/wfpreference_api.rb +68 -0
- data/lib/walmart_ap_is/client.rb +163 -0
- data/lib/walmart_ap_is/configuration.rb +165 -0
- data/lib/walmart_ap_is/exceptions/api_exception.rb +21 -0
- data/lib/walmart_ap_is/http/api_response.rb +19 -0
- data/lib/walmart_ap_is/http/auth/basic_auth.rb +62 -0
- data/lib/walmart_ap_is/http/http_call_back.rb +10 -0
- data/lib/walmart_ap_is/http/http_method_enum.rb +10 -0
- data/lib/walmart_ap_is/http/http_request.rb +10 -0
- data/lib/walmart_ap_is/http/http_response.rb +10 -0
- data/lib/walmart_ap_is/http/proxy_settings.rb +22 -0
- data/lib/walmart_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/walmart_ap_is/logging/sdk_logger.rb +17 -0
- data/lib/walmart_ap_is/models/assign_unassign_items_to_from_repricer_strategy_request.rb +92 -0
- data/lib/walmart_ap_is/models/base_model.rb +110 -0
- data/lib/walmart_ap_is/models/client_credentials_res.rb +82 -0
- data/lib/walmart_ap_is/models/create_repricer_strategy_request.rb +149 -0
- data/lib/walmart_ap_is/models/current_price.rb +82 -0
- data/lib/walmart_ap_is/models/filter.rb +90 -0
- data/lib/walmart_ap_is/models/get_pricing_insights_request.rb +109 -0
- data/lib/walmart_ap_is/models/incentives_enrollment.rb +95 -0
- data/lib/walmart_ap_is/models/item.rb +239 -0
- data/lib/walmart_ap_is/models/item1.rb +73 -0
- data/lib/walmart_ap_is/models/item_feed_header.rb +119 -0
- data/lib/walmart_ap_is/models/item_identifiers.rb +72 -0
- data/lib/walmart_ap_is/models/item_price_response.rb +90 -0
- data/lib/walmart_ap_is/models/json1.rb +73 -0
- data/lib/walmart_ap_is/models/mp_item.rb +74 -0
- data/lib/walmart_ap_is/models/mp_item_feed_header.rb +91 -0
- data/lib/walmart_ap_is/models/page_context.rb +102 -0
- data/lib/walmart_ap_is/models/pricing.rb +84 -0
- data/lib/walmart_ap_is/models/pricing_insights_response_list.rb +328 -0
- data/lib/walmart_ap_is/models/program_action.rb +83 -0
- data/lib/walmart_ap_is/models/program_action1.rb +83 -0
- data/lib/walmart_ap_is/models/program_action_feed_header.rb +147 -0
- data/lib/walmart_ap_is/models/programs.rb +80 -0
- data/lib/walmart_ap_is/models/programs1.rb +75 -0
- data/lib/walmart_ap_is/models/promo_discount.rb +90 -0
- data/lib/walmart_ap_is/models/refresh_token_res.rb +82 -0
- data/lib/walmart_ap_is/models/scopes.rb +142 -0
- data/lib/walmart_ap_is/models/search_criteria.rb +82 -0
- data/lib/walmart_ap_is/models/set_up_cap_sku_all_legacy_request.rb +85 -0
- data/lib/walmart_ap_is/models/sort.rb +82 -0
- data/lib/walmart_ap_is/models/status_info.rb +85 -0
- data/lib/walmart_ap_is/models/strategy.rb +94 -0
- data/lib/walmart_ap_is/models/strategy5.rb +106 -0
- data/lib/walmart_ap_is/models/strategy_collection.rb +169 -0
- data/lib/walmart_ap_is/models/successful_operation.rb +159 -0
- data/lib/walmart_ap_is/models/successful_operation1.rb +73 -0
- data/lib/walmart_ap_is/models/successful_operation11.rb +82 -0
- data/lib/walmart_ap_is/models/successful_operation12.rb +82 -0
- data/lib/walmart_ap_is/models/successful_operation2.rb +100 -0
- data/lib/walmart_ap_is/models/successful_operation3.rb +92 -0
- data/lib/walmart_ap_is/models/successful_operation4.rb +84 -0
- data/lib/walmart_ap_is/models/successful_operation5.rb +91 -0
- data/lib/walmart_ap_is/models/successful_operation6.rb +93 -0
- data/lib/walmart_ap_is/models/successful_operation7.rb +75 -0
- data/lib/walmart_ap_is/models/successful_operation8.rb +73 -0
- data/lib/walmart_ap_is/models/token_api_authorization_code.rb +122 -0
- data/lib/walmart_ap_is/models/token_api_client_credentials.rb +122 -0
- data/lib/walmart_ap_is/models/token_api_refresh_token.rb +122 -0
- data/lib/walmart_ap_is/models/token_api_res.rb +82 -0
- data/lib/walmart_ap_is/models/update_pricing_for_a_single_item_request.rb +91 -0
- data/lib/walmart_ap_is/models/update_pricing_for_multiple_items_in_bulk_new_request.rb +92 -0
- data/lib/walmart_ap_is/models/update_reduced_referral_fee_incentives_enrollment_request.rb +95 -0
- data/lib/walmart_ap_is/models/update_repricer_strategy_request.rb +149 -0
- data/lib/walmart_ap_is/models/update_walmart_funded_incentives_enrollment_for_specific_items_request.rb +95 -0
- data/lib/walmart_ap_is/models/value.rb +91 -0
- data/lib/walmart_ap_is/models/value1.rb +101 -0
- data/lib/walmart_ap_is/models/walmart_funded_incentives_enrollment.rb +79 -0
- data/lib/walmart_ap_is/models/xml1.rb +73 -0
- data/lib/walmart_ap_is/utilities/date_time_helper.rb +11 -0
- data/lib/walmart_ap_is/utilities/file_wrapper.rb +28 -0
- data/lib/walmart_ap_is.rb +122 -0
- metadata +179 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# walmart_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WalmartApIs
|
|
7
|
+
# Initializes a new instance of RequestLoggingConfiguration.
|
|
8
|
+
class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
|
|
9
|
+
# @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
|
|
10
|
+
# @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
|
|
11
|
+
# @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
|
|
12
|
+
# @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
|
|
13
|
+
# @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
|
|
14
|
+
# Default is an empty array.
|
|
15
|
+
def initialize(log_body: false, log_headers: false, headers_to_include: nil,
|
|
16
|
+
headers_to_exclude: nil, headers_to_unmask: nil,
|
|
17
|
+
include_query_in_path: false)
|
|
18
|
+
super(
|
|
19
|
+
log_body,
|
|
20
|
+
log_headers,
|
|
21
|
+
headers_to_exclude,
|
|
22
|
+
headers_to_include,
|
|
23
|
+
headers_to_unmask,
|
|
24
|
+
include_query_in_path
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
|
|
29
|
+
headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
|
|
30
|
+
log_body ||= self.log_body
|
|
31
|
+
log_headers ||= self.log_headers
|
|
32
|
+
headers_to_include ||= self.headers_to_include
|
|
33
|
+
headers_to_exclude ||= self.headers_to_exclude
|
|
34
|
+
headers_to_unmask ||= self.headers_to_unmask
|
|
35
|
+
include_query_in_path ||= self.include_query_in_path
|
|
36
|
+
|
|
37
|
+
RequestLoggingConfiguration.new(
|
|
38
|
+
log_body: log_body,
|
|
39
|
+
log_headers: log_headers,
|
|
40
|
+
headers_to_include: headers_to_include,
|
|
41
|
+
headers_to_exclude: headers_to_exclude,
|
|
42
|
+
headers_to_unmask: headers_to_unmask,
|
|
43
|
+
include_query_in_path: include_query_in_path
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.from_env
|
|
48
|
+
log_body = ENV['REQUEST_LOG_BODY']
|
|
49
|
+
log_headers = ENV['REQUEST_LOG_HEADERS']
|
|
50
|
+
headers_to_include = ENV['REQUEST_HEADERS_TO_INCLUDE']
|
|
51
|
+
headers_to_exclude = ENV['REQUEST_HEADERS_TO_EXCLUDE']
|
|
52
|
+
headers_to_unmask = ENV['REQUEST_HEADERS_TO_UNMASK']
|
|
53
|
+
include_query_in_path = ENV['REQUEST_INCLUDE_QUERY_IN_PATH']
|
|
54
|
+
|
|
55
|
+
new(
|
|
56
|
+
log_body: log_body,
|
|
57
|
+
log_headers: log_headers,
|
|
58
|
+
headers_to_include: headers_to_include,
|
|
59
|
+
headers_to_exclude: headers_to_exclude,
|
|
60
|
+
headers_to_unmask: headers_to_unmask,
|
|
61
|
+
include_query_in_path: include_query_in_path
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.any_logging_configured?
|
|
66
|
+
%w[
|
|
67
|
+
REQUEST_LOG_BODY
|
|
68
|
+
REQUEST_LOG_HEADERS
|
|
69
|
+
REQUEST_HEADERS_TO_INCLUDE
|
|
70
|
+
REQUEST_HEADERS_TO_EXCLUDE
|
|
71
|
+
REQUEST_HEADERS_TO_UNMASK
|
|
72
|
+
REQUEST_INCLUDE_QUERY_IN_PATH
|
|
73
|
+
].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Initializes a new instance of ResponseLoggingConfiguration.
|
|
78
|
+
class ResponseLoggingConfiguration < CoreLibrary::ApiResponseLoggingConfiguration
|
|
79
|
+
def initialize(log_body: false, log_headers: false, headers_to_include: nil,
|
|
80
|
+
headers_to_exclude: nil, headers_to_unmask: nil)
|
|
81
|
+
super(
|
|
82
|
+
log_body,
|
|
83
|
+
log_headers,
|
|
84
|
+
headers_to_exclude,
|
|
85
|
+
headers_to_include,
|
|
86
|
+
headers_to_unmask
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
|
|
91
|
+
headers_to_exclude: nil, headers_to_unmask: nil)
|
|
92
|
+
log_body ||= self.log_body
|
|
93
|
+
log_headers ||= self.log_headers
|
|
94
|
+
headers_to_include ||= self.headers_to_include
|
|
95
|
+
headers_to_exclude ||= self.headers_to_exclude
|
|
96
|
+
headers_to_unmask ||= self.headers_to_unmask
|
|
97
|
+
|
|
98
|
+
ResponseLoggingConfiguration.new(
|
|
99
|
+
log_body: log_body,
|
|
100
|
+
log_headers: log_headers,
|
|
101
|
+
headers_to_include: headers_to_include,
|
|
102
|
+
headers_to_exclude: headers_to_exclude,
|
|
103
|
+
headers_to_unmask: headers_to_unmask
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def self.from_env
|
|
108
|
+
log_body = ENV['RESPONSE_LOG_BODY']
|
|
109
|
+
log_headers = ENV['RESPONSE_LOG_HEADERS']
|
|
110
|
+
headers_to_include = ENV['RESPONSE_HEADERS_TO_INCLUDE']
|
|
111
|
+
headers_to_exclude = ENV['RESPONSE_HEADERS_TO_EXCLUDE']
|
|
112
|
+
headers_to_unmask = ENV['RESPONSE_HEADERS_TO_UNMASK']
|
|
113
|
+
|
|
114
|
+
new(
|
|
115
|
+
log_body: log_body,
|
|
116
|
+
log_headers: log_headers,
|
|
117
|
+
headers_to_include: headers_to_include,
|
|
118
|
+
headers_to_exclude: headers_to_exclude,
|
|
119
|
+
headers_to_unmask: headers_to_unmask
|
|
120
|
+
)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def self.any_logging_configured?
|
|
124
|
+
%w[
|
|
125
|
+
RESPONSE_LOG_BODY
|
|
126
|
+
RESPONSE_LOG_HEADERS
|
|
127
|
+
RESPONSE_HEADERS_TO_INCLUDE
|
|
128
|
+
RESPONSE_HEADERS_TO_EXCLUDE
|
|
129
|
+
RESPONSE_HEADERS_TO_UNMASK
|
|
130
|
+
].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Initializes a new instance of LoggingConfiguration.
|
|
135
|
+
class LoggingConfiguration < CoreLibrary::ApiLoggingConfiguration
|
|
136
|
+
def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
|
|
137
|
+
request_logging_config: nil,
|
|
138
|
+
response_logging_config: nil)
|
|
139
|
+
request_logging_config ||= RequestLoggingConfiguration.new
|
|
140
|
+
response_logging_config ||= ResponseLoggingConfiguration.new
|
|
141
|
+
super(
|
|
142
|
+
logger,
|
|
143
|
+
log_level,
|
|
144
|
+
request_logging_config,
|
|
145
|
+
response_logging_config,
|
|
146
|
+
mask_sensitive_headers
|
|
147
|
+
)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
|
|
151
|
+
request_logging_config: nil, response_logging_config: nil)
|
|
152
|
+
logger ||= self.logger
|
|
153
|
+
log_level ||= self.log_level
|
|
154
|
+
mask_sensitive_headers ||= self.mask_sensitive_headers
|
|
155
|
+
request_logging_config ||= self.request_logging_config.clone
|
|
156
|
+
response_logging_config ||= self.response_logging_config.clone
|
|
157
|
+
|
|
158
|
+
LoggingConfiguration.new(
|
|
159
|
+
logger: logger,
|
|
160
|
+
log_level: log_level,
|
|
161
|
+
mask_sensitive_headers: mask_sensitive_headers,
|
|
162
|
+
request_logging_config: request_logging_config,
|
|
163
|
+
response_logging_config: response_logging_config
|
|
164
|
+
)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def self.from_env
|
|
168
|
+
log_level = ENV['LOG_LEVEL']
|
|
169
|
+
mask_sensitive_headers = ENV['MASK_SENSITIVE_HEADERS']
|
|
170
|
+
|
|
171
|
+
new(
|
|
172
|
+
log_level: log_level,
|
|
173
|
+
mask_sensitive_headers: mask_sensitive_headers,
|
|
174
|
+
request_logging_config: RequestLoggingConfiguration.from_env,
|
|
175
|
+
response_logging_config: ResponseLoggingConfiguration.from_env
|
|
176
|
+
)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def self.any_logging_configured?
|
|
180
|
+
RequestLoggingConfiguration.any_logging_configured? ||
|
|
181
|
+
ResponseLoggingConfiguration.any_logging_configured? ||
|
|
182
|
+
ENV.key?('LOG_LEVEL') ||
|
|
183
|
+
ENV.key?('MASK_SENSITIVE_HEADERS')
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# walmart_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WalmartApIs
|
|
7
|
+
# Represents the generic logger facade
|
|
8
|
+
class AbstractLogger < Logger
|
|
9
|
+
# Logs a message with a specified log level and additional parameters.
|
|
10
|
+
# @param level [Symbol] The log level of the message.
|
|
11
|
+
# @param message [String] The message to log.
|
|
12
|
+
# @param params [Hash] Additional parameters to include in the log message.
|
|
13
|
+
def log(level, message, params)
|
|
14
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# walmart_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WalmartApIs
|
|
7
|
+
# AssignUnassignItemsToFromRepricerStrategyRequest Model.
|
|
8
|
+
class AssignUnassignItemsToFromRepricerStrategyRequest < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [ItemFeedHeader]
|
|
14
|
+
attr_accessor :item_feed_header
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Array[Item1]]
|
|
18
|
+
attr_accessor :item
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['item_feed_header'] = 'ItemFeedHeader'
|
|
24
|
+
@_hash['item'] = 'Item'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(item_feed_header:, item:, additional_properties: nil)
|
|
39
|
+
# Add additional model properties to the instance
|
|
40
|
+
additional_properties = {} if additional_properties.nil?
|
|
41
|
+
|
|
42
|
+
@item_feed_header = item_feed_header
|
|
43
|
+
@item = item
|
|
44
|
+
@additional_properties = additional_properties
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Creates an instance of the object from a hash.
|
|
48
|
+
def self.from_hash(hash)
|
|
49
|
+
return nil unless hash
|
|
50
|
+
|
|
51
|
+
# Extract variables from the hash.
|
|
52
|
+
item_feed_header = ItemFeedHeader.from_hash(hash['ItemFeedHeader']) if
|
|
53
|
+
hash['ItemFeedHeader']
|
|
54
|
+
# Parameter is an array, so we need to iterate through it
|
|
55
|
+
item = nil
|
|
56
|
+
unless hash['Item'].nil?
|
|
57
|
+
item = []
|
|
58
|
+
hash['Item'].each do |structure|
|
|
59
|
+
item << (Item1.from_hash(structure) if structure)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
item = nil unless hash.key?('Item')
|
|
64
|
+
|
|
65
|
+
# Create a new hash for additional properties, removing known properties.
|
|
66
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
67
|
+
|
|
68
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
69
|
+
new_hash, proc { |value| value }
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Create object from extracted values.
|
|
73
|
+
AssignUnassignItemsToFromRepricerStrategyRequest.new(item_feed_header: item_feed_header,
|
|
74
|
+
item: item,
|
|
75
|
+
additional_properties: additional_properties)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Provides a human-readable string representation of the object.
|
|
79
|
+
def to_s
|
|
80
|
+
class_name = self.class.name.split('::').last
|
|
81
|
+
"<#{class_name} item_feed_header: #{@item_feed_header}, item: #{@item},"\
|
|
82
|
+
" additional_properties: #{@additional_properties}>"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
86
|
+
def inspect
|
|
87
|
+
class_name = self.class.name.split('::').last
|
|
88
|
+
"<#{class_name} item_feed_header: #{@item_feed_header.inspect}, item: #{@item.inspect},"\
|
|
89
|
+
" additional_properties: #{@additional_properties}>"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# walmart_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WalmartApIs
|
|
7
|
+
# Base model.
|
|
8
|
+
# rubocop:disable all
|
|
9
|
+
class BaseModel < CoreLibrary::BaseModel
|
|
10
|
+
# Returns a Hash representation of the current object.
|
|
11
|
+
def to_hash
|
|
12
|
+
# validating the model being serialized
|
|
13
|
+
self.class.validate(self) if self.class.respond_to?(:validate)
|
|
14
|
+
|
|
15
|
+
hash = {}
|
|
16
|
+
instance_variables.each do |name|
|
|
17
|
+
value = instance_variable_get(name)
|
|
18
|
+
name = name[1..]
|
|
19
|
+
if name == 'additional_properties'
|
|
20
|
+
additional_properties = process_additional_properties(value, self.class.names)
|
|
21
|
+
hash.merge!(additional_properties)
|
|
22
|
+
else
|
|
23
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
|
24
|
+
optional_fields = self.class.optionals
|
|
25
|
+
nullable_fields = self.class.nullables
|
|
26
|
+
if value.nil?
|
|
27
|
+
next unless nullable_fields.include?(name)
|
|
28
|
+
|
|
29
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
|
30
|
+
raise ArgumentError,
|
|
31
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
hash[key] = nil
|
|
36
|
+
unless value.nil?
|
|
37
|
+
if respond_to?("to_custom_#{name}")
|
|
38
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
|
39
|
+
params = [hash, key]
|
|
40
|
+
hash[key] = send("to_custom_#{name}", *params)
|
|
41
|
+
else
|
|
42
|
+
hash[key] = send("to_custom_#{name}")
|
|
43
|
+
end
|
|
44
|
+
elsif respond_to?("to_union_type_#{name}")
|
|
45
|
+
hash[key] = send("to_union_type_#{name}")
|
|
46
|
+
elsif value.instance_of? Array
|
|
47
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
48
|
+
elsif value.instance_of? Hash
|
|
49
|
+
hash[key] = {}
|
|
50
|
+
value.each do |k, v|
|
|
51
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
|
52
|
+
end
|
|
53
|
+
else
|
|
54
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
hash
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Processes additional properties, ensuring no conflicts with existing properties.
|
|
63
|
+
def process_additional_properties(additional_properties, existing_prop_names)
|
|
64
|
+
hash = {}
|
|
65
|
+
additional_properties.each do |name, value|
|
|
66
|
+
check_for_conflict(name, existing_prop_names)
|
|
67
|
+
|
|
68
|
+
hash[name] = if value.is_a?(Array)
|
|
69
|
+
process_array(value)
|
|
70
|
+
elsif value.is_a?(Hash)
|
|
71
|
+
process_hash(value)
|
|
72
|
+
else
|
|
73
|
+
process_basic_value(value)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
hash
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Checks if an additional property conflicts with a model's existing property.
|
|
80
|
+
def check_for_conflict(name, existing_prop_names)
|
|
81
|
+
return unless existing_prop_names.key?(name)
|
|
82
|
+
|
|
83
|
+
raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Processes an array of values, recursively calling `to_hash` on BaseModel objects.
|
|
87
|
+
def process_array(value)
|
|
88
|
+
value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
|
|
92
|
+
def process_hash(value)
|
|
93
|
+
value.transform_values do |v|
|
|
94
|
+
v.is_a?(BaseModel) ? v.to_hash : v
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Processes a basic value (non-array, non-hash).
|
|
99
|
+
def process_basic_value(value)
|
|
100
|
+
value.is_a?(BaseModel) ? value.to_hash : value
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Returns a JSON representation of the curent object.
|
|
104
|
+
def to_json(options = {})
|
|
105
|
+
hash = to_hash
|
|
106
|
+
hash.to_json(options)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
# rubocop:enable all
|
|
110
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# walmart_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WalmartApIs
|
|
7
|
+
# ClientCredentialsRes Model.
|
|
8
|
+
class ClientCredentialsRes < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :summary
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Value]
|
|
18
|
+
attr_accessor :value
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['summary'] = 'summary'
|
|
24
|
+
@_hash['value'] = 'value'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(summary:, value:, additional_properties: nil)
|
|
39
|
+
# Add additional model properties to the instance
|
|
40
|
+
additional_properties = {} if additional_properties.nil?
|
|
41
|
+
|
|
42
|
+
@summary = summary
|
|
43
|
+
@value = value
|
|
44
|
+
@additional_properties = additional_properties
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Creates an instance of the object from a hash.
|
|
48
|
+
def self.from_hash(hash)
|
|
49
|
+
return nil unless hash
|
|
50
|
+
|
|
51
|
+
# Extract variables from the hash.
|
|
52
|
+
summary = hash.key?('summary') ? hash['summary'] : nil
|
|
53
|
+
value = Value.from_hash(hash['value']) if hash['value']
|
|
54
|
+
|
|
55
|
+
# Create a new hash for additional properties, removing known properties.
|
|
56
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
57
|
+
|
|
58
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
59
|
+
new_hash, proc { |value| value }
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Create object from extracted values.
|
|
63
|
+
ClientCredentialsRes.new(summary: summary,
|
|
64
|
+
value: value,
|
|
65
|
+
additional_properties: additional_properties)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Provides a human-readable string representation of the object.
|
|
69
|
+
def to_s
|
|
70
|
+
class_name = self.class.name.split('::').last
|
|
71
|
+
"<#{class_name} summary: #{@summary}, value: #{@value}, additional_properties:"\
|
|
72
|
+
" #{@additional_properties}>"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
76
|
+
def inspect
|
|
77
|
+
class_name = self.class.name.split('::').last
|
|
78
|
+
"<#{class_name} summary: #{@summary.inspect}, value: #{@value.inspect},"\
|
|
79
|
+
" additional_properties: #{@additional_properties}>"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# walmart_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WalmartApIs
|
|
7
|
+
# CreateRepricerStrategyRequest Model.
|
|
8
|
+
class CreateRepricerStrategyRequest < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :repricer_strategy
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [TrueClass | FalseClass]
|
|
18
|
+
attr_accessor :enabled
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [TrueClass | FalseClass]
|
|
22
|
+
attr_accessor :enable_repricer_for_promotion
|
|
23
|
+
|
|
24
|
+
# TODO: Write general description for this method
|
|
25
|
+
# @return [TrueClass | FalseClass]
|
|
26
|
+
attr_accessor :restore_seller_price_without_target
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for this method
|
|
29
|
+
# @return [TrueClass | FalseClass]
|
|
30
|
+
attr_accessor :enable_buybox_meet_external
|
|
31
|
+
|
|
32
|
+
# TODO: Write general description for this method
|
|
33
|
+
# @return [TrueClass | FalseClass]
|
|
34
|
+
attr_accessor :compare_with3p_offer_only
|
|
35
|
+
|
|
36
|
+
# TODO: Write general description for this method
|
|
37
|
+
# @return [Array[Strategy]]
|
|
38
|
+
attr_accessor :strategies
|
|
39
|
+
|
|
40
|
+
# A mapping from model property names to API property names.
|
|
41
|
+
def self.names
|
|
42
|
+
@_hash = {} if @_hash.nil?
|
|
43
|
+
@_hash['repricer_strategy'] = 'repricerStrategy'
|
|
44
|
+
@_hash['enabled'] = 'enabled'
|
|
45
|
+
@_hash['enable_repricer_for_promotion'] = 'enableRepricerForPromotion'
|
|
46
|
+
@_hash['restore_seller_price_without_target'] =
|
|
47
|
+
'restoreSellerPriceWithoutTarget'
|
|
48
|
+
@_hash['enable_buybox_meet_external'] = 'enableBuyboxMeetExternal'
|
|
49
|
+
@_hash['compare_with3p_offer_only'] = 'compareWith3pOfferOnly'
|
|
50
|
+
@_hash['strategies'] = 'strategies'
|
|
51
|
+
@_hash
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# An array for optional fields
|
|
55
|
+
def self.optionals
|
|
56
|
+
[]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# An array for nullable fields
|
|
60
|
+
def self.nullables
|
|
61
|
+
[]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def initialize(repricer_strategy:, enabled:, enable_repricer_for_promotion:,
|
|
65
|
+
restore_seller_price_without_target:,
|
|
66
|
+
enable_buybox_meet_external:, compare_with3p_offer_only:,
|
|
67
|
+
strategies:, additional_properties: nil)
|
|
68
|
+
# Add additional model properties to the instance
|
|
69
|
+
additional_properties = {} if additional_properties.nil?
|
|
70
|
+
|
|
71
|
+
@repricer_strategy = repricer_strategy
|
|
72
|
+
@enabled = enabled
|
|
73
|
+
@enable_repricer_for_promotion = enable_repricer_for_promotion
|
|
74
|
+
@restore_seller_price_without_target = restore_seller_price_without_target
|
|
75
|
+
@enable_buybox_meet_external = enable_buybox_meet_external
|
|
76
|
+
@compare_with3p_offer_only = compare_with3p_offer_only
|
|
77
|
+
@strategies = strategies
|
|
78
|
+
@additional_properties = additional_properties
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Creates an instance of the object from a hash.
|
|
82
|
+
def self.from_hash(hash)
|
|
83
|
+
return nil unless hash
|
|
84
|
+
|
|
85
|
+
# Extract variables from the hash.
|
|
86
|
+
repricer_strategy =
|
|
87
|
+
hash.key?('repricerStrategy') ? hash['repricerStrategy'] : nil
|
|
88
|
+
enabled = hash.key?('enabled') ? hash['enabled'] : nil
|
|
89
|
+
enable_repricer_for_promotion =
|
|
90
|
+
hash.key?('enableRepricerForPromotion') ? hash['enableRepricerForPromotion'] : nil
|
|
91
|
+
restore_seller_price_without_target =
|
|
92
|
+
hash.key?('restoreSellerPriceWithoutTarget') ? hash['restoreSellerPriceWithoutTarget'] : nil
|
|
93
|
+
enable_buybox_meet_external =
|
|
94
|
+
hash.key?('enableBuyboxMeetExternal') ? hash['enableBuyboxMeetExternal'] : nil
|
|
95
|
+
compare_with3p_offer_only =
|
|
96
|
+
hash.key?('compareWith3pOfferOnly') ? hash['compareWith3pOfferOnly'] : nil
|
|
97
|
+
# Parameter is an array, so we need to iterate through it
|
|
98
|
+
strategies = nil
|
|
99
|
+
unless hash['strategies'].nil?
|
|
100
|
+
strategies = []
|
|
101
|
+
hash['strategies'].each do |structure|
|
|
102
|
+
strategies << (Strategy.from_hash(structure) if structure)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
strategies = nil unless hash.key?('strategies')
|
|
107
|
+
|
|
108
|
+
# Create a new hash for additional properties, removing known properties.
|
|
109
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
110
|
+
|
|
111
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
112
|
+
new_hash, proc { |value| value }
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Create object from extracted values.
|
|
116
|
+
CreateRepricerStrategyRequest.new(repricer_strategy: repricer_strategy,
|
|
117
|
+
enabled: enabled,
|
|
118
|
+
enable_repricer_for_promotion: enable_repricer_for_promotion,
|
|
119
|
+
restore_seller_price_without_target: restore_seller_price_without_target,
|
|
120
|
+
enable_buybox_meet_external: enable_buybox_meet_external,
|
|
121
|
+
compare_with3p_offer_only: compare_with3p_offer_only,
|
|
122
|
+
strategies: strategies,
|
|
123
|
+
additional_properties: additional_properties)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Provides a human-readable string representation of the object.
|
|
127
|
+
def to_s
|
|
128
|
+
class_name = self.class.name.split('::').last
|
|
129
|
+
"<#{class_name} repricer_strategy: #{@repricer_strategy}, enabled: #{@enabled},"\
|
|
130
|
+
" enable_repricer_for_promotion: #{@enable_repricer_for_promotion},"\
|
|
131
|
+
" restore_seller_price_without_target: #{@restore_seller_price_without_target},"\
|
|
132
|
+
" enable_buybox_meet_external: #{@enable_buybox_meet_external}, compare_with3p_offer_only:"\
|
|
133
|
+
" #{@compare_with3p_offer_only}, strategies: #{@strategies}, additional_properties:"\
|
|
134
|
+
" #{@additional_properties}>"
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
138
|
+
def inspect
|
|
139
|
+
class_name = self.class.name.split('::').last
|
|
140
|
+
"<#{class_name} repricer_strategy: #{@repricer_strategy.inspect}, enabled:"\
|
|
141
|
+
" #{@enabled.inspect}, enable_repricer_for_promotion:"\
|
|
142
|
+
" #{@enable_repricer_for_promotion.inspect}, restore_seller_price_without_target:"\
|
|
143
|
+
" #{@restore_seller_price_without_target.inspect}, enable_buybox_meet_external:"\
|
|
144
|
+
" #{@enable_buybox_meet_external.inspect}, compare_with3p_offer_only:"\
|
|
145
|
+
" #{@compare_with3p_offer_only.inspect}, strategies: #{@strategies.inspect},"\
|
|
146
|
+
" additional_properties: #{@additional_properties}>"
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|