Class: WalmartApIs::FeaturedOfferExpectedPriceResponseBody
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::FeaturedOfferExpectedPriceResponseBody
- Defined in:
- lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb
Overview
The body of a FOEP response.
Instance Attribute Summary collapse
-
#errors ⇒ Array[Error3]
A list of error responses returned when a request is unsuccessful.
-
#featured_offer_expected_price_results ⇒ Array[FeaturedOfferExpectedPriceResult]
A list of FOEP results for the requested offer.
-
#offer_identifier ⇒ OfferIdentifier
Identifies an offer.
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(offer_identifier: SKIP, featured_offer_expected_price_results: SKIP, errors: SKIP, additional_properties: nil) ⇒ FeaturedOfferExpectedPriceResponseBody
constructor
A new instance of FeaturedOfferExpectedPriceResponseBody.
-
#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(offer_identifier: SKIP, featured_offer_expected_price_results: SKIP, errors: SKIP, additional_properties: nil) ⇒ FeaturedOfferExpectedPriceResponseBody
Returns a new instance of FeaturedOfferExpectedPriceResponseBody.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 48 def initialize(offer_identifier: SKIP, featured_offer_expected_price_results: SKIP, errors: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @offer_identifier = offer_identifier unless offer_identifier == SKIP unless featured_offer_expected_price_results == SKIP @featured_offer_expected_price_results = featured_offer_expected_price_results end @errors = errors unless errors == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#errors ⇒ Array[Error3]
A list of error responses returned when a request is unsuccessful.
22 23 24 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 22 def errors @errors end |
#featured_offer_expected_price_results ⇒ Array[FeaturedOfferExpectedPriceResult]
A list of FOEP results for the requested offer.
18 19 20 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 18 def featured_offer_expected_price_results @featured_offer_expected_price_results end |
#offer_identifier ⇒ OfferIdentifier
Identifies an offer.
14 15 16 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 14 def offer_identifier @offer_identifier end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 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 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. offer_identifier = OfferIdentifier.from_hash(hash['offerIdentifier']) if hash['offerIdentifier'] # Parameter is an array, so we need to iterate through it featured_offer_expected_price_results = nil unless hash['featuredOfferExpectedPriceResults'].nil? featured_offer_expected_price_results = [] hash['featuredOfferExpectedPriceResults'].each do |structure| featured_offer_expected_price_results << (FeaturedOfferExpectedPriceResult.from_hash(structure) if structure) end end featured_offer_expected_price_results = SKIP unless hash.key?('featuredOfferExpectedPriceResults') # Parameter is an array, so we need to iterate through it errors = nil unless hash['errors'].nil? errors = [] hash['errors'].each do |structure| errors << (Error3.from_hash(structure) if structure) end end errors = SKIP unless hash.key?('errors') # 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. FeaturedOfferExpectedPriceResponseBody.new(offer_identifier: offer_identifier, featured_offer_expected_price_results: featured_offer_expected_price_results, errors: errors, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 32 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['offer_identifier'] = 'offerIdentifier' @_hash['featured_offer_expected_price_results'] = 'featuredOfferExpectedPriceResults' @_hash['errors'] = 'errors' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 40 41 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 35 def self.optionals %w[ offer_identifier featured_offer_expected_price_results errors ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
114 115 116 117 118 119 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 114 def inspect class_name = self.class.name.split('::').last "<#{class_name} offer_identifier: #{@offer_identifier.inspect},"\ " featured_offer_expected_price_results: #{@featured_offer_expected_price_results.inspect},"\ " errors: #{@errors.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
106 107 108 109 110 111 |
# File 'lib/walmart_ap_is/models/featured_offer_expected_price_response_body.rb', line 106 def to_s class_name = self.class.name.split('::').last "<#{class_name} offer_identifier: #{@offer_identifier},"\ " featured_offer_expected_price_results: #{@featured_offer_expected_price_results}, errors:"\ " #{@errors}, additional_properties: #{@additional_properties}>" end |