Class: FdxV660Api::UriContentType

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

Overview

The type of content at a given URI. * HTML: The document is an HTML page which may be fetched with Accept: text/html * PDF: A document in Portable Document Format which may be fetched with Accept: application/pdf

Constant Summary collapse

URI_CONTENT_TYPE =
[
  # TODO: Write general description for HTML
  HTML = 'HTML'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = HTML) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'html' then HTML
  when 'pdf' then PDF
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  true
end