Class: UspsApi::ImageType2
- Inherits:
-
Object
- Object
- UspsApi::ImageType2
- Defined in:
- lib/usps_api/models/image_type2.rb
Overview
The type of indicia image requested. If omitted then the default image type is PDF.
Constant Summary collapse
- IMAGE_TYPE2 =
[ # TODO: Write general description for PDF PDF = 'PDF'.freeze, # TODO: Write general description for TIFF TIFF = 'TIFF'.freeze, # TODO: Write general description for JPG JPG = 'JPG'.freeze, # TODO: Write general description for PNG PNG = 'PNG'.freeze, # TODO: Write general description for GIF GIF = 'GIF'.freeze, # TODO: Write general description for SVG SVG = 'SVG'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = PDF) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/usps_api/models/image_type2.rb', line 36 def self.from_value(value, default_value = PDF) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'pdf' then PDF when 'tiff' then TIFF when 'jpg' then JPG when 'png' then PNG when 'gif' then GIF when 'svg' then SVG else default_value end end |
.validate(value) ⇒ Object
30 31 32 33 34 |
# File 'lib/usps_api/models/image_type2.rb', line 30 def self.validate(value) return false if value.nil? IMAGE_TYPE2.include?(value) end |