Class: FdxV660Api::ResultType

Inherits:
Object
  • Object
show all
Defined in:
lib/fdx_v660_api/models/result_type.rb

Overview

Flag to indicate if you want a lightweight array of metadata (AccountDescriptor or Tax or Operations) or full item details (Account or a Tax subclass or Availability details). If set to 'lightweight', should only return the fields associated with the metadata entity.

Constant Summary collapse

RESULT_TYPE =
[
  # TODO: Write general description for DETAILS
  DETAILS = 'details'.freeze,

  # TODO: Write general description for LIGHTWEIGHT
  LIGHTWEIGHT = 'lightweight'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DETAILS) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fdx_v660_api/models/result_type.rb', line 26

def self.from_value(value, default_value = DETAILS)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'details' then DETAILS
  when 'lightweight' then LIGHTWEIGHT
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/fdx_v660_api/models/result_type.rb', line 20

def self.validate(value)
  return false if value.nil?

  true
end