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.



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

def initialize
  @schema = {}
end

Instance Method Details

#enum_editable?(_field_path) ⇒ Boolean

Returns:

  • (Boolean)


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

def enum_editable?(_field_path)
  true
end

#enum_fieldsObject

Retrieve a list of all fields with enums



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

def enum_fields
  []
end

#enum_mappings(_field_path) ⇒ Object

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



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

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



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

def enum_value(_field_path, display_name)
  display_name
end