Class: UspsApi::NonMachinableIndicators
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::NonMachinableIndicators
- Defined in:
- lib/usps_api/models/non_machinable_indicators.rb
Overview
Set of boolean indicators used to determine whether a letter/flat/card qualifies as nonmachinable.
Instance Attribute Summary collapse
-
#has_closure_devices ⇒ TrueClass | FalseClass
Does the letter/flat/card have clasps, strings, buttons, or similar closure devices.
-
#has_loose_items ⇒ TrueClass | FalseClass
Does the letter/flat/card contain items such as pens, pencils, keys, or coins that cause the thickness of the mailpiece to be uneven; or loose keys or coins or similar objects not affixed to the contents within the mailpiece.
-
#is_booklet ⇒ TrueClass | FalseClass
Is the letter/flat/card a booklet that is not prepared according to [DMM 201.3.16](pe.usps.com/text/dmm300/201.htm#ep1092751).
-
#is_polybagged ⇒ TrueClass | FalseClass
Is the letter/flat/card polybagged, polywrapped, enclosed in any plastic material, or has an exterior surface made of a material that is not paper.
-
#is_rigid ⇒ TrueClass | FalseClass
Is the letter/flat/card too rigid (does not bend easily when subjected to a transport belt tension of 40 pounds around an 11-inch diameter turn).
-
#is_self_mailer ⇒ TrueClass | FalseClass
Is the letter/flat/card a self-mailer that is not prepared according to [DMM 201.3.14](pe.usps.com/text/dmm300/201.htm#ep1079302).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(is_polybagged: false, has_closure_devices: false, has_loose_items: false, is_rigid: false, is_self_mailer: false, is_booklet: false) ⇒ NonMachinableIndicators
constructor
A new instance of NonMachinableIndicators.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(is_polybagged: false, has_closure_devices: false, has_loose_items: false, is_rigid: false, is_self_mailer: false, is_booklet: false) ⇒ NonMachinableIndicators
Returns a new instance of NonMachinableIndicators.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 79 def initialize(is_polybagged: false, has_closure_devices: false, has_loose_items: false, is_rigid: false, is_self_mailer: false, is_booklet: false) @is_polybagged = is_polybagged unless is_polybagged == SKIP @has_closure_devices = has_closure_devices unless has_closure_devices == SKIP @has_loose_items = has_loose_items unless has_loose_items == SKIP @is_rigid = is_rigid unless is_rigid == SKIP @is_self_mailer = is_self_mailer unless is_self_mailer == SKIP @is_booklet = is_booklet unless is_booklet == SKIP end |
Instance Attribute Details
#has_closure_devices ⇒ TrueClass | FalseClass
Does the letter/flat/card have clasps, strings, buttons, or similar closure devices.
24 25 26 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 24 def has_closure_devices @has_closure_devices end |
#has_loose_items ⇒ TrueClass | FalseClass
Does the letter/flat/card contain items such as pens, pencils, keys, or coins that cause the thickness of the mailpiece to be uneven; or loose keys or coins or similar objects not affixed to the contents within the mailpiece. Loose items may cause a letter to be nonmailable when mailed in paper envelopes; (see [DMM 601.3.3](pe.usps.com/text/dmm300/601.htm#ep1196660)).
33 34 35 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 33 def has_loose_items @has_loose_items end |
#is_booklet ⇒ TrueClass | FalseClass
Is the letter/flat/card a booklet that is not prepared according to [DMM 201.3.16](pe.usps.com/text/dmm300/201.htm#ep1092751).
48 49 50 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 48 def is_booklet @is_booklet end |
#is_polybagged ⇒ TrueClass | FalseClass
Is the letter/flat/card polybagged, polywrapped, enclosed in any plastic material, or has an exterior surface made of a material that is not paper. Windows in envelopes made of paper do not make mailpieces nonmachinable. Attachments allowable under applicable eligibility standards do not make mailpieces nonmachinable.
19 20 21 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 19 def is_polybagged @is_polybagged end |
#is_rigid ⇒ TrueClass | FalseClass
Is the letter/flat/card too rigid (does not bend easily when subjected to a transport belt tension of 40 pounds around an 11-inch diameter turn).
38 39 40 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 38 def is_rigid @is_rigid end |
#is_self_mailer ⇒ TrueClass | FalseClass
Is the letter/flat/card a self-mailer that is not prepared according to [DMM 201.3.14](pe.usps.com/text/dmm300/201.htm#ep1079302).
43 44 45 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 43 def is_self_mailer @is_self_mailer end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. is_polybagged = hash['isPolybagged'] ||= false has_closure_devices = hash['hasClosureDevices'] ||= false has_loose_items = hash['hasLooseItems'] ||= false is_rigid = hash['isRigid'] ||= false is_self_mailer = hash['isSelfMailer'] ||= false is_booklet = hash['isBooklet'] ||= false # Create object from extracted values. NonMachinableIndicators.new(is_polybagged: is_polybagged, has_closure_devices: has_closure_devices, has_loose_items: has_loose_items, is_rigid: is_rigid, is_self_mailer: is_self_mailer, is_booklet: is_booklet) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['is_polybagged'] = 'isPolybagged' @_hash['has_closure_devices'] = 'hasClosureDevices' @_hash['has_loose_items'] = 'hasLooseItems' @_hash['is_rigid'] = 'isRigid' @_hash['is_self_mailer'] = 'isSelfMailer' @_hash['is_booklet'] = 'isBooklet' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 63 def self.optionals %w[ is_polybagged has_closure_devices has_loose_items is_rigid is_self_mailer is_booklet ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
113 114 115 116 117 118 119 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 113 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
130 131 132 133 134 135 136 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 130 def inspect class_name = self.class.name.split('::').last "<#{class_name} is_polybagged: #{@is_polybagged.inspect}, has_closure_devices:"\ " #{@has_closure_devices.inspect}, has_loose_items: #{@has_loose_items.inspect}, is_rigid:"\ " #{@is_rigid.inspect}, is_self_mailer: #{@is_self_mailer.inspect}, is_booklet:"\ " #{@is_booklet.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
122 123 124 125 126 127 |
# File 'lib/usps_api/models/non_machinable_indicators.rb', line 122 def to_s class_name = self.class.name.split('::').last "<#{class_name} is_polybagged: #{@is_polybagged}, has_closure_devices:"\ " #{@has_closure_devices}, has_loose_items: #{@has_loose_items}, is_rigid: #{@is_rigid},"\ " is_self_mailer: #{@is_self_mailer}, is_booklet: #{@is_booklet}>" end |