Class: UspsApi::Standard
- Defined in:
- lib/usps_api/models/standard.rb
Overview
A Service standard for a unique Mail Class, Acceptance Location, and Delivery Location.
Instance Attribute Summary collapse
-
#days ⇒ Float
The number of days it will take for the package or mail piece will be delivered.
-
#destination_zip_code ⇒ String
The ZIP Code™ of the destination address.
-
#effective_acceptance_date ⇒ Date
This is the effective acceptance date of the package or mail piece.
-
#expected_delivery_date ⇒ Date
This is the expected delivery date of the package or mail piece.
-
#is_priority_mail_next_day ⇒ TrueClass | FalseClass
Indicates if the standard is for Priority Mail Next Day service.
-
#mail_class ⇒ String
The requested mail class.
-
#notes ⇒ Notes1
When a mailClass will be returned with more than one standard the notes will be returned with information on what differentiates the two standards.
-
#origin_zip_code ⇒ String
The ZIP Code™ of the origin address.
-
#presort ⇒ TrueClass | FalseClass
Indicates whether the service standard information is for Presort mail.
-
#scheduled_delivery_date ⇒ Date
Date USPS expects that the package or mailpiece will be delivered based on the origin, destination, and drop-off time and date in the request.
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.
Instance Method Summary collapse
-
#initialize(mail_class: SKIP, notes: SKIP, origin_zip_code: SKIP, destination_zip_code: SKIP, days: SKIP, effective_acceptance_date: SKIP, scheduled_delivery_date: SKIP, expected_delivery_date: SKIP, presort: SKIP, is_priority_mail_next_day: SKIP) ⇒ Standard
constructor
A new instance of Standard.
-
#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(mail_class: SKIP, notes: SKIP, origin_zip_code: SKIP, destination_zip_code: SKIP, days: SKIP, effective_acceptance_date: SKIP, scheduled_delivery_date: SKIP, expected_delivery_date: SKIP, presort: SKIP, is_priority_mail_next_day: SKIP) ⇒ Standard
Returns a new instance of Standard.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/usps_api/models/standard.rb', line 99 def initialize(mail_class: SKIP, notes: SKIP, origin_zip_code: SKIP, destination_zip_code: SKIP, days: SKIP, effective_acceptance_date: SKIP, scheduled_delivery_date: SKIP, expected_delivery_date: SKIP, presort: SKIP, is_priority_mail_next_day: SKIP) @mail_class = mail_class unless mail_class == SKIP @notes = notes unless notes == SKIP @origin_zip_code = origin_zip_code unless origin_zip_code == SKIP @destination_zip_code = destination_zip_code unless destination_zip_code == SKIP @days = days unless days == SKIP unless effective_acceptance_date == SKIP @effective_acceptance_date = effective_acceptance_date end @scheduled_delivery_date = scheduled_delivery_date unless scheduled_delivery_date == SKIP @expected_delivery_date = expected_delivery_date unless expected_delivery_date == SKIP @presort = presort unless presort == SKIP unless is_priority_mail_next_day == SKIP @is_priority_mail_next_day = is_priority_mail_next_day end end |
Instance Attribute Details
#days ⇒ Float
The number of days it will take for the package or mail piece will be delivered.
34 35 36 |
# File 'lib/usps_api/models/standard.rb', line 34 def days @days end |
#destination_zip_code ⇒ String
The ZIP Code™ of the destination address.
29 30 31 |
# File 'lib/usps_api/models/standard.rb', line 29 def destination_zip_code @destination_zip_code end |
#effective_acceptance_date ⇒ Date
This is the effective acceptance date of the package or mail piece.
38 39 40 |
# File 'lib/usps_api/models/standard.rb', line 38 def effective_acceptance_date @effective_acceptance_date end |
#expected_delivery_date ⇒ Date
This is the expected delivery date of the package or mail piece.
52 53 54 |
# File 'lib/usps_api/models/standard.rb', line 52 def expected_delivery_date @expected_delivery_date end |
#is_priority_mail_next_day ⇒ TrueClass | FalseClass
Indicates if the standard is for Priority Mail Next Day service.
60 61 62 |
# File 'lib/usps_api/models/standard.rb', line 60 def is_priority_mail_next_day @is_priority_mail_next_day end |
#mail_class ⇒ String
The requested mail class.
15 16 17 |
# File 'lib/usps_api/models/standard.rb', line 15 def mail_class @mail_class end |
#notes ⇒ Notes1
When a mailClass will be returned with more than one standard the notes will be returned with information on what differentiates the two standards.
21 22 23 |
# File 'lib/usps_api/models/standard.rb', line 21 def notes @notes end |
#origin_zip_code ⇒ String
The ZIP Code™ of the origin address.
25 26 27 |
# File 'lib/usps_api/models/standard.rb', line 25 def origin_zip_code @origin_zip_code end |
#presort ⇒ TrueClass | FalseClass
Indicates whether the service standard information is for Presort mail.
56 57 58 |
# File 'lib/usps_api/models/standard.rb', line 56 def presort @presort end |
#scheduled_delivery_date ⇒ Date
Date USPS expects that the package or mailpiece will be delivered based on the origin, destination, and drop-off time and date in the request. Actual delivery date may vary based on when the package or mailpiece is entered or other conditions. Note: This field has been deprecated in favor of ‘expectedDeliveryDate` and will be removed in a future release. Please transition to using `expectedDeliveryDate`.
48 49 50 |
# File 'lib/usps_api/models/standard.rb', line 48 def scheduled_delivery_date @scheduled_delivery_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/usps_api/models/standard.rb', line 123 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mail_class = hash.key?('mailClass') ? hash['mailClass'] : SKIP notes = hash.key?('notes') ? hash['notes'] : SKIP origin_zip_code = hash.key?('originZIPCode') ? hash['originZIPCode'] : SKIP destination_zip_code = hash.key?('destinationZIPCode') ? hash['destinationZIPCode'] : SKIP days = hash.key?('days') ? hash['days'] : SKIP effective_acceptance_date = hash.key?('effectiveAcceptanceDate') ? hash['effectiveAcceptanceDate'] : SKIP scheduled_delivery_date = hash.key?('scheduledDeliveryDate') ? hash['scheduledDeliveryDate'] : SKIP expected_delivery_date = hash.key?('expectedDeliveryDate') ? hash['expectedDeliveryDate'] : SKIP presort = hash.key?('presort') ? hash['presort'] : SKIP is_priority_mail_next_day = hash.key?('isPriorityMailNextDay') ? hash['isPriorityMailNextDay'] : SKIP # Create object from extracted values. Standard.new(mail_class: mail_class, notes: notes, origin_zip_code: origin_zip_code, destination_zip_code: destination_zip_code, days: days, effective_acceptance_date: effective_acceptance_date, scheduled_delivery_date: scheduled_delivery_date, expected_delivery_date: expected_delivery_date, presort: presort, is_priority_mail_next_day: is_priority_mail_next_day) end |
.names ⇒ Object
A mapping from model property names to API property names.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/usps_api/models/standard.rb', line 63 def self.names @_hash = {} if @_hash.nil? @_hash['mail_class'] = 'mailClass' @_hash['notes'] = 'notes' @_hash['origin_zip_code'] = 'originZIPCode' @_hash['destination_zip_code'] = 'destinationZIPCode' @_hash['days'] = 'days' @_hash['effective_acceptance_date'] = 'effectiveAcceptanceDate' @_hash['scheduled_delivery_date'] = 'scheduledDeliveryDate' @_hash['expected_delivery_date'] = 'expectedDeliveryDate' @_hash['presort'] = 'presort' @_hash['is_priority_mail_next_day'] = 'isPriorityMailNextDay' @_hash end |
.nullables ⇒ Object
An array for nullable fields
95 96 97 |
# File 'lib/usps_api/models/standard.rb', line 95 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/usps_api/models/standard.rb', line 79 def self.optionals %w[ mail_class notes origin_zip_code destination_zip_code days effective_acceptance_date scheduled_delivery_date expected_delivery_date presort is_priority_mail_next_day ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
168 169 170 171 172 173 174 175 176 177 |
# File 'lib/usps_api/models/standard.rb', line 168 def inspect class_name = self.class.name.split('::').last "<#{class_name} mail_class: #{@mail_class.inspect}, notes: #{@notes.inspect},"\ " origin_zip_code: #{@origin_zip_code.inspect}, destination_zip_code:"\ " #{@destination_zip_code.inspect}, days: #{@days.inspect}, effective_acceptance_date:"\ " #{@effective_acceptance_date.inspect}, scheduled_delivery_date:"\ " #{@scheduled_delivery_date.inspect}, expected_delivery_date:"\ " #{@expected_delivery_date.inspect}, presort: #{@presort.inspect},"\ " is_priority_mail_next_day: #{@is_priority_mail_next_day.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
158 159 160 161 162 163 164 165 |
# File 'lib/usps_api/models/standard.rb', line 158 def to_s class_name = self.class.name.split('::').last "<#{class_name} mail_class: #{@mail_class}, notes: #{@notes}, origin_zip_code:"\ " #{@origin_zip_code}, destination_zip_code: #{@destination_zip_code}, days: #{@days},"\ " effective_acceptance_date: #{@effective_acceptance_date}, scheduled_delivery_date:"\ " #{@scheduled_delivery_date}, expected_delivery_date: #{@expected_delivery_date}, presort:"\ " #{@presort}, is_priority_mail_next_day: #{@is_priority_mail_next_day}>" end |