Class: UspsApi::Standard1
- Defined in:
- lib/usps_api/models/standard1.rb
Overview
List of service standards
Instance Attribute Summary collapse
-
#destination_zip_code ⇒ String
Destination ZIP Code.
-
#fcm_svc_std ⇒ Float
First-Class Mail Single Piece Service Standard.
-
#gah_svc_std ⇒ Float
Ground Advantage Heavyweight >= 16oz Service Standard.
-
#gal_svc_std ⇒ Float
Ground Advantage Lightweight <= 15.999oz.
-
#mkt_svc_std ⇒ Float
Marketing Mail Service Standard.
-
#origin_zip_code ⇒ String
Origin ZIP Code.
-
#per_svc_std ⇒ Float
Periodicals Service Standard.
-
#pfc_svc_std ⇒ Float
Presort First-Class Mail Service Standard.
-
#pkg_svc_std ⇒ Float
Package Services Service Standard.
-
#pri_svc_std ⇒ Float
Priority Mail Service Standard.
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, fcm_svc_std: SKIP, gah_svc_std: SKIP, gal_svc_std: SKIP, mkt_svc_std: SKIP, per_svc_std: SKIP, pkg_svc_std: SKIP, pri_svc_std: SKIP, pfc_svc_std: SKIP, additional_properties: nil) ⇒ Standard1
constructor
A new instance of Standard1.
-
#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, fcm_svc_std: SKIP, gah_svc_std: SKIP, gal_svc_std: SKIP, mkt_svc_std: SKIP, per_svc_std: SKIP, pkg_svc_std: SKIP, pri_svc_std: SKIP, pfc_svc_std: SKIP, additional_properties: nil) ⇒ Standard1
Returns a new instance of Standard1.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/usps_api/models/standard1.rb', line 89 def initialize(origin_zip_code: SKIP, destination_zip_code: SKIP, fcm_svc_std: SKIP, gah_svc_std: SKIP, gal_svc_std: SKIP, mkt_svc_std: SKIP, per_svc_std: SKIP, pkg_svc_std: SKIP, pri_svc_std: SKIP, pfc_svc_std: 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 @fcm_svc_std = fcm_svc_std unless fcm_svc_std == SKIP @gah_svc_std = gah_svc_std unless gah_svc_std == SKIP @gal_svc_std = gal_svc_std unless gal_svc_std == SKIP @mkt_svc_std = mkt_svc_std unless mkt_svc_std == SKIP @per_svc_std = per_svc_std unless per_svc_std == SKIP @pkg_svc_std = pkg_svc_std unless pkg_svc_std == SKIP @pri_svc_std = pri_svc_std unless pri_svc_std == SKIP @pfc_svc_std = pfc_svc_std unless pfc_svc_std == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#destination_zip_code ⇒ String
Destination ZIP Code
18 19 20 |
# File 'lib/usps_api/models/standard1.rb', line 18 def destination_zip_code @destination_zip_code end |
#fcm_svc_std ⇒ Float
First-Class Mail Single Piece Service Standard
22 23 24 |
# File 'lib/usps_api/models/standard1.rb', line 22 def fcm_svc_std @fcm_svc_std end |
#gah_svc_std ⇒ Float
Ground Advantage Heavyweight >= 16oz Service Standard
26 27 28 |
# File 'lib/usps_api/models/standard1.rb', line 26 def gah_svc_std @gah_svc_std end |
#gal_svc_std ⇒ Float
Ground Advantage Lightweight <= 15.999oz
30 31 32 |
# File 'lib/usps_api/models/standard1.rb', line 30 def gal_svc_std @gal_svc_std end |
#mkt_svc_std ⇒ Float
Marketing Mail Service Standard
34 35 36 |
# File 'lib/usps_api/models/standard1.rb', line 34 def mkt_svc_std @mkt_svc_std end |
#origin_zip_code ⇒ String
Origin ZIP Code
14 15 16 |
# File 'lib/usps_api/models/standard1.rb', line 14 def origin_zip_code @origin_zip_code end |
#per_svc_std ⇒ Float
Periodicals Service Standard
38 39 40 |
# File 'lib/usps_api/models/standard1.rb', line 38 def per_svc_std @per_svc_std end |
#pfc_svc_std ⇒ Float
Presort First-Class Mail Service Standard
50 51 52 |
# File 'lib/usps_api/models/standard1.rb', line 50 def pfc_svc_std @pfc_svc_std end |
#pkg_svc_std ⇒ Float
Package Services Service Standard
42 43 44 |
# File 'lib/usps_api/models/standard1.rb', line 42 def pkg_svc_std @pkg_svc_std end |
#pri_svc_std ⇒ Float
Priority Mail Service Standard
46 47 48 |
# File 'lib/usps_api/models/standard1.rb', line 46 def pri_svc_std @pri_svc_std end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
111 112 113 114 115 116 117 118 119 120 121 122 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 |
# File 'lib/usps_api/models/standard1.rb', line 111 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 fcm_svc_std = hash.key?('FCMSvcStd') ? hash['FCMSvcStd'] : SKIP gah_svc_std = hash.key?('GAHSvcStd') ? hash['GAHSvcStd'] : SKIP gal_svc_std = hash.key?('GALSvcStd') ? hash['GALSvcStd'] : SKIP mkt_svc_std = hash.key?('MktSvcStd') ? hash['MktSvcStd'] : SKIP per_svc_std = hash.key?('PerSvcStd') ? hash['PerSvcStd'] : SKIP pkg_svc_std = hash.key?('PkgSvcStd') ? hash['PkgSvcStd'] : SKIP pri_svc_std = hash.key?('PriSvcStd') ? hash['PriSvcStd'] : SKIP pfc_svc_std = hash.key?('PFCSvcStd') ? hash['PFCSvcStd'] : 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. Standard1.new(origin_zip_code: origin_zip_code, destination_zip_code: destination_zip_code, fcm_svc_std: fcm_svc_std, gah_svc_std: gah_svc_std, gal_svc_std: gal_svc_std, mkt_svc_std: mkt_svc_std, per_svc_std: per_svc_std, pkg_svc_std: pkg_svc_std, pri_svc_std: pri_svc_std, pfc_svc_std: pfc_svc_std, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/usps_api/models/standard1.rb', line 53 def self.names @_hash = {} if @_hash.nil? @_hash['origin_zip_code'] = 'originZIPCode' @_hash['destination_zip_code'] = 'destinationZIPCode' @_hash['fcm_svc_std'] = 'FCMSvcStd' @_hash['gah_svc_std'] = 'GAHSvcStd' @_hash['gal_svc_std'] = 'GALSvcStd' @_hash['mkt_svc_std'] = 'MktSvcStd' @_hash['per_svc_std'] = 'PerSvcStd' @_hash['pkg_svc_std'] = 'PkgSvcStd' @_hash['pri_svc_std'] = 'PriSvcStd' @_hash['pfc_svc_std'] = 'PFCSvcStd' @_hash end |
.nullables ⇒ Object
An array for nullable fields
85 86 87 |
# File 'lib/usps_api/models/standard1.rb', line 85 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/usps_api/models/standard1.rb', line 69 def self.optionals %w[ origin_zip_code destination_zip_code fcm_svc_std gah_svc_std gal_svc_std mkt_svc_std per_svc_std pkg_svc_std pri_svc_std pfc_svc_std ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
160 161 162 163 164 165 166 167 168 |
# File 'lib/usps_api/models/standard1.rb', line 160 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}, fcm_svc_std: #{@fcm_svc_std.inspect}, gah_svc_std:"\ " #{@gah_svc_std.inspect}, gal_svc_std: #{@gal_svc_std.inspect}, mkt_svc_std:"\ " #{@mkt_svc_std.inspect}, per_svc_std: #{@per_svc_std.inspect}, pkg_svc_std:"\ " #{@pkg_svc_std.inspect}, pri_svc_std: #{@pri_svc_std.inspect}, pfc_svc_std:"\ " #{@pfc_svc_std.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
150 151 152 153 154 155 156 157 |
# File 'lib/usps_api/models/standard1.rb', line 150 def to_s class_name = self.class.name.split('::').last "<#{class_name} origin_zip_code: #{@origin_zip_code}, destination_zip_code:"\ " #{@destination_zip_code}, fcm_svc_std: #{@fcm_svc_std}, gah_svc_std: #{@gah_svc_std},"\ " gal_svc_std: #{@gal_svc_std}, mkt_svc_std: #{@mkt_svc_std}, per_svc_std: #{@per_svc_std},"\ " pkg_svc_std: #{@pkg_svc_std}, pri_svc_std: #{@pri_svc_std}, pfc_svc_std: #{@pfc_svc_std},"\ " additional_properties: #{@additional_properties}>" end |