Class: Edi::Wayfair::ListingGenerator::Attributes::PlugIn

Inherits:
BaseAttribute
  • Object
show all
Defined in:
app/services/edi/wayfair/listing_generator/attributes/plug_in.rb

Overview

Maps plug-in status from Item to Wayfair's Plug-In attribute
Taxonomy Attribute ID: 189868
Datatype: BOOLEAN
Values: Yes, No

Constant Summary

Constants inherited from BaseAttribute

BaseAttribute::UNIT_MAPPINGS

Instance Attribute Summary

Attributes inherited from BaseAttribute

#attribute_definition, #catalog_item, #item, #taxonomy_attribute_id, #wayfair_schema

Instance Method Summary collapse

Methods inherited from BaseAttribute

attribute_name, #attribute_title, #build, #build_attribute_hash, #can_build?, #custom_values_allowed?, #datatype, #fetch_value, #format_boolean, #format_decimal, #initialize, #map_unit, #possible_values, #requirement, schema_titles, set_schema_titles, set_taxonomy_attribute_id, #valid_value?

Constructor Details

This class inherits a constructor from Edi::Wayfair::ListingGenerator::Attributes::BaseAttribute

Instance Method Details

#valueString

Returns the Wayfair plug-in value for the item, defaulting based on
whether the item specifies a voltage.

Returns:

  • (String)

    'Yes' or 'No'



16
17
18
19
20
21
22
23
24
# File 'app/services/edi/wayfair/listing_generator/attributes/plug_in.rb', line 16

def value
  # Check if item has a plug specification
  plug_in = fetch_value(:plug_in)

  # Default logic: if it has voltage/amps, it's likely plug-in
  plug_in = item.volts.present? && item.volts > 0 if plug_in.nil?

  format_boolean(plug_in)
end