Class: WalmartApIs::BatchRequest
- Defined in:
- lib/walmart_ap_is/models/batch_request.rb
Overview
Common properties of batch requests against individual APIs.
Instance Attribute Summary collapse
-
#headers ⇒ Object
A mapping of additional HTTP headers to send for the individual batch request.
-
#method ⇒ HttpMethod
The HTTP method associated with the individual APIs being called as part of the batch request.
-
#uri ⇒ String
The resource path of the operation being called in batch, without query parameters.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(uri:, method:, headers: SKIP, additional_properties: nil) ⇒ BatchRequest
constructor
A new instance of BatchRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(uri:, method:, headers: SKIP, additional_properties: nil) ⇒ BatchRequest
Returns a new instance of BatchRequest.
48 49 50 51 52 53 54 55 56 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 48 def initialize(uri:, method:, headers: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @uri = uri @method = method @headers = headers unless headers == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#headers ⇒ Object
A mapping of additional HTTP headers to send for the individual batch request.
25 26 27 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 25 def headers @headers end |
#method ⇒ HttpMethod
The HTTP method associated with the individual APIs being called as part of the batch request.
20 21 22 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 20 def method @method end |
#uri ⇒ String
The resource path of the operation being called in batch, without query parameters.
15 16 17 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 15 def uri @uri end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 59 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uri = hash.key?('uri') ? hash['uri'] : nil method = hash.key?('method') ? hash['method'] : nil headers = hash.key?('headers') ? hash['headers'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. BatchRequest.new(uri: uri, method: method, headers: headers, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['uri'] = 'uri' @_hash['method'] = 'method' @_hash['headers'] = 'headers' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
37 38 39 40 41 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 37 def self.optionals %w[ headers ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
89 90 91 92 93 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 89 def inspect class_name = self.class.name.split('::').last "<#{class_name} uri: #{@uri.inspect}, method: #{@method.inspect}, headers:"\ " #{@headers.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
82 83 84 85 86 |
# File 'lib/walmart_ap_is/models/batch_request.rb', line 82 def to_s class_name = self.class.name.split('::').last "<#{class_name} uri: #{@uri}, method: #{@method}, headers: #{@headers},"\ " additional_properties: #{@additional_properties}>" end |