Class: UspsApi::AvailableNotificationOptions
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::AvailableNotificationOptions
- Defined in:
- lib/usps_api/models/available_notification_options.rb
Overview
Noticication options that are available for the tracking number
Instance Attribute Summary collapse
-
#alert_delivery ⇒ TrueClass | FalseClass
Mail piece eligibility for Alert - Delivery Expection requests.
-
#dnd ⇒ TrueClass | FalseClass
Mail piece eligibility for DND Delivery Activity requests.
-
#future_delivery ⇒ TrueClass | FalseClass
Mail piece eligibility for Future Delivery Expected Delivery Date / Time Updates requests.
-
#today_delivery ⇒ TrueClass | FalseClass
Mail piece eligibility for Today Delivery Day of Delivery Update requests.
-
#up ⇒ TrueClass | FalseClass
Mail piece eligibility for UP / Mail Pickup Available for Pickup requests.
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(future_delivery: SKIP, alert_delivery: SKIP, today_delivery: SKIP, up: SKIP, dnd: SKIP) ⇒ AvailableNotificationOptions
constructor
A new instance of AvailableNotificationOptions.
-
#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(future_delivery: SKIP, alert_delivery: SKIP, today_delivery: SKIP, up: SKIP, dnd: SKIP) ⇒ AvailableNotificationOptions
Returns a new instance of AvailableNotificationOptions.
63 64 65 66 67 68 69 70 |
# File 'lib/usps_api/models/available_notification_options.rb', line 63 def initialize(future_delivery: SKIP, alert_delivery: SKIP, today_delivery: SKIP, up: SKIP, dnd: SKIP) @future_delivery = future_delivery unless future_delivery == SKIP @alert_delivery = alert_delivery unless alert_delivery == SKIP @today_delivery = today_delivery unless today_delivery == SKIP @up = up unless up == SKIP @dnd = dnd unless dnd == SKIP end |
Instance Attribute Details
#alert_delivery ⇒ TrueClass | FalseClass
Mail piece eligibility for Alert - Delivery Expection requests. All past and future activity on the package.
20 21 22 |
# File 'lib/usps_api/models/available_notification_options.rb', line 20 def alert_delivery @alert_delivery end |
#dnd ⇒ TrueClass | FalseClass
Mail piece eligibility for DND Delivery Activity requests. Notification of each delivery or delivery attempt.
34 35 36 |
# File 'lib/usps_api/models/available_notification_options.rb', line 34 def dnd @dnd end |
#future_delivery ⇒ TrueClass | FalseClass
Mail piece eligibility for Future Delivery Expected Delivery Date / Time Updates requests. Future activity only on the package.
15 16 17 |
# File 'lib/usps_api/models/available_notification_options.rb', line 15 def future_delivery @future_delivery end |
#today_delivery ⇒ TrueClass | FalseClass
Mail piece eligibility for Today Delivery Day of Delivery Update requests.
25 26 27 |
# File 'lib/usps_api/models/available_notification_options.rb', line 25 def today_delivery @today_delivery end |
#up ⇒ TrueClass | FalseClass
Mail piece eligibility for UP / Mail Pickup Available for Pickup requests.
29 30 31 |
# File 'lib/usps_api/models/available_notification_options.rb', line 29 def up @up end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/usps_api/models/available_notification_options.rb', line 73 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. future_delivery = hash.key?('futureDelivery') ? hash['futureDelivery'] : SKIP alert_delivery = hash.key?('alertDelivery') ? hash['alertDelivery'] : SKIP today_delivery = hash.key?('todayDelivery') ? hash['todayDelivery'] : SKIP up = hash.key?('UP') ? hash['UP'] : SKIP dnd = hash.key?('DND') ? hash['DND'] : SKIP # Create object from extracted values. AvailableNotificationOptions.new(future_delivery: future_delivery, alert_delivery: alert_delivery, today_delivery: today_delivery, up: up, dnd: dnd) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 |
# File 'lib/usps_api/models/available_notification_options.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['future_delivery'] = 'futureDelivery' @_hash['alert_delivery'] = 'alertDelivery' @_hash['today_delivery'] = 'todayDelivery' @_hash['up'] = 'UP' @_hash['dnd'] = 'DND' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 |
# File 'lib/usps_api/models/available_notification_options.rb', line 59 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
48 49 50 51 52 53 54 55 56 |
# File 'lib/usps_api/models/available_notification_options.rb', line 48 def self.optionals %w[ future_delivery alert_delivery today_delivery up dnd ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
94 95 96 97 98 99 100 |
# File 'lib/usps_api/models/available_notification_options.rb', line 94 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.
110 111 112 113 114 115 |
# File 'lib/usps_api/models/available_notification_options.rb', line 110 def inspect class_name = self.class.name.split('::').last "<#{class_name} future_delivery: #{@future_delivery.inspect}, alert_delivery:"\ " #{@alert_delivery.inspect}, today_delivery: #{@today_delivery.inspect}, up:"\ " #{@up.inspect}, dnd: #{@dnd.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 |
# File 'lib/usps_api/models/available_notification_options.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} future_delivery: #{@future_delivery}, alert_delivery: #{@alert_delivery},"\ " today_delivery: #{@today_delivery}, up: #{@up}, dnd: #{@dnd}>" end |