Class: UspsApi::CloseOdContainerRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::CloseOdContainerRequest
- Defined in:
- lib/usps_api/models/close_od_container_request.rb
Overview
CloseOdContainerRequest Model.
Instance Attribute Summary collapse
-
#generate_scan_form ⇒ TrueClass | FalseClass
Designates whether a scan form will be returned in the response.
-
#mailing_date ⇒ Object
The mailing date for when the container will be shipped, when included in the request all packages nested to the container will be updated to align with the associated mailingDate.
-
#scan_form_image_type ⇒ String
The type of scan form image requested.
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(mailing_date: SKIP, generate_scan_form: false, scan_form_image_type: SKIP, additional_properties: nil) ⇒ CloseOdContainerRequest
constructor
A new instance of CloseOdContainerRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_union_type_mailing_date ⇒ 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(mailing_date: SKIP, generate_scan_form: false, scan_form_image_type: SKIP, additional_properties: nil) ⇒ CloseOdContainerRequest
Returns a new instance of CloseOdContainerRequest.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 58 def initialize(mailing_date: SKIP, generate_scan_form: false, scan_form_image_type: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @mailing_date = mailing_date unless mailing_date == SKIP @generate_scan_form = generate_scan_form unless generate_scan_form == SKIP @scan_form_image_type = scan_form_image_type unless scan_form_image_type == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#generate_scan_form ⇒ TrueClass | FalseClass
Designates whether a scan form will be returned in the response
21 22 23 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 21 def generate_scan_form @generate_scan_form end |
#mailing_date ⇒ Object
The mailing date for when the container will be shipped, when included in the request all packages nested to the container will be updated to align with the associated mailingDate. The mailing date may be today plus 0 to 7 days in advance.
17 18 19 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 17 def mailing_date @mailing_date end |
#scan_form_image_type ⇒ String
The type of scan form image requested.
If omitted then the default image type is ‘PDF`.
-
PDF
-
TIFF
-
JPG
-
PNG
-
GIF
-
SVG
-
NONE
33 34 35 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 33 def scan_form_image_type @scan_form_image_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mailing_date = hash.key?('mailingDate') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:MailingDateOptions), hash['mailingDate'] ) : SKIP generate_scan_form = hash['generateScanForm'] ||= false scan_form_image_type = hash.key?('scanFormImageType') ? hash['scanFormImageType'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. CloseOdContainerRequest.new(mailing_date: mailing_date, generate_scan_form: generate_scan_form, scan_form_image_type: scan_form_image_type, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['mailing_date'] = 'mailingDate' @_hash['generate_scan_form'] = 'generateScanForm' @_hash['scan_form_image_type'] = 'scanFormImageType' @_hash end |
.nullables ⇒ Object
An array for nullable fields
54 55 56 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 54 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 45 def self.optionals %w[ mailing_date generate_scan_form scan_form_image_type ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
103 104 105 106 107 108 109 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 103 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.
120 121 122 123 124 125 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 120 def inspect class_name = self.class.name.split('::').last "<#{class_name} mailing_date: #{@mailing_date.inspect}, generate_scan_form:"\ " #{@generate_scan_form.inspect}, scan_form_image_type: #{@scan_form_image_type.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
112 113 114 115 116 117 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 112 def to_s class_name = self.class.name.split('::').last "<#{class_name} mailing_date: #{@mailing_date}, generate_scan_form: #{@generate_scan_form},"\ " scan_form_image_type: #{@scan_form_image_type}, additional_properties:"\ " #{@additional_properties}>" end |
#to_union_type_mailing_date ⇒ Object
95 96 97 98 99 |
# File 'lib/usps_api/models/close_od_container_request.rb', line 95 def to_union_type_mailing_date UnionTypeLookUp.get(:MailingDateOptions) .validate(mailing_date) .serialize(mailing_date) end |