Class: Edi::Amazon::NullEnumMapper

Inherits:
Object
  • Object
show all
Defined in:
app/services/edi/amazon/null_enum_mapper.rb

Overview

Null Enum Mapper when a schema is not available just safely responds with sensible defaults

Instance Method Summary collapse

Constructor Details

#initializeNullEnumMapper

Returns a new instance of NullEnumMapper.



4
5
6
# File 'app/services/edi/amazon/null_enum_mapper.rb', line 4

def initialize
  @schema = {}
end

Instance Method Details

#enum_editable?(_field_path) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/services/edi/amazon/null_enum_mapper.rb', line 19

def enum_editable?(_field_path)
  true
end

#enum_fieldsObject

Retrieve a list of all fields with enums



24
25
26
# File 'app/services/edi/amazon/null_enum_mapper.rb', line 24

def enum_fields
  []
end

#enum_mappings(_field_path) ⇒ Object

Retrieve a hash of all enum names and values for a dot-separated field



15
16
17
# File 'app/services/edi/amazon/null_enum_mapper.rb', line 15

def enum_mappings(_field_path)
  {}
end

#enum_value(_field_path, display_name) ⇒ Object

Retrieve the enum value for a given dot-separated field and display name
If the enum is editable, the display name can be used as is



10
11
12
# File 'app/services/edi/amazon/null_enum_mapper.rb', line 10

def enum_value(_field_path, display_name)
  display_name
end