Class: UspsApi::V3ReporterRequest
- Defined in:
- lib/usps_api/models/v3_reporter_request.rb
Overview
V3ReporterRequest Model.
Instance Attribute Summary collapse
-
#destination_zip_code ⇒ String
Destination ZIP Code.
-
#limit ⇒ Float
The number of service standard objects to return.
-
#mail_class ⇒ MailClass9
Mail Class.
-
#offset ⇒ Float
The number of service standard objects to skip before returning the results.
-
#origin_zip_code ⇒ String
Origin ZIP Code.
-
#response_format ⇒ ResponseFormat
Used to specify whether to return 3x3 or 5x5 digit ZIP codes in the response.
-
#return_unsupported_zip_codes ⇒ TrueClass | FalseClass
true or false value specifying whether ‘unsupportedZIPCodes`, `exemptOriginZIPCodes`, and `exemptDestinationZIPCodes` should be returned in the response.
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(origin_zip_code: SKIP, destination_zip_code: SKIP, response_format: SKIP, mail_class: SKIP, offset: SKIP, limit: SKIP, return_unsupported_zip_codes: SKIP, additional_properties: nil) ⇒ V3ReporterRequest
constructor
A new instance of V3ReporterRequest.
-
#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(origin_zip_code: SKIP, destination_zip_code: SKIP, response_format: SKIP, mail_class: SKIP, offset: SKIP, limit: SKIP, return_unsupported_zip_codes: SKIP, additional_properties: nil) ⇒ V3ReporterRequest
Returns a new instance of V3ReporterRequest.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 80 def initialize(origin_zip_code: SKIP, destination_zip_code: SKIP, response_format: SKIP, mail_class: SKIP, offset: SKIP, limit: SKIP, return_unsupported_zip_codes: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @origin_zip_code = origin_zip_code unless origin_zip_code == SKIP @destination_zip_code = destination_zip_code unless destination_zip_code == SKIP @response_format = response_format unless response_format == SKIP @mail_class = mail_class unless mail_class == SKIP @offset = offset unless offset == SKIP @limit = limit unless limit == SKIP unless return_unsupported_zip_codes == SKIP @return_unsupported_zip_codes = return_unsupported_zip_codes end @additional_properties = additional_properties end |
Instance Attribute Details
#destination_zip_code ⇒ String
Destination ZIP Code. 3 or 5 digits. Single (“230” or “23023”), comma-separated values (“123,124,264” or “12356,12357,26589”), or ranges (“132-245” or “12352-23425”).
22 23 24 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 22 def destination_zip_code @destination_zip_code end |
#limit ⇒ Float
The number of service standard objects to return.
41 42 43 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 41 def limit @limit end |
#mail_class ⇒ MailClass9
Mail Class. Single or comma separated values. For USPS GROUND ADVANTAGE HEAVYWEIGHT just use USPS GROUND ADVANTAGE for more than one pound.
32 33 34 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 32 def mail_class @mail_class end |
#offset ⇒ Float
The number of service standard objects to skip before returning the results.
37 38 39 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 37 def offset @offset end |
#origin_zip_code ⇒ String
Origin ZIP Code. 3 or 5 digits. Single (“230” or “23023”), comma-separated values (“123,124,264” or “12356,12357,26589”), or ranges (“132-245” or “12352-23425”).
16 17 18 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 16 def origin_zip_code @origin_zip_code end |
#response_format ⇒ ResponseFormat
Used to specify whether to return 3x3 or 5x5 digit ZIP codes in the response.
27 28 29 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 27 def response_format @response_format end |
#return_unsupported_zip_codes ⇒ TrueClass | FalseClass
true or false value specifying whether ‘unsupportedZIPCodes`, `exemptOriginZIPCodes`, and `exemptDestinationZIPCodes` should be returned in the response.
47 48 49 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 47 def return_unsupported_zip_codes @return_unsupported_zip_codes end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. origin_zip_code = hash.key?('originZIPCode') ? hash['originZIPCode'] : SKIP destination_zip_code = hash.key?('destinationZIPCode') ? hash['destinationZIPCode'] : SKIP response_format = hash.key?('responseFormat') ? hash['responseFormat'] : SKIP mail_class = hash.key?('mailClass') ? hash['mailClass'] : SKIP offset = hash.key?('offset') ? hash['offset'] : SKIP limit = hash.key?('limit') ? hash['limit'] : SKIP return_unsupported_zip_codes = hash.key?('returnUnsupportedZIPCodes') ? hash['returnUnsupportedZIPCodes'] : 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. V3ReporterRequest.new(origin_zip_code: origin_zip_code, destination_zip_code: destination_zip_code, response_format: response_format, mail_class: mail_class, offset: offset, limit: limit, return_unsupported_zip_codes: return_unsupported_zip_codes, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 50 def self.names @_hash = {} if @_hash.nil? @_hash['origin_zip_code'] = 'originZIPCode' @_hash['destination_zip_code'] = 'destinationZIPCode' @_hash['response_format'] = 'responseFormat' @_hash['mail_class'] = 'mailClass' @_hash['offset'] = 'offset' @_hash['limit'] = 'limit' @_hash['return_unsupported_zip_codes'] = 'returnUnsupportedZIPCodes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
76 77 78 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 76 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 63 def self.optionals %w[ origin_zip_code destination_zip_code response_format mail_class offset limit return_unsupported_zip_codes ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
145 146 147 148 149 150 151 152 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 145 def inspect class_name = self.class.name.split('::').last "<#{class_name} origin_zip_code: #{@origin_zip_code.inspect}, destination_zip_code:"\ " #{@destination_zip_code.inspect}, response_format: #{@response_format.inspect},"\ " mail_class: #{@mail_class.inspect}, offset: #{@offset.inspect}, limit: #{@limit.inspect},"\ " return_unsupported_zip_codes: #{@return_unsupported_zip_codes.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
136 137 138 139 140 141 142 |
# File 'lib/usps_api/models/v3_reporter_request.rb', line 136 def to_s class_name = self.class.name.split('::').last "<#{class_name} origin_zip_code: #{@origin_zip_code}, destination_zip_code:"\ " #{@destination_zip_code}, response_format: #{@response_format}, mail_class:"\ " #{@mail_class}, offset: #{@offset}, limit: #{@limit}, return_unsupported_zip_codes:"\ " #{@return_unsupported_zip_codes}, additional_properties: #{@additional_properties}>" end |